开发者

The edit.blade in Laravel has a submit button for editing changes and updating, but it updated without any changes

开发者 https://www.devze.com 2022-12-07 19:55 出处:网络
Laravel\'s edit blade has an image tag to insert the image and updates the changes using a button in the form. There is a remove button in img tag that allows to remove and replace an image.

Laravel's edit blade has an image tag to insert the image and updates the changes using a button in the form. There is a remove button in img tag that allows to remove and replace an image. but the image is updated without any changes, and the uploaded image remains blank without any changes that occur on that particular page.

public function update(Request $request, $id)
    {
        //dd ($request[img_name]);
      开发者_开发知识库  $updateData = $request->validate([
            'img_name' => '',
            'name' => 'required|max:255',
            'url' => 'required|max:255',           
            'description' => '|max:255',
        ]);
        if(!isset ($updateData['img_name'])){
        $updateData['img_name']='../../img/links/blank_img_link-370x65-min.png';
        }
        Info_links::whereId($id)->update($updateData);
        return redirect('/account/info_links/index')->with('completed', 'Informative link has been updated');
        
    }

I expect it to submit using its submit button without any changes to the edit blade. 

0

精彩评论

暂无评论...
验证码 换一张
取 消