Tag : Laravel Eloquent

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




How to use Union query with Laravel Eloquent?

How to use Union query with Laravel Eloquent?

In this post, i would like to share with you how we can use union and union all query in laravel 5 application. Laravel eloquent provide query builder and they give us join, relationship, subquery and also union. But we need some time to get all records from two different table at that time you nee.....

By Hardik Savani | September 18, 2018 | Category : PHP Laravel

laravel 5.4 New Feature - Add eloquent whereKey method

laravel 5.4 New Feature - Add eloquent whereKey method

Yesterday release Laravel 5.4 new version with new features and many upgrade. Laravel also provide documentation for Laravel 5.4 on their website. There are several update in Laravel 5.4 like in collections, mail, factory helper, Bootstrappers etc. In this post we are going to see whereKey method.....

By Hardik Savani | January 25, 2017 | Category : Laravel


How to disable model timestamps in Laravel 5.3?

How to disable model timestamps in Laravel 5.3?

Sometimes we require to disable created_at and updated_at timestamps on Model on Laravel, so we can do it simply by using <strong class="path">$timestamps</strong> variable of model. It is very small things but important to understand and how to use it. When you create new item or user using model.....

By Hardik Savani | October 12, 2016 | Category : Laravel

How to get table name from model in Laravel 5?

How to get table name from model in Laravel 5?

If you need to get table name from model in your laravel application then this post can help you to get table name. Laravel based on MVC. So, we require to create model for every table that way we can write database logic on model. But if you require to get table name from model then you can get usi.....

By Hardik Savani | August 22, 2016 | Category : Laravel

How to use groupby having with DB::raw in Laravel Query Builder?

How to use groupby having with DB::raw in Laravel Query Builder?

We most probably require to use group by having because if you work on small project then it's not need to use generally. But if you work with big project like e-commerce, social or ERP level project then you may require to use having clause. having clause, we can use simply if we have to compare .....

By Hardik Savani | July 6, 2016 | Category : Laravel

How to insert multiple records in Laravel 5?

How to insert multiple records in Laravel 5?

If we work on big project and then we maybe require to add multiple rows on database using laravel eloquent. Laravel provide insert method for bulk records create on db. In bellow example you can see i use multidimensional $myItems array variable and that insert multiple records same time using DB.....

By Hardik Savani | June 13, 2016 | Category : Laravel

Laravel 5 select with count query with group by example

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 dire.....

By Hardik Savani | June 9, 2016 | Category : Laravel

How to convert object to array in Laravel 5?

How to convert object to array in Laravel 5?

If you require to convert object data from db into array then you can do it using DB facade and Model Eloquent. Sometimes we need to give array data only so we must get array data from db. I have two examples so it can helps you. In first example, If you use Model Eloquent for get data from databas.....

By Hardik Savani | June 2, 2016 | Category : Laravel

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

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() an.....

By Hardik Savani | May 4, 2016 | Category : Laravel

How to select concat columns with Laravel Query Builder?

How to select concat columns with Laravel Query Builder?

We are always wanted to use sql query for concatenate fullname or something to concat using mysql concat function, now if you think how to use concat function in laravel query builder then this post can help you. So, if you need to use concat mysql function then see bellow example: <strong>Example:<.....

By Hardik Savani | April 30, 2016 | Category : Laravel