Static analysis cleanup

This commit is contained in:
David Bomba 2023-04-26 23:03:32 +10:00
parent 330492654b
commit a9027c1c33
5 changed files with 80 additions and 152 deletions

View File

@ -236,26 +236,26 @@ class BaseController extends Controller
* @param string $includes The includes for the object * @param string $includes The includes for the object
* @return string The filtered array of includes * @return string The filtered array of includes
*/ */
private function filterIncludes(string $includes): string // private function filterIncludes(string $includes): string
{ // {
$permissions_array = [ // $permissions_array = [
'payments' => 'view_payment', // 'payments' => 'view_payment',
'client' => 'view_client', // 'client' => 'view_client',
'clients' => 'view_client', // 'clients' => 'view_client',
'vendor' => 'view_vendor', // 'vendor' => 'view_vendor',
'vendors' => 'view_vendors', // 'vendors' => 'view_vendors',
'expense' => 'view_expense', // 'expense' => 'view_expense',
'expenses' => 'view_expense', // 'expenses' => 'view_expense',
]; // ];
$collection = collect(explode(",", $includes)); // $collection = collect(explode(",", $includes));
$filtered_includes = $collection->filter(function ($include) use ($permissions_array) { // $filtered_includes = $collection->filter(function ($include) use ($permissions_array) {
return auth()->user()->hasPermission($permissions_array[$include]); // return auth()->user()->hasPermission($permissions_array[$include]);
}); // });
return $filtered_includes->implode(","); // return $filtered_includes->implode(",");
} // }
/** /**
* 404 for the client portal. * 404 for the client portal.
@ -294,7 +294,7 @@ class BaseController extends Controller
* Refresh API response with latest cahnges * Refresh API response with latest cahnges
* *
* @param Builder $query * @param Builder $query
* @return Builder * @return Response
*/ */
protected function refreshResponse($query) protected function refreshResponse($query)
{ {
@ -541,9 +541,11 @@ class BaseController extends Controller
$resource = new Collection($query, $transformer, $this->entity_type); $resource = new Collection($query, $transformer, $this->entity_type);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator)); $resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
} else {
$resource = new Collection($query, $transformer, $this->entity_type);
} }
// else {
// $resource = new Collection($query, $transformer, $this->entity_type);
// }
return $this->response($this->manager->createData($resource)->toArray()); return $this->response($this->manager->createData($resource)->toArray());
} }
@ -565,8 +567,8 @@ class BaseController extends Controller
/** /**
* Mini Load Query * Mini Load Query
* *
* @param Builder $query * @param Builder $query
* @return void *
*/ */
protected function miniLoadResponse($query) protected function miniLoadResponse($query)
{ {
@ -639,9 +641,10 @@ class BaseController extends Controller
$query = $paginator->getCollection(); $query = $paginator->getCollection();
$resource = new Collection($query, $transformer, $this->entity_type); $resource = new Collection($query, $transformer, $this->entity_type);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator)); $resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
} else {
$resource = new Collection($query, $transformer, $this->entity_type);
} }
// else {
// $resource = new Collection($query, $transformer, $this->entity_type);
// }
return $this->response($this->manager->createData($resource)->toArray()); return $this->response($this->manager->createData($resource)->toArray());
} }
@ -654,15 +657,15 @@ class BaseController extends Controller
* @deprecated * @deprecated
* @return bool * @return bool
*/ */
private function complexPermissionsUser(): bool // private function complexPermissionsUser(): bool
{ // {
//if the user is attached to more than one company AND they are not an admin across all companies // //if the user is attached to more than one company AND they are not an admin across all companies
if (auth()->user()->company_users()->count() > 1 && (auth()->user()->company_users()->where('is_admin', 1)->count() != auth()->user()->company_users()->count())) { // if (auth()->user()->company_users()->count() > 1 && (auth()->user()->company_users()->where('is_admin', 1)->count() != auth()->user()->company_users()->count())) {
return true; // return true;
} // }
return false; // return false;
} // }
/** /**
* Passes back the miniloaded data response * Passes back the miniloaded data response
@ -963,9 +966,10 @@ class BaseController extends Controller
$query = $paginator->getCollection(); $query = $paginator->getCollection();
$resource = new Collection($query, $transformer, $this->entity_type); $resource = new Collection($query, $transformer, $this->entity_type);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator)); $resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
} else {
$resource = new Collection($query, $transformer, $this->entity_type);
} }
// else {
// $resource = new Collection($query, $transformer, $this->entity_type);
// }
return $this->response($this->manager->createData($resource)->toArray()); return $this->response($this->manager->createData($resource)->toArray());
} }
@ -974,7 +978,7 @@ class BaseController extends Controller
* Sorts the response by keys * Sorts the response by keys
* *
* @param mixed $response * @param mixed $response
* @return void * @return Response
*/ */
protected function response($response) protected function response($response)
{ {
@ -1011,6 +1015,7 @@ class BaseController extends Controller
* Item Response * Item Response
* *
* @param mixed $item * @param mixed $item
* @return Response
*/ */
protected function itemResponse($item) protected function itemResponse($item)
{ {
@ -1151,9 +1156,9 @@ class BaseController extends Controller
/** /**
* Sets the Flutter build to serve * Sets the Flutter build to serve
* *
* @return void * @return string
*/ */
private function setBuild() private function setBuild(): string
{ {
$build = ''; $build = '';

View File

@ -62,7 +62,7 @@ use Laracasts\Presenter\PresentableTrait;
* @property int|null $created_at * @property int|null $created_at
* @property int|null $updated_at * @property int|null $updated_at
* @property int $enabled_item_tax_rates * @property int $enabled_item_tax_rates
* @property int $is_large * @property bool $is_large
* @property int $enable_shop_api * @property int $enable_shop_api
* @property string $default_auto_bill * @property string $default_auto_bill
* @property int $mark_expenses_invoiceable * @property int $mark_expenses_invoiceable

View File

@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property-read \App\Models\CompanyUser|null $cu * @property-read \App\Models\CompanyUser|null $cu
* @property-read mixed $hashed_id * @property-read mixed $hashed_id
* @property-read \App\Models\User $user * @property-read \App\Models\User $user
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns) * @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
* @method static \Illuminate\Database\Eloquent\Builder|CompanyToken filter(\App\Filters\QueryFilters $filters) * @method static \Illuminate\Database\Eloquent\Builder|CompanyToken filter(\App\Filters\QueryFilters $filters)
* @method static \Illuminate\Database\Eloquent\Builder|CompanyToken newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|CompanyToken newModelQuery()
@ -100,6 +99,9 @@ class CompanyToken extends BaseModel
->where('user_id', $this->user_id); ->where('user_id', $this->user_id);
} }
/**
* @return \Awobaz\Compoships\Database\Eloquent\Relations\HasOne
*/
public function cu() public function cu()
{ {
return $this->hasOne(CompanyUser::class, 'user_id', 'user_id') return $this->hasOne(CompanyUser::class, 'user_id', 'user_id')

View File

@ -11,8 +11,10 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/** /**
* App\Models\CompanyUser * App\Models\CompanyUser
@ -25,9 +27,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property object|null $notifications * @property object|null $notifications
* @property object|null $settings * @property object|null $settings
* @property string $slack_webhook_url * @property string $slack_webhook_url
* @property int $is_owner * @property bool $is_owner
* @property int $is_admin * @property bool $is_admin
* @property int $is_locked * @property bool $is_locked
* @property int|null $deleted_at * @property int|null $deleted_at
* @property int|null $created_at * @property int|null $created_at
* @property int|null $updated_at * @property int|null $updated_at
@ -36,6 +38,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property string|null $react_settings * @property string|null $react_settings
* @property-read \App\Models\Account $account * @property-read \App\Models\Account $account
* @property-read \App\Models\Company $company * @property-read \App\Models\Company $company
* @property-read \App\Models\CompanyUser $cu
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $token * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $token
* @property-read int|null $token_count * @property-read int|null $token_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
@ -73,6 +76,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $token * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $token
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\User> $users * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\User> $users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $cu
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $token * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $token
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\User> $users * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\User> $users
@ -110,14 +114,11 @@ class CompanyUser extends Pivot
use SoftDeletes; use SoftDeletes;
use \Awobaz\Compoships\Compoships; use \Awobaz\Compoships\Compoships;
// protected $guarded = ['id'];
protected $dateFormat = 'Y-m-d H:i:s.u'; protected $dateFormat = 'Y-m-d H:i:s.u';
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
* *
* @var array
*/ */
protected $casts = [ protected $casts = [
'permissions_updated_at' => 'timestamp', 'permissions_updated_at' => 'timestamp',
@ -151,11 +152,6 @@ class CompanyUser extends Pivot
return self::class; return self::class;
} }
// public function tax_rates()
// {
// return $this->hasMany(TaxRate::class, 'company_id', 'company_id');
// }
public function account() public function account()
{ {
return $this->belongsTo(Account::class); return $this->belongsTo(Account::class);
@ -171,7 +167,7 @@ class CompanyUser extends Pivot
return $this->hasOne(Company::class)->withPivot('permissions', 'settings', 'react_settings', 'is_admin', 'is_owner', 'is_locked', 'slack_webhook_url', 'migrating'); return $this->hasOne(Company::class)->withPivot('permissions', 'settings', 'react_settings', 'is_admin', 'is_owner', 'is_locked', 'slack_webhook_url', 'migrating');
} }
public function user() public function user(): BelongsTo
{ {
return $this->belongsTo(User::class)->withTrashed(); return $this->belongsTo(User::class)->withTrashed();
} }

View File

@ -76,6 +76,7 @@ use Laracasts\Presenter\PresentableTrait;
* @property string|null $sms_verification_code * @property string|null $sms_verification_code
* @property int $verified_phone_number * @property int $verified_phone_number
* @property-read \App\Models\Account $account * @property-read \App\Models\Account $account
* @property-read \App\Models\Company $company
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read int|null $clients_count * @property-read int|null $clients_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
@ -146,83 +147,14 @@ use Laracasts\Presenter\PresentableTrait;
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications * @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients * @method bool hasPermissionTo(string $permission)
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies * @method \Illuminate\Database\Eloquent\Builder|Company getCompany()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users * @method bool hasExcludedPermissions(array $matched_permission, array $excluded_permissions)
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts * @method bool isAdmin()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents * @method bool isSuperUser()
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications * @method bool hasIntersectPermissions(array $permissions)
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens * @method int companyId()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients * @method bool isOwner()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @mixin \Eloquent * @mixin \Eloquent
*/ */
class User extends Authenticatable implements MustVerifyEmail class User extends Authenticatable implements MustVerifyEmail
@ -254,7 +186,6 @@ class User extends Authenticatable implements MustVerifyEmail
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.
* *
* @var array
*/ */
protected $fillable = [ protected $fillable = [
'first_name', 'first_name',
@ -278,7 +209,6 @@ class User extends Authenticatable implements MustVerifyEmail
/** /**
* The attributes that should be hidden for arrays. * The attributes that should be hidden for arrays.
* *
* @var array
*/ */
protected $hidden = [ protected $hidden = [
'remember_token', 'remember_token',
@ -373,7 +303,7 @@ class User extends Authenticatable implements MustVerifyEmail
/** /**
* Returns the currently set Company. * Returns the currently set Company.
*/ */
public function getCompany() public function getCompany(): ?Company
{ {
$truth = app()->make(TruthSource::class); $truth = app()->make(TruthSource::class);
@ -389,31 +319,27 @@ class User extends Authenticatable implements MustVerifyEmail
throw new \Exception('No Company Found'); throw new \Exception('No Company Found');
} }
public function companyIsSet() public function companyIsSet(): bool
{ {
if ($this->company) { return isset($this->company);
return true;
}
return false;
} }
/** /**
* Returns the current company. * Returns the current company.
* *
* @return App\Models\Company $company * @return \App\Models\Company $company
*/ */
public function company() public function company(): Company
{ {
return $this->getCompany(); return $this->getCompany();
} }
private function setCompanyByGuard() // private function setCompanyByGuard()
{ // {
if (Auth::guard('contact')->check()) { // if (Auth::guard('contact')->check()) {
$this->setCompany(auth()->user()->client->company); // $this->setCompany(auth()->user()->client->company);
} // }
} // }
public function company_users() public function company_users()
{ {
@ -467,19 +393,18 @@ class User extends Authenticatable implements MustVerifyEmail
/** /**
* Returns a comma separated list of user permissions. * Returns a comma separated list of user permissions.
* *
* @return comma separated list * @return string $permissions
*/ */
public function permissions() public function permissions()
{ {
return $this->token()->cu->permissions; return $this->token()->cu->permissions;
// return $this->company_user->permissions;
} }
/** /**
* Returns a object of User Settings. * Returns a object of User Settings.
* *
* @return stdClass * @return \stdClass
*/ */
public function settings() public function settings()
{ {
@ -530,7 +455,7 @@ class User extends Authenticatable implements MustVerifyEmail
/** /**
* Returns a boolean value if the user owns the current Entity. * Returns a boolean value if the user owns the current Entity.
* *
* @param string Entity * @param mixed $entity
* @return bool * @return bool
*/ */
public function owns($entity) : bool public function owns($entity) : bool
@ -541,7 +466,7 @@ class User extends Authenticatable implements MustVerifyEmail
/** /**
* Returns a boolean value if the user is assigned to the current Entity. * Returns a boolean value if the user is assigned to the current Entity.
* *
* @param string Entity * @param mixed $entity
* @return bool * @return bool
*/ */
public function assigned($entity) : bool public function assigned($entity) : bool
@ -552,7 +477,7 @@ class User extends Authenticatable implements MustVerifyEmail
/** /**
* Returns true if permissions exist in the map. * Returns true if permissions exist in the map.
* *
* @param string permission * @param string $permission
* @return bool * @return bool
*/ */
public function hasPermission($permission) : bool public function hasPermission($permission) : bool