is laravel eloquent's save() method doing query builder's job?
query builder:
db::table('flights') ->where('id', 1) ->update(['name' => 'new flight name']);
eloquent:
$flight = app\flight::find(1); $flight->name = 'new flight name'; $flight->save();
if that's true, same eloquent's create()
? watching laravel's official video tutorials, , see author uses eloquent's create()
, save()
inside controller. difference between query builder , eloquent? can use eloquent inside controller?
yes,
query builder
,eloquent methods
doing same job, however if use eloquent model in general able use eloquent relationship speed development process , make life easier. fact if deal huge data in databasequery builder
faster.the difference between
save
,create
save accepts full eloquent model instance while create accepts plain php array red docs.
Comments
Post a Comment