Friday, March 9, 2018
Understanding Models And Views In Laravel 5 4
Understanding Models And Views In Laravel 5 4
Understanding Models And Views In Laravel 5.4
Today, I will describe Model and View of the MVC architecture, and how these ideas are implemented in Laravel 5.4.
Models in Laravel 5.4
In Laravel, models are created inside the app folder. Models are mostly used to interact with database using Eloquent ORM. Eloquent provides simple ActiveRecord implementations for database interaction.
The easiest way to create a model is the Artisan command:
1 | php artisan make:model <model name> |
Let�s first create a new table books in the database. Use the following schema:
1 2 3 4 5 6 7 8 9 10 11 | CREATE TABLE `books` ( `id` int(11) NOT NULL, `name` varchar(256) NOT NULL, `category` varchar(256) NOT NULL, `description` text NOT link download
Related Post
Subscribe to:
Post Comments (Atom)
|
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.