app/Http/Controllers/MemberController.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)
    {
        $member = Member::find($id);
        $this->validate($request,[
            'name' => 'required|max:50',
            'position' => 'required|max:50',
            'description' => 'required' 
        ]);
        if($request->hasFile('photo'))
        {
            $featured = $request ->photo;
            $image_new_name = time().$featured->getClientOriginalName();
            $featured->move('admin/uploads/images/',$image_new_name);
            $member->photo = 'admin/uploads/images/'.$image_new_name;
        }
        $member->name = $request->name;
        $member->position = $request->position;
        $member->facebook = $request->facebook;
        $member->linkedin = $request->linkedin;
        $member->twitter = $request->twitter;
        $member->description = $request->description;
        $member->user_id = $request->user_id;
        $member->save();
        return redirect()->route('member.index');
    }
public function update ( Request $ request , $ id ) { $ member = Member :: find ( $ id ) ; $ this -> validate ( $ request , [ 'name' => 'required|max:50' , 'position' => 'required|max:50' , 'description' => 'required' ] ) ; if ( $ request -> hasFile ( 'photo' ) ) { $ featured = $ request -> photo ; $ image_new_name = time ( ) . $ featured -> getClientOriginalName ( ) ; $ featured -> move ( 'admin/uploads/images/' , $ image_new_name ) ; $ member -> photo = 'admin/uploads/images/' . $ image_new_name ; } $ member -> name = $ request -> name ; $ member -> position = $ request -> position ; $ member -> facebook = $ request -> facebook ; $ member -> linkedin = $ request -> linkedin ; $ member -> twitter = $ request -> twitter ; $ member -> description = $ request -> description ; $ member -> user_id = $ request -> user_id ; $ member -> save ( ) ; return redirect ( ) -> route ( 'member.index' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .