*/ protected $fillable = [ 'id', 'first_name', 'last_name', 'email', 'email_verified_at', 'password', 'programs_xid', 'country_xid', 'start_date', 'duration', 'phone_number', 'gender', 'date_of_birth', 'address_line1', 'city', 'country', 'state', 'post_code', 'lang_level', 'hear_about_us', 'motivation_to_join_program', 'any_comment', 'created_at', 'updated_at' ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; public function getPermissionGranted($id,$module){ // $id is used as authuser id // $moudle is the slug of sidebar module $isSubAdmin = manage_admin::where('id',$id)->where('is_admin',1)->first(); // 'is_admin',1 is for checking the login user is subadmin or not if($isSubAdmin){ //search for module $isModule = manage_module::where('slug',$module)->first(); if($isModule){ $isSubAdminModuleLink = manage_admin_manage_module_link::where('sub_admin_xid',$id) ->where('manage_modules_xid',$isModule->id)->first(); if($isSubAdminModuleLink){ return true; }else{ return false; } }else{ return false; } }else{ return false; } } }