Top "Eloquent" questions

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

Migration: Cannot add foreign key constraint

I'm trying to create foreign keys in Laravel however when I migrate my table using artisan i am thrown the …

laravel laravel-4 foreign-keys migration eloquent
Bulk Insertion in Laravel using eloquent ORM

How can we perform bulk database insertions in Laravel using Eloquent ORM? I want to accomplish this in Laravel: https://…

php database laravel eloquent
Laravel Migration Change to Make a Column Nullable

I created a migration with unsigned user_id. How can I edit user_id in a new migration to also …

laravel laravel-5 eloquent nullable laravel-migrations
Add a custom attribute to a Laravel / Eloquent model on load?

I'd like to be able to add a custom attribute/property to an Laravel/Eloquent model when it is loaded, …

php orm laravel eloquent
Laravel Eloquent: Ordering results of all()

I'm stuck on a simple task. I just need to order results coming from this call $results = Project::all(); Where …

laravel laravel-4 eloquent sql-order-by
How to Use Order By for Multiple Columns in Laravel 4?

I want to sort multiple columns in Laravel 4 by using the method orderBy() in Laravel Eloquent. The query will be …

php laravel laravel-4 eloquent laravel-query-builder
Laravel Eloquent limit and offset

This is mine $art = Article::where('id',$article)->firstOrFail(); $products = $art->products; I just wanna take a …

laravel eloquent limit offset
Select all from table with Laravel and Eloquent

I am using Laravel 4 to set up my first model to pull all the rows from a table called posts. …

php mysql laravel laravel-4 eloquent
Laravel Eloquent: How to get only certain columns from joined tables

I have got 2 joined tables in Eloquent namely themes and users. theme model: public function user() { return $this->belongs_…

php laravel eloquent
eloquent laravel: How to get a row count from a ->get()

I'm having a lot of trouble figuring out how to use this collection to count rows. $wordlist = \DB::table('wordlist')…

php sql laravel eloquent