Top "Eloquent" questions

The Eloquent ORM included with Laravel provides a beautiful, simple ActiveRecord implementation for working with your database.

Add lists() method in Query Builder in Laravel 5.4

I know the fact that Laravel has removed lists() function and moved functions signature as pluck(). But, this leads to …

php laravel eloquent laravel-query-builder pluck
Associate() in laravel

I have 2 models, a User and an Address. I am still experimenting on associate() since I read it in https://…

php laravel eloquent associate
How to mock static methods of a Laravel Eloquent model?

I have in my code a line like this: ModelName::create($data); where ModelName is just an Eloquent model. Is …

unit-testing laravel eloquent mockery
Update dateTime column with laravel

I have a pins table in my database with a pin_date column. In my migration I have this: $table-&…

mysql database laravel eloquent laravel-5.6
Laravel Facade error: Non-static method should not be called statically

I have a simple modal having an index method to get data from DB Modal: Nation namespace App\Models; use …

laravel eloquent laravel-facade
how to make query with substr in eloquent (laravel 4)?

I have this query: select substr(id,1,4) as id from meteo.a2012 group by substr(id,1,4) I just want to …

laravel laravel-4 substr eloquent
Why can't Laravel/Eloquent use JOIN for Eager Loading?

<?php class Cat extends Eloquent { public function user() { return $this->belongsTo('User'); } } class User extends Eloquent { public function …

php join laravel-4 eloquent eager-loading
Fatal error: Class 'Illuminate\Database\Capsule\Manager' not found

Im follow phpacademys new authentication tutorial https://www.youtube.com/watch?v=PF2WkRCZfBg i have a class file database.…

php laravel eloquent composer-php vendor
Laravel using Sum and Groupby

I would like to fetch sum of quantity in each month, so that I can display on bar chart quantities …

php laravel eloquent laravel-5.6 laravel-collection
Laravel 5 eager loading with limit

I have two tables, say "users" and "users_actions", where "users_actions" has an hasMany relation with users: users id | …

php laravel-5 eloquent greatest-n-per-group eager-loading