我在尝试查看我的展示页面时遇到错误。我正在创建一个包含属性的监视列表。
我得到的错误是
SQLSTATE [42S22]:未找到列:1054未知列' watched_properties.watchlists_id'在' where子句' (SQL:select {from
<form [formGroup]="invoiceForm"> <label>Package Title: </label> <input formControlName="Package_Title"/> <hr> <div formArrayName="HotelData"> <div *ngFor="let hotel of invoiceForm.controls.HotelData.controls; let i = index" [formGroupName]="i" > <fieldset> <label>Hotel Title </label> <input formControlName="Htitle" /> <button (click)="addRoom(hotel.controls.RoomData)">Add Room</button> <div formArrayName="RoomData"> <div *ngFor="let room of hotel.controls.RoomData.controls; let j = index" [formGroupName]="j"> <fieldset> <label>Room Type</label> <select> <option *ngFor="let a of list">{{a}}</option> </select> <input formControlName="Hotel_Room_Type"> </fieldset> </div> </div> </fieldset> </div> </div> </form>
其中watched_properties
。watched_properties
= 1和watchlists_id
。watched_properties
不为空)(查看:C:\ Users \ resources \视图\页面\帐户\关注列表\ show.blade.php)
模型
监视列表
watchlists_id
观看属性
class Watchlists extends Model
{
protected $fillable = ["title", "user_id", "active"];
public function properties(){
return $this->hasMany('App\WatchedProperties');
}
public function user(){
return $this->belongsTo('App\User');
}
}
控制器 的 WatchlistController
class WatchedProperties extends Model
{
protected $fillable = ["image_url", "image_info", "project_id"];
public function watchlist(){
return $this->belongsTo('App\Watchlist');
}
}
WatchedPropertiesController
use App\Watchlists;
class WatchlistController extends Controller
{
public function show($id){
$Watchlists = Watchlists::where('id', $id)->first();
return view('pages/account/watchlist/show', compact('Watchlists'));
}
}
浏览 显示页面
这是我收到错误的页面
use App\WatchedProperties;
use App\Watchlists;
class WatchedPropertiesController extends Controller
{
public function create(Request $request, $image_info){
$Watchlist = Watchlists::where('user_id', Auth::id())->where('active', 1)->first();
if($Watchlist == null){
return redirect('watchlist/create');
} else {
$saveData = [
"image_info" => $image_info,
"image_url" => $request->image_url,
"project_id" => $project->id
];
$inspiration = WatchedProperties::create($saveData);
return back();
}
}}