mercredi 27 décembre 2017

issue in laravel relationship with multiple model

user has relation with creater one to one but creater has relation with archive belongsToMany

$creatorQuery = User::query();
    $cultivator_id = 2;
    $creatorQuery = $creatorQuery->select('id', 'name', 'email', 'role');

    $creatorQuery = $creatorQuery->with('creater', function($q) {
        $q->whereHas('archive', function($q) use($cultivator_id) {
            $query->where('caltivater_id', $cultivator_id);
        });
    });

    $creators = $creatorQuery->get();

showing error mb_strpos() expects parameter 1 to be string, object given



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

Aucun commentaire:

Enregistrer un commentaire