+1 vote
in Laravel by
What is Eloquent in Laravel?

1 Answer

0 votes
by

Eloquent is the ORM used to interact with the database using Model classes. It gives handy methods on class objects to make a query on the database.

It can directly be used to retrieve data from any table and run any raw query. But in conjunction with Models, we can make use of its various methods and also make use of relationships and attributes defined on the model.

Some examples of using the Eloquent are below:

  1. `DB::table(‘users’)->get()`
  2. `User::all()`
  3. `User::where(‘name’, ‘=’, ‘Eloquent’)->get()`

Related questions

0 votes
0 votes
asked Oct 28, 2023 in Laravel by Robindeniel
0 votes
0 votes
0 votes
0 votes
asked Oct 26, 2023 in Laravel by rajeshsharma
...