Working With Eloquent
Traer todos los datos.
$blog = Blog:all()
Crear nuevo record.
$blog = new Blog();
$blog->title = 'Esto es un nuevo titulo';
$blog->body = 'Esto es un nuevo body';
$blog->status = 1;
$blog->save();
dd($blog)
Update
$blog = Blog::find(2);
$blog->title = 'Esto es un nuevo titulo';
$blog->body = 'Esto es un nuevo body updated';
$blog->status = 1;
$blog->save();
dd($blog)
Get Data Where
$blog = Blog::where('status', '=', 1)->get();
dd($blog);
Get Data Where
$blog = Blog::where('status', 1)->get();
dd($blog);
Get Data Where
$blog = Blog::where(['status' => 0, 'id' => 1])->get();
dd($blog);
Delete Data
$blog = Blog::findOrFail(2);
$blog = delete();
dd($blog);
Listo!