首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Facade\Ignition\Exceptions\ViewException尝试获取非对象的属性'price‘

Facade\Ignition\Exceptions\ViewException尝试获取非对象的属性'price‘
EN

Stack Overflow用户
提问于 2020-05-06 00:52:15
回答 1查看 21关注 0票数 0

‘这是我的控制器’‘我需要帮助,当我点击对象时,我想从phpmyadmin获取行数据,谢谢大家’

公共函数存储(请求$request){

代码语言:javascript
复制
    $this->middleware('auth');


    $tours = new tour();

    $tours->name=$request->input('name');
    $tours->date=$request->input('date');
    $tours->price=$request->input('price');
    $tours->hotel=$request->input('hotel');
    $tours->created_at=$request->input('created_at');
    $tours->service=$request->input('service');
    $tours->some=$request->input('some');


    if($request->hasFile('picture')){
        $file=$request->file('picture');
        $extension =$file->getClientOriginalName();
        $filename =time() .'.'.$extension;
        $file->move(public_path('images'),$filename);
        $tours->picture=$filename;

    }

    $tours->save();
    return redirect('admin/tour');       
}

“这是我的观点”

代码语言:javascript
复制
                    <div class="bc" style=" border-radius: 4px; width: 70%; height:45rem;">
                            <h4 style="text-align: center; position: relative; top:15px;">Tur Haqqında Məlumat</h4>
                            <strong style=" position: relative; top:15px;">Qiymət</strong>
                            <p style=" position: relative; top:15px;  width: 100%; font-weight: 400; font-family: 'Times New Roman', Times, serif;" name='price'>{{$tour->price}} AZN</p>
                            <hr/>
EN

回答 1

Stack Overflow用户

发布于 2020-05-06 01:28:42

您需要将$tours传递给您的视图:

代码语言:javascript
复制
return redirect('admin/tour', ['tour'=> $tours]);    

顺便说一句,我将使用$tour而不是您现在在控制器中使用的复数版本$tours

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61618524

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档