【发布时间】:2020-08-20 10:21:20
【问题描述】:
'这是我的控制器''当我单击对象时我需要帮助我想从 phpmyadmin 获取行数据谢谢大家'
公共函数存储(请求 $request){
$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');
}
'这是我的看法'
<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/>
【问题讨论】:
-
你的问题很不清楚,试着描述一下你想要达到的目标,会发生什么?
-
错误在
{{ $tour->price }}。$tour对象必须为空。尝试dd($tour)并检查它是否为空。为了使变量在视图中起作用,您需要从控制器传递它们。在这种情况下,您需要将$tour传递给视图。