Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 710 Bytes

laravel.md

File metadata and controls

30 lines (22 loc) · 710 Bytes

Laravel

Content

How to query between two dates using Laravel and Eloquent

 YourModel::query()
    ->where('start', '<=', now()->toDateTimeString())
    ->where('end', '>=', now()->toDateTimeString())
    ->get();

read more stackoverflow

Update nested json

$affected = DB::table('users')
              ->where('id', 1)
              ->update(['options->enabled' => true]);

# note you can use the normal Laravel eloquent (ORM) and it works with updateOrCreate