htmlspecialchars()期望参数1为字符串,在Laravel中给出的对象

时间:2019-09-24 03:28:53

标签: php laravel

update.blade.php


    <form action="{{url('admin/lessons/save')}}" method="post" class="form-horizontal form-simple" enctype="multipart/form-data">
        <input type="hidden" name="_token" value="{{csrf_token()}}">
        <input type="hidden" name="id" value="{{ isset($lesson) ? $lesson->id : 0 }}">
    <div class="card border-grey border-lighten-3 px-2 py-2 box-shadow-1">
        <h4 class="content-header-title">Video</h4>
        <input type="hidden" id="lesson_video" name="video">
        <input type="hidden" id="lesson_video_extension" name="video_extension">
        <div id="drag-drop-area"></div>
        <video  style="margin-top:15px;max-height:100px;" controls>
            <source src="{{ isset($lesson) ? url($lesson->video) : "" }}" type="video/mp4">
        </video>
    </div>

</form>

    <script>
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        var uppy = Uppy.Core()
            .use(Uppy.Dashboard, {
                inline: true,
                target: '#drag-drop-area',
                height: 170,
            })
            .use(Uppy.Tus, {
                endpoint: 'http://edu.quanly.io:3111/files/',
                // endpoint: 'http://localhost:3111/files/',
                chunkSize: 500000,
            })

          uppy.on('complete', (result) => {
            $("#lesson_video_extension").val(result.successful[0].type);
            $("#lesson_video").val(result.successful[0].uploadURL);
          })
    </script>

下面是选择要更新的对象的功能。与对象具有ID视频,它仍然可以正常运行。但是,当我选择对象具有ID时,视频为null。造成这样的错误:

  

htmlspecialchars()期望参数1为字符串,并指定给定对象(视图:C:\ Xampp-install \ htdocs \ eduwebsite \ resources \ views \ admin \ lessons \ update.blade.php)

具有选择要更新的对象的功能


    function update ( $lessonId )
        {
            $lesson = Lesson::getById($lessonId);
            $courses = Course::get();
            $teachers = Member::getTeachers();
            return view('admin.lessons.update', compact('lesson', 'courses', 'teachers'));
        }

0 个答案:

没有答案