Answers for "laravel merge 2 relationships"

PHP
0

laravel eloquent join two models

Event::whereHas('participants', function ($query) {
    return $query->where('IDUser', '=', 1);
})->get();
Posted by: Guest on September-12-2021
0

laravel model relationships with two columns match

Compoships adds support for multi-columns relationships in Laravel 5's Eloquent.

https://github.com/topclaudy/compoships

It allows you to specify relationships using the following syntax:

public function b()
{
    return $this->hasMany('B', ['key1', 'key2'], ['key1', 'key2']);
}
where both columns have to match.
Posted by: Guest on December-30-2021

Browse Popular Code Answers by Language