Tag : DB::raw()

ItSolutionStuff.com have tutorials for DB::raw() tag, here you can study articles of DB::raw() tag, DB::raw() tag posts collection, most popular and useful tutorials of DB::raw() tag, here you can find list of all relevant posts and example about DB::raw() tag, we have lists of tutorials and examples about DB::raw() tag. very simple and quick example collection of Latest DB::raw() tag.



Laravel where clause with date_format() example

In this post, i share with you that how to use date_format() with where condition of Laravel query builder. When i was working on my project, i require to search with get only selected month and year records from created_at(timestamp) column. I was thinking how can i but i know date_format() of mysql. but don't know how to use in laravel where clause. At last i use DB::raw() of Laravel and it's work. If you have also need to search this way then you can do it this way: <strong>Example:</strong> <pre class="prettyprint lang-php"> $data = DB::table("items") ->select("id","title","creat.....

By Hardik Savani | June 22, 2016 | | 13474 Viewer | Category : Laravel
READ MORE

Laravel 5 select with count query with group by example

We always required to get count of number of records or number of inserted record of current month etc in laravel. We can use mysql count function in laravel eloquent. We have two way to get count of column value. first we can use laravel count() of query builder and another one we can use with directly with select statement using DB::raw(). I give you both example you can see and use any one as perfect for you. <strong>Example 1:</strong> <pre class="prettyprint lang-php"> $data = DB::table("click")->count(); print_r($data); </pre> <strong>Example 2:</strong> <pre class="prettyprint lang-php.....

By Hardik Savani | June 9, 2016 | | 64238 Viewer | Category : Laravel
READ MORE

Laravel 5 - Orderby random using rand() and DB::raw() example

Sometimes, we require to get randomly data using laravel query builder. you can use mysql rand() with order by. If you want to get random data using laravel eloquent then we need to use DB::raw(). In bellow example you can i use DB::raw(). In this example i use DB::raw('RAND()') inside orderBy() and also add limit of 8 number of record, so you can easily implement in your laravel project. so let's try... <pre class="prettyprint lang-php"> return DB::table("posts") ->select("posts.*") ->orderBy(DB::raw('RAND()')) ->take(8) ->get(); </pre>

By Hardik Savani | May 4, 2016 | | 21868 Viewer | Category : Laravel
READ MORE

    Laravel 5 - Image Gallery CRUD example from scratch

    Laravel 5 - Image Gallery CRUD example from scratch

    Open Post

    How to change date format in jquery using moment JS ?

    How to change date format in jquery using moment JS ?

    Open Post

    Laravel 5 Autocomplete using Bootstrap Typeahead JS Example with Demo

    Laravel 5 Autocomplete using Bootstrap Typeahead JS Example with Demo

    Open Post

    Laravel 5 - Image Upload and Resize Example using Intervention Image Package

    Laravel 5 - Image Upload and Resize Example using Intervention Image Package

    Open Post

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

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

    Open Post

    Simple PHP Jquery Ajax CRUD(insert update delete) tutorial example with source code

    Simple PHP Jquery Ajax CRUD(insert update delete) tutorial example with source code

    Open Post