私が受け取っているエラーメッセージが分からないため、何が問題なのかよく分かりません。間違った関係で「belongsTo」関係を取得するときに問題が発生する
私は私の車のモデルで、次の関係を持つ
/**
* The dealer the vehicle belongs to (one-to-one relationship)
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function dealer()
{
return $this->belongsTo('App\Dealer');
}
/**
* The vehicle's specifications
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function specifications()
{
return $this->hasMany('App\Specification');
}
私は次のエラーを取得$依頼で「州」があります場合は、以下のメソッドを呼び出す場合は、次のApp \プロジェクト\の引数2がありませんがFrontend \ Repo \ Vehicle \ EloquentVehicle :: App \ Project \ Frontend \ Repo \ Vehicle {closure}()
リクエストに「市区町村」があるときにもエラーが表示されます。
エラーの意味はわかりませんが、スイッチの州のこのコード行を指しています。
$query = $query->whereHas('dealer', function($subQuery, $request, $value)
コールバックが 'with( 'specifications')'でなければなりません '(' specifications '、function(specifications){}) 'にもコールバックがありません。 'with( 'dealer')' – Beginner