app/Http/Controllers/ProductFilesController.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(auth()->user()->isAdmin()){
            $this->validate($request,[
                'prodfile_name'=>'required'
            ]);
            $product_file = ProductFile::find($id);
            if($product_file == null) abort(404);
            $product_file->name = $request->input('prodfile_name');
            $product_file->save();
            return redirect('products/'.$product_file->product_id);
        }
        else abort(404);
    }
public function update ( Request $ request , $ id ) { if ( auth ( ) -> user ( ) -> isAdmin ( ) ) { $ this -> validate ( $ request , [ 'prodfile_name' => 'required' ] ) ; $ product_file = ProductFile :: find ( $ id ) ; if ( $ product_file == null ) abort ( 404 ) ; $ product_file -> name = $ request -> input ( 'prodfile_name' ) ; $ product_file -> save ( ) ; return redirect ( 'products/' . $ product_file -> product_id ) ; } else abort ( 404 ) ; }
Update the specified resource in storage.
Update the specified resource in storage .