I have this relationship:
public function OrdersMaterial()
{
return $this->belongsToMany('App\Material', 'Orders_has_Material',
'Orders_id', 'Material_id')->withPivot('quantity');
}
I want to get the materials that don't bellongs to order_has_materials in dates bellongs
$materials = Material:: whereDoesntHave('Orders_has_Material', function ($query) use ($userOrder) {
$query->where('date_final', $userOrder->date_final);
$query->where('date_begin', $userOrder->date_begin);})->get();
I'm getting Call to undefined method Illuminate\Database\Query\Builder::Orders_has_Material()
This is the best approach ?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DpGjgS
via IFTTT
Aucun commentaire:
Enregistrer un commentaire