© Sanjib Sinha 2017

Sanjib Sinha, Beginning Laravel, 10.1007/978-1-4842-2538-7_9

9. Eloquent

Sanjib Sinha

(1)Howrah, West Bengal, India

Eloquent Model class is used for Laravel’s ‘active record implementation’ methods. It literally means that we can easily ‘CREATE, RETRIEVE, UPDATE, or DELETE’ any database record using this Eloquent Model class.

In the Laravel PHP artisan command we generate files through ‘make’. We have seen it before in case of ‘controllers’, ‘migrations’. Now we can do the same thing in our Model class.

Remember one thing: if you have a table called ‘tasks’, then you must have a model called ‘Task’. If we have a table called ‘songs’, we must have a model called ‘Song’. In the model, the name starts with the capital letter and the ...

Get Beginning Laravel: A beginner's guide to application development with Laravel 5.3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.