app/Http/Controllers/AdminHistoryController.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)
    {
        $input = $request->all();
        if($file = $request->file('photo_id')){
            $name = time() . str_replace(' ', '', $file->getClientOriginalName());
            $file->move('images', $name);
            $photo = Photo::create(['file'=>$name]);
            $input['photo_id'] = $photo->id;
        }
        $input['shorttitle'] = Str::slug($input['title'],'_');
        History::whereId($id)->first()->update($input);
        return redirect('/admin/histories');
    }
public function update ( Request $ request , $ id ) { $ input = $ request -> all ( ) ; if ( $ file = $ request -> file ( 'photo_id' ) ) { $ name = time ( ) . str_replace ( ' ' , '' , $ file -> getClientOriginalName ( ) ) ; $ file -> move ( 'images' , $ name ) ; $ photo = Photo :: create ( [ 'file' => $ name ] ) ; $ input [ 'photo_id' ] = $ photo -> id ; } $ input [ 'shorttitle' ] = Str :: slug ( $ input [ 'title' ] , '_' ) ; History :: whereId ( $ id ) -> first ( ) -> update ( $ input ) ; return redirect ( '/admin/histories' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
//