1

I want to use Query Builder because my project have many tables in the database, is it necessary to use Model if I use Query Builder?

Base in the article below, the Query Builder is much faster in processing in large scale of project.

Query Builder VS Eloquent ORM

2 Answers2

2

You won't have to use Model if you're using Query Builder.

Let's say you have a table named 'users' in your database. Just use it as below:

$users = DB::table('users')->select('loginname');
kurapika
  • 166
  • 1
  • 12
1

As mention by @kurapika, When using Query Builder, you do not need to use the Model. For example, with Model

$users = Users::get(['first_name']);

And using the query builder

$users = DB::table('users')->get(['first_name']);

There is no best choice. It depends solely on your need.

Olaitan Adeboye
  • 172
  • 4
  • 21