データベースからいくつかのデータを返す大規模なjsonで作業しています。関係のない整数モデルを返す必要があります。 LampModelsがこの素晴らしいjsonでモデル化するすべてのレコードを返します。しかし、Laravelはいつも私に不正なオフセットタイプを返す。Laravel returnモデルを返すときに不正なオフセット型が返される
コントローラ
public function showAllUdiJson()
{
$allLamps = LampModels::all();
return Ilumination::with('street')
->with('neighborhood')
->with('iluminationinfo')
->with('economyplan')
->with('lamp')
->with('reactor')
->with('aluminumcable')
->with('steelconduit')
->with('alllamps', $allLamps)
->with('ticket')->get();
}
LampModels
<?php
class LampModels extends \Eloquent {
protected $fillable = [];
protected $table = 'lampmodel';
}
イルミネーション
<?php
class Ilumination extends \Eloquent {
protected $fillable = [];
protected $table = 'ilumination';
public function street()
{
return $this->belongsTo('street');
}
public function neighborhood()
{
return $this->hasOne('neighborhood', 'id');
}
public function iluminationinfo()
{
return $this->hasOne('iluminationinfo');
}
public function ticket()
{
return $this->hasMany('ticket');
}
public function economyplan()
{
return $this->hasOne('economyplan', 'id' ,'street_id');
}
public function lamp()
{
return $this->hasOne('lamp', 'id');
}
public function reactor()
{
return $this->hasOne('reactor', 'id');
}
public function aluminumcable()
{
return $this->hasOne('aluminumcable', 'id');
}
public function steelconduit()
{
return $this->hasOne('steelconduit', 'id');
}
}
は、エラー・メッセージの全文/トレースを共有してください。 'LampModels'クラスと' Ilumination'クラスを見るのに役立つかもしれません。 –
@ThomasKelley done – gmanara