Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

How to get the latest and oldest record in Laravel Eloquent through ofMany.

Laravel ships with many awesome and time-saving methods for developers like us.. Here we will see some “One of Many” function’s examples:   Get the latest/last record from a model/relation function latestRecord() { return $this->hasOne(RelationModel::class)->latestOfMany(); } Get the oldest/first record from a model/relation function latestRecord() { return $this->hasOne(RelationModel::class)->oldestOfMany(); }   Bonus!: Retrieve records with special […]

Copy or duplicate a row in Laravel project

I have been working on an application named “EasySME” with Laravel & MySQL. And a client requested a new feature that he wants to clone/copy/duplicate the existing Invoice. So, I have done a few searches and R&D and found out that Laravel ships with a built-in function called replicate(). Laravel is awesome, you want it […]

How to get or export SQL query from Laravel migration file?

Hey there.. hope you are facing the same problem as I am facing to update the DB from phpMyAdmin.. and no ssh access from Cpanel to run the migration command on the terminal. And you are in the right place.. here is the solution to get the dump query from the Laravel migration file. Command: […]

Update – Please visit skpaul.me for latest posts and updates

Hi, Greetings!! Thanks for visiting my blog, I have open a blog (https://skpaul.me). So from now, you will get all latest posts and updates on https://skpaul.me.   Please take a look on my personal blog (https://skpaul.me), and let me know your comments and review.   Thanks in Advance sk paul https://skpaul.me

How to find a column or filed name of a table from an entire database?

If you are working on a BIG project with lots of tables in the database, then it will be a good trick query for you to find out a column name of any table from that database.   My scenario was a bit different, I had to start work in the middle of a project […]

Joomla! 3 installation freezes at creating database table

After long time I try to install Joomla and it is Joomla 3.3.0 and face a problem as like you. All things are ok but its taking too much time during database table creation. And here is the solution To solve this go to Your joomla folder\installation\sql\mysql and open Joomla.sql file find the term “ENGINE=InnoDB” […]

PHP code to execute MySQL script

There are advanced and comfortable tools to manage your MySQL databases (i.e.  server side: phpMyAdmin, client side:  SQLyog). But sometimes you can not use those tools and need the ability to execute some SQL script on server by your own hands, easy and fast way. What to do in such situation? Use this PHP code […]

Wordpress Social Share Plugin powered by Ultimatelysocial