Tag : Last


How to get last 2 days records from table using Mysql Query?

We may sometimes require to get few days ago records from table like last 2 days, last 3 days, last 10 days or last 15 days etc. Most of developer choose other logic but we can easily get using mysql query(using CURDATE and INTERVAL). In this example mysql query i have one table "elements" and columns are id, title, description, created_at(timestamps) and update_at, Now we will get all records of last 2 days.so you can fetch fields value using CURDATE and INTERVAL of mysql. In following example you can see how to select data of last two days. <strong>Query:</strong> <pre> SELECT * FROM `elem.....

By Hardik Savani | July 22, 2016 | | 661 Viewer | Category : PHP MySql
READ MORE

How to get last record of database table in Laravel?

Sometimes we may require to get only last record of table in our project, we can get several way. We can fetch last record of database table using latest() or orderBy(). In bellow example you can see how i get then last record of table. I have "items" table and i want to get last record of "items" table. In first example i use latest() with first() because latest() will fetch only latest record according to created_at then first() will get only single record: <strong>Using latest() belong to created_at field:</strong> <pre class="prettyprint lang-php"> $last = DB::table('items')->latest()->f.....

By Hardik Savani | July 14, 2016 | | 1103 Viewer | Category : Laravel
READ MORE

How to get last executed query in Larave 5?

We have been many time need to get executed query log or you want to get last executed query or maybe if you want to diaplsy sql query from laravel query builder then you can do it that. so i have three example for display executed query in Laravel 5. when you are working on laravel application at that times , i think you need many time to print last run query or if you want to check direct from phpmyadmin sql box, so at that time you have to follow this three example. so, let's see three example of getting sql query from Laravel Query Builder. <strong class="step">Example 1:</strong> In this.....

By Hardik Savani | April 10, 2016 | | 1787 Viewer | Category : Laravel
READ MORE

Git remove last commit from local

Git is distributed version control system that is a awesome. when ever you are working with git repository. if you did commit your code in your local system by mistake, then if you want to remove last commit from your project. so let's see following example: <strong class="example">Example:</strong> <pre class="prettyprint lang-php"> git add . git commit -m "change for test" git reset --soft HEAD~ </pre>

By Hardik Savani | March 18, 2016 | | 476 Viewer | Category : Git
READ MORE

    Laravel 5 - How to get difference of time in minutes?

    Laravel 5 - How to get difference of time in minutes?

    Open Post

    Jquery - How to copy text to clipboard without flash example ?

    Jquery - How to copy text to clipboard without flash example ?

    Open Post

    How to use login throttle in laravel 5?

    How to use login throttle in laravel 5?

    Open Post

    How to add charts in Laravel 5 using Highcharts ?

    How to add charts in Laravel 5 using Highcharts ?

    Open Post

    Angularjs nl2br(textarea newline and linebreak conversion) example with demo

    Angularjs nl2br(textarea newline and linebreak conversion) example with demo

    Open Post

    Laravel 5 dropbox api file upload example using league/flysystem-dropbox package

    Laravel 5 dropbox api file upload example using league/flysystem-dropbox package

    Open Post