app/Http/Controllers/Admin/StoreController.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(StoreRequest $request, $id)
    {
        $store =Store::find($id);
        $dados = $request->all();
        if($request->hasFile('logo'))
        {
            if(Storage::disk('public')->exists($store->logo))
            {
                Storage::disk('public')->delete($store->logo);
            }
          $dados['logo'] = $this->uploadImages($request->logo);
        }
        $store->update($dados);
        flash('Dados atualizados com secesso!')->success();
        return redirect()->route('admin.stores.index');
    }
public function update ( StoreRequest $ request , $ id ) { $ store = Store :: find ( $ id ) ; $ dados = $ request -> all ( ) ; if ( $ request -> hasFile ( 'logo' ) ) { if ( Storage :: disk ( 'public' ) -> exists ( $ store -> logo ) ) { Storage :: disk ( 'public' ) -> delete ( $ store -> logo ) ; } $ dados [ 'logo' ] = $ this -> uploadImages ( $ request -> logo ) ; } $ store -> update ( $ dados ) ; flash ( 'Dados atualizados com secesso!' ) -> success ( ) ; return redirect ( ) -> route ( 'admin.stores.index' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .