For getting every new tutorial link Please join our telegram group

What is laravel eloquent orm model. Laravel eloquent tutorials for beginners to advanced with hindi video

In this tutorial, we will discuss what is laravel eloquent model and why we use laravel eloquent orm model concepts instead of the query builder.

laravel eloquent model basics.

  1. What is laravel eloquent
  2. All commands to create model
  3. Eloquent model structure
  4. Laravel eloquent vs query builder
  5. Laravel eloquent basic topics

What is laravel eloquent model

Laravel eloquent is an object-relational mapper so it is also called eloquent orm model it is used to interact with databases and perform insert, update and delete operations. In simply it interacts activeRecords from the database. Model is a layer between database and controller

Models are listed in App/Model directory and you also change this by customizing in composer.json file but this is not the right way laravel provides default Model directory that are good and secure.

Laravel all commands to create model

The basic command to create a model is php artisan make:model Student

We also make model and database table migration by one command php artisan make:model Student -m

Or

php artisan make:model Student -migration

And if you create model, migration and controller by single command than use php artisan make:model Student -mc

Eloquent model structure

The below class Student is a basic eloquent model structure that are extends Model class.

<?php  
  
namespace App;  
  
use Illuminate\Database\Eloquent\Model;  
  
class Student extends Model  
{  
    //  
} 

Laravel eloquent vs query builder

The basic difference between Laravel eloquent vs query builder is eloquent provides a large number of methods and relationships. Eloquent model data is form of collection that contain more information and fast.

The eloquent model provides relationships but it slow execution compare to query builder in simple queries but when query have more complex and data come from different relationships than eloquent model better because it provides a good relationship methods.

Laravel eloquent basic topics

In this series we will provide these basic eloquesnt concepts. and after this series also provide eloquent relationships concpts.

  1. basic model configurations
  2. insert data
  3. data reterive
  4. first vs find
  5. delete
  6. update
  7. update or create
  8. chunk and cursor method
  9. subqueryselect
  10. find or fail
  11. dat get and create
  12. aggregates
  13. isdirty , isclean waschanged
  14. laravel migration
php laravel developer anmol sharma

Anmol Sharma

I am a software engineer and have experience in web development technologies like php, Laravel, Codeigniter, javascript, jquery, bootstrap and I like to share my deep knowledge by these blogs.

Related tutorial links