public function update(Request $request)
    {
        $items = json_decode($request->get('list'), true);

        foreach ($items as $key => $item) {
            Banner::find($item['id'])->update(['list_order' => ($key + 1)]);
        }

        return ['result' => 'success'];
    }
public function update(Request $request)
    {
        $items = json_decode($request->get('list'), true);

        foreach ($items as $key => $item) {
            Banner::find($item['id'])->update(['list_order' => ($key + 1)]);
        }

        return ['result' => 'success'];
    }
public function update ( Request $ request ) { $ items = json_decode ( $ request -> get ( 'list' ) , true ) ; foreach ( $ items as $ key => $ item ) { Banner :: find ( $ item [ 'id' ] ) -> update ( [ 'list_order' => ( $ key + 1 ) ] ) ; } return [ 'result' => 'success' ] ; }
Update the order
@param Request $request
@return array
Update the order