Home > Software engineering >  Trying to get property of non-object laravel plz
Trying to get property of non-object laravel plz

Time:07-17

@php $package_banner_data=DB::table('accm_sys_media')->where('media_type','=',5)->where(AccmId,'=',$result['accm_sys_detail']->AccmId)->get(); @endphp

error: ErrorException (E_ERROR) Trying to get property 'AccmId' of non-object

application is developed in laravel

please help

CodePudding user response:

The error surely comes from the line ...$result['accm_sys_detail']->AccmId ... You are trying to get the AccmId property of $result['accm_sys_detail'] object. Verify that the $result['accm_sys_detail'] is an object. You can use

var_dump($result['accm_sys_detail'])

to see if the variable stores an object type. Or use gettype() function to find out if the variable is carrying and object.

  • Related