Top "Eloquent" questions

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

Retrive all rows from last month (Laravel + Eloquent)

I'm trying to get all records that belongs to last month, so far I managed to get all from last …

php mysql laravel eloquent php-carbon
How to soft delete related records when soft deleting a parent record in Laravel?

I have this invoices table that which has the following structure id | name | amount | deleted_at 2 iMac 1500 | NULL and a …

php laravel laravel-5 eloquent soft-delete
laravel search multiple words separated by space

I am new to laravel query builder, I want to search multiple words entered in an input field for example …

php mysql laravel eloquent query-builder
update pivot table in case of many to many relation laravel4

I have started working with Laravel4 recently. I am facing some problem while updating pivot table data, in case of …

many-to-many laravel pivot-table laravel-4 eloquent
Laravel 6: Call to undefined method App\\User::createToken()

I'm trying to generate a token to authenticate users in my Controller the following way: namespace App\Http\Controllers\API; …

php laravel eloquent laravel-passport laravel-authentication
laravel - eloquent - get sum of related model specific column

assuming that I have the table orders with fields id, userId, amount, description and the table user with various fields …

laravel eloquent eager-loading
Laravel 5.6 Api - Search,sort and filter on list of data

Hi I am developing a rest api endpoint for retrieving paginated list of users. In the frontend, there are options …

laravel laravel-5 eloquent laravel-5.6 laravel-request
Constructors on classes extending Eloquent

I just started a new website and I wanted to make use of Eloquent. In the process of seeding my …

php laravel laravel-4 eloquent seeding
Laravel: performing some task on every insert/update when using Query Builder or Eloquent ORM

The Problem I would like to automatically add created_by and modified_by fields to every insert/update to a …

php laravel laravel-4 eloquent query-builder
Laravel 3 Eloquent How to select column as

I'm trying to figure out how to give a column an alias using Eloquent. So, in other words, how do …

select laravel alias eloquent laravel-3