Laravel morphedByMany Query Returns NULL - development

Laravel morphedByMany Query Returns NULL

I have this model

class Permission extends Model
{

      public function details(): MorphToMany
    {
        return $this->morphedByMany('AppModelsDetails', 'model', 'model_has_permissions', 'permission_id', 'model_id');

    }
}

class Details extends Model
{

   public function permission()
    {

    return $this->morphedByMany('AppModelsPermission','model','model_has_permissions','model_id','permission_id');
    }
}

I’m execute this query

Details::with('permission')->find(55);

and got empty array

why happen this?and what is the correct query?



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-morphedbymany-query-returns-null/
via Lzo Media

Comments

Popular posts from this blog

ng-show doesn’t work correct with value boolean

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development

ng-include of inline SVG does not display gradient except in Chrome