vendredi 11 mai 2018

Relationships in Laravel Models

How can I write this without a join for a scope in a Laravel model as the 'id' field becomes ambiguous

 /**
  * Return events that social category name
  */
public function scopeWithSocialEvents($query)
{
    return $query->join('categories', 'events.event_type_id', '=', 'categories.id')
                ->where('categories.name', 'social');
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2IaFfR6
via IFTTT

Aucun commentaire:

Enregistrer un commentaire