D
D
D3lphi2017-01-19 15:07:56
Laravel
D3lphi, 2017-01-19 15:07:56

Why does laravel pull the entire table when using the find() method?

Actually, I don't understand why this is happening.
Code: Queries: As you can see, the entire news table is also selected from the database. What for? But when using the where() method... ...only what is needed is fetched: The question is, why is that? And what is the best way to use?
$news = News::find($id)->get()[0];
0b1b1f16aae94beaa3c7bdc718b3520a.PNG
$news = News::where('id', $id)->get()[0];
7452b7f41cab4893a52be622b2b02102.PNG

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Pochepko, 2017-01-19
@D3lphi

Because find is used without get

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question