app/Http/Controllers/ViewController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
        if($request->session()->exists('resources')) {
            $resources = $request->session()->get('resources');
            $name = $request->input('name');
            $color = $request->input('color');
            $resource['id'] = $id;
            $resource['name'] = $name;
            $resource['color'] = $color;
            $resources[$id] = $resource;
            $request->session()->put('resources', $resources);
            return redirect('resource');
        } else {
            return back();
        }
    }
public function update ( Request $ request , $ id ) { if ( $ request -> session ( ) -> exists ( 'resources' ) ) { $ resources = $ request -> session ( ) -> get ( 'resources' ) ; $ name = $ request -> input ( 'name' ) ; $ color = $ request -> input ( 'color' ) ; $ resource [ 'id' ] = $ id ; $ resource [ 'name' ] = $ name ; $ resource [ 'color' ] = $ color ; $ resources [ $ id ] = $ resource ; $ request -> session ( ) -> put ( 'resources' , $ resources ) ; return redirect ( 'resource' ) ; } else { return back ( ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .