app/Http/Controllers/BranchesController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \PurchaseControl\branches  $branches
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(BranchRequest $request, $id)
    {
        $branch = Branches::where('id', $id)->first();
        $branch->fill($request->all());
        if(!$branch->save())
        {
            return redirect()->back()->withInput()->withErrors();
        }
        return redirect()->route('branches.edit', [
            'branch' => $branch->id
        ])->with([
            'color'=>'alert-success',
            'message' => 'Centro de Custo Atualizado com sucesso!'
        ]);
    }
public function update ( BranchRequest $ request , $ id ) { $ branch = Branches :: where ( 'id' , $ id ) -> first ( ) ; $ branch -> fill ( $ request -> all ( ) ) ; if ( ! $ branch -> save ( ) ) { return redirect ( ) -> back ( ) -> withInput ( ) -> withErrors ( ) ; } return redirect ( ) -> route ( 'branches.edit' , [ 'branch' => $ branch -> id ] ) -> with ( [ 'color' => 'alert-success' , 'message' => 'Centro de Custo Atualizado com sucesso!' ] ) ; }
Update the specified resource in storage.
Update the specified resource in storage .