db table update laravel code example
Example 1: update column value laravel
Page::where('id', $id)->update(array('image' => 'asdasd'));
Example 2: laravel update from query
$affected = DB::table('users')
->where('id', 1)
->update(['votes' => 1]);
Example 3: laravel wher in
$users = DB::table('users')
->whereIn('id', [1, 2, 3])
->get();
Example 4: laravel db::query update
DB::table('user')->where('email', $userEmail)->update(array('member_type' => $plan));
Example 5: update column value laravel
$page = Page::find($id);
if($page) {
$page->image = 'imagepath';
$page->save();
}
Example 6: DB::table('users')->get();
DB::select('SELECT * FROM users WHERE name = "'.Input::get('name').'"');