public function modelAccountSortOrder(Request $request) { $i = 1; foreach ($request->get('order') as $id) { $item = ModelAccount::find($id); $item->sort_order = $i; $item->save(); $i++; } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $currentUser = Auth::user(); $modelAccount = ModelAccount::where('social_media_account_id', 3)->where('api_cursor', '!=', 0)->where('sort_order', 1)->get()->first(); echo (int) $modelAccount->api_cursor; if ((int) $modelAccount->api_cursor === 2147483647) { echo 'true'; } // return view('settings.index', compact('currentUser')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, $model_account_id) { $data = ModelAccount::where('id', $model_account_id)->where('social_media_account_id', $id); $data->take(1)->delete(); return redirect("set-user/{$id}"); }