Php 将价值过帐到数据库laravel

Php 将价值过帐到数据库laravel,php,laravel,model,controller,Php,Laravel,Model,Controller,我正在尝试向缩略图添加说明,但它不会在数据库中更新 你们知道为什么吗 唯一的thumb\u说明不会更新 填充物已填充。当我执行$content->save()时,它将返回true 控制器: public function detail(Request $request, $id) { $content = Content_blocks::find($id); if ($request->isMethod('post')) {

我正在尝试向缩略图添加说明,但它不会在数据库中更新

你们知道为什么吗

唯一的
thumb\u说明
不会更新

填充物已填充。当我执行
$content->save()
时,它将返回true

控制器:

public function detail(Request $request, $id)
    {
        $content = Content_blocks::find($id);

        if ($request->isMethod('post')) {
            if ($request->hasFile('image')) {
                $folder = 'uploads';
                $name = $request->image->getClientOriginalName();
                $store = $request->image->store($folder, 'public');
                $file = pathinfo(Storage::url($store));
                $thumb_description = $request->input('thumb_description');

                $thumbnail = new Thumbnail();
                $thumbnail->name = $file['filename'];
                $thumbnail->extenstion = $file['extension'];
                $thumbnail->path = $folder;
                $thumbnail->thumb_description = $thumb_description;
                $thumbnail->save();
                $content->thumbnail_id = $thumbnail->id;

            }

            $content->title = $request->input('title');
            $content->description = $request->input('description');
            $content->link = $request->input('link');
            $content->linkname = $request->input('linkname');
            $content->order = $request->input('order');
            $content->contentcategory_id = $request->input('categorie');
            $content->thumbnail->thumb_description = $request->input('thumb_description');


            if ($request->input('ontkoppel') === 'deletion') {
                Thumbnail::find($content->thumbnail_id)->delete();
            }

            // dd($content->thumbnail->thumb_description);
            $content->save();


            return redirect('admin/content/webcategorie/homepage/contentblocks/' . $content->content_id);
        }
型号

<?php

namespace App\Models;

use Illuminate\Support\Facades\Storage;

class Thumbnail extends Model
{

    protected $fillable = [
        "thumb_description",
        "name",
        "path",
        "extenstion"
    ];
    protected $table = 'thumbnail';

    public function content()
    {
        return $this->belongsTo(Content::class);
    }

    public static function getFile($id)
    {
        $thumbnail = self::find($id);

        if ($thumbnail === null) {
            return null;
        }

        $url = sprintf('%s/%s.%s', $thumbnail->path, $thumbnail->name, $thumbnail->extenstion);

        return Storage::disk('public')->url($url);
    }
    public static function getDescription($id)
    {
        $thumbnail = self::find($id);

        if ($thumbnail === null) {
            return null;
        }

        $description = $thumbnail->thumb_description;

        return $description;
    }
}
在chrome开发工具中发布

------WebKitFormBoundaryfun4SMk5TA604OZE
内容配置:表单数据;name=“thumb\u说明”

bruyanga

$content->save()
将只保存
$content
上的属性,而不保存其关系

尝试
$content->push()
$content->save()
将只保存
$content
上的属性,而不保存其关系

尝试
$content->push()

只有拇指描述不会更新?它是仅更新还是同时更新和添加/插入?帖子中是否设置了“拇指描述”?仔细检查(您可以在Chrome中使用Inspect>Network tab)dd($request->input('thumb_description');以确保描述与requestOnly thumb_描述实际可用。thumb_描述不会更新?它是仅更新还是同时更新和添加/插入?帖子中是否设置了“thumb_描述”?仔细检查(您可以使用Chrome中的Inspect>Network选项卡)dd($request->input('thumb_description');确保完成任务的请求人可以使用该描述!谢谢!完成任务的请求人!谢谢!
------WebKitFormBoundaryfun4SMk5TA604OZE