mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Static analysis cleanup
This commit is contained in:
parent
330492654b
commit
a9027c1c33
@ -236,26 +236,26 @@ class BaseController extends Controller
|
||||
* @param string $includes The includes for the object
|
||||
* @return string The filtered array of includes
|
||||
*/
|
||||
private function filterIncludes(string $includes): string
|
||||
{
|
||||
$permissions_array = [
|
||||
'payments' => 'view_payment',
|
||||
'client' => 'view_client',
|
||||
'clients' => 'view_client',
|
||||
'vendor' => 'view_vendor',
|
||||
'vendors' => 'view_vendors',
|
||||
'expense' => 'view_expense',
|
||||
'expenses' => 'view_expense',
|
||||
];
|
||||
// private function filterIncludes(string $includes): string
|
||||
// {
|
||||
// $permissions_array = [
|
||||
// 'payments' => 'view_payment',
|
||||
// 'client' => 'view_client',
|
||||
// 'clients' => 'view_client',
|
||||
// 'vendor' => 'view_vendor',
|
||||
// 'vendors' => 'view_vendors',
|
||||
// 'expense' => 'view_expense',
|
||||
// 'expenses' => 'view_expense',
|
||||
// ];
|
||||
|
||||
$collection = collect(explode(",", $includes));
|
||||
// $collection = collect(explode(",", $includes));
|
||||
|
||||
$filtered_includes = $collection->filter(function ($include) use ($permissions_array) {
|
||||
return auth()->user()->hasPermission($permissions_array[$include]);
|
||||
});
|
||||
// $filtered_includes = $collection->filter(function ($include) use ($permissions_array) {
|
||||
// return auth()->user()->hasPermission($permissions_array[$include]);
|
||||
// });
|
||||
|
||||
return $filtered_includes->implode(",");
|
||||
}
|
||||
// return $filtered_includes->implode(",");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 404 for the client portal.
|
||||
@ -294,7 +294,7 @@ class BaseController extends Controller
|
||||
* Refresh API response with latest cahnges
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
* @return Response
|
||||
*/
|
||||
protected function refreshResponse($query)
|
||||
{
|
||||
@ -541,10 +541,12 @@ class BaseController extends Controller
|
||||
$resource = new Collection($query, $transformer, $this->entity_type);
|
||||
|
||||
$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());
|
||||
}
|
||||
|
||||
@ -566,7 +568,7 @@ class BaseController extends Controller
|
||||
* Mini Load Query
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
protected function miniLoadResponse($query)
|
||||
{
|
||||
@ -639,9 +641,10 @@ class BaseController extends Controller
|
||||
$query = $paginator->getCollection();
|
||||
$resource = new Collection($query, $transformer, $this->entity_type);
|
||||
$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());
|
||||
}
|
||||
@ -654,15 +657,15 @@ class BaseController extends Controller
|
||||
* @deprecated
|
||||
* @return 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 (auth()->user()->company_users()->count() > 1 && (auth()->user()->company_users()->where('is_admin', 1)->count() != auth()->user()->company_users()->count())) {
|
||||
return true;
|
||||
}
|
||||
// private function complexPermissionsUser(): bool
|
||||
// {
|
||||
// //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())) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
return false;
|
||||
}
|
||||
// return false;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Passes back the miniloaded data response
|
||||
@ -963,9 +966,10 @@ class BaseController extends Controller
|
||||
$query = $paginator->getCollection();
|
||||
$resource = new Collection($query, $transformer, $this->entity_type);
|
||||
$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());
|
||||
}
|
||||
@ -974,7 +978,7 @@ class BaseController extends Controller
|
||||
* Sorts the response by keys
|
||||
*
|
||||
* @param mixed $response
|
||||
* @return void
|
||||
* @return Response
|
||||
*/
|
||||
protected function response($response)
|
||||
{
|
||||
@ -1011,6 +1015,7 @@ class BaseController extends Controller
|
||||
* Item Response
|
||||
*
|
||||
* @param mixed $item
|
||||
* @return Response
|
||||
*/
|
||||
protected function itemResponse($item)
|
||||
{
|
||||
@ -1151,9 +1156,9 @@ class BaseController extends Controller
|
||||
/**
|
||||
* Sets the Flutter build to serve
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
private function setBuild()
|
||||
private function setBuild(): string
|
||||
{
|
||||
$build = '';
|
||||
|
||||
|
@ -62,7 +62,7 @@ use Laracasts\Presenter\PresentableTrait;
|
||||
* @property int|null $created_at
|
||||
* @property int|null $updated_at
|
||||
* @property int $enabled_item_tax_rates
|
||||
* @property int $is_large
|
||||
* @property bool $is_large
|
||||
* @property int $enable_shop_api
|
||||
* @property string $default_auto_bill
|
||||
* @property int $mark_expenses_invoiceable
|
||||
|
@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property-read \App\Models\CompanyUser|null $cu
|
||||
* @property-read mixed $hashed_id
|
||||
* @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|CompanyToken filter(\App\Filters\QueryFilters $filters)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyToken newModelQuery()
|
||||
@ -100,6 +99,9 @@ class CompanyToken extends BaseModel
|
||||
->where('user_id', $this->user_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Awobaz\Compoships\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function cu()
|
||||
{
|
||||
return $this->hasOne(CompanyUser::class, 'user_id', 'user_id')
|
||||
|
@ -11,8 +11,10 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
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
|
||||
@ -25,9 +27,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property object|null $notifications
|
||||
* @property object|null $settings
|
||||
* @property string $slack_webhook_url
|
||||
* @property int $is_owner
|
||||
* @property int $is_admin
|
||||
* @property int $is_locked
|
||||
* @property bool $is_owner
|
||||
* @property bool $is_admin
|
||||
* @property bool $is_locked
|
||||
* @property int|null $deleted_at
|
||||
* @property int|null $created_at
|
||||
* @property int|null $updated_at
|
||||
@ -36,6 +38,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property string|null $react_settings
|
||||
* @property-read \App\Models\Account $account
|
||||
* @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 int|null $token_count
|
||||
* @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> $tokens
|
||||
* @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> $tokens
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\User> $users
|
||||
@ -110,14 +114,11 @@ class CompanyUser extends Pivot
|
||||
use SoftDeletes;
|
||||
use \Awobaz\Compoships\Compoships;
|
||||
|
||||
// protected $guarded = ['id'];
|
||||
|
||||
protected $dateFormat = 'Y-m-d H:i:s.u';
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'permissions_updated_at' => 'timestamp',
|
||||
@ -151,11 +152,6 @@ class CompanyUser extends Pivot
|
||||
return self::class;
|
||||
}
|
||||
|
||||
// public function tax_rates()
|
||||
// {
|
||||
// return $this->hasMany(TaxRate::class, 'company_id', 'company_id');
|
||||
// }
|
||||
|
||||
public function account()
|
||||
{
|
||||
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');
|
||||
}
|
||||
|
||||
public function user()
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class)->withTrashed();
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ use Laracasts\Presenter\PresentableTrait;
|
||||
* @property string|null $sms_verification_code
|
||||
* @property int $verified_phone_number
|
||||
* @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 int|null $clients_count
|
||||
* @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\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
|
||||
* @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
|
||||
* @method bool hasPermissionTo(string $permission)
|
||||
* @method \Illuminate\Database\Eloquent\Builder|Company getCompany()
|
||||
* @method bool hasExcludedPermissions(array $matched_permission, array $excluded_permissions)
|
||||
* @method bool isAdmin()
|
||||
* @method bool isSuperUser()
|
||||
* @method bool hasIntersectPermissions(array $permissions)
|
||||
* @method int companyId()
|
||||
* @method bool isOwner()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class User extends Authenticatable implements MustVerifyEmail
|
||||
@ -254,7 +186,6 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'first_name',
|
||||
@ -278,7 +209,6 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'remember_token',
|
||||
@ -373,7 +303,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
/**
|
||||
* Returns the currently set Company.
|
||||
*/
|
||||
public function getCompany()
|
||||
public function getCompany(): ?Company
|
||||
{
|
||||
$truth = app()->make(TruthSource::class);
|
||||
|
||||
@ -389,31 +319,27 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
throw new \Exception('No Company Found');
|
||||
}
|
||||
|
||||
public function companyIsSet()
|
||||
public function companyIsSet(): bool
|
||||
{
|
||||
if ($this->company) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return isset($this->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();
|
||||
}
|
||||
|
||||
private function setCompanyByGuard()
|
||||
{
|
||||
if (Auth::guard('contact')->check()) {
|
||||
$this->setCompany(auth()->user()->client->company);
|
||||
}
|
||||
}
|
||||
// private function setCompanyByGuard()
|
||||
// {
|
||||
// if (Auth::guard('contact')->check()) {
|
||||
// $this->setCompany(auth()->user()->client->company);
|
||||
// }
|
||||
// }
|
||||
|
||||
public function company_users()
|
||||
{
|
||||
@ -467,19 +393,18 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
/**
|
||||
* Returns a comma separated list of user permissions.
|
||||
*
|
||||
* @return comma separated list
|
||||
* @return string $permissions
|
||||
*/
|
||||
public function permissions()
|
||||
{
|
||||
return $this->token()->cu->permissions;
|
||||
|
||||
// return $this->company_user->permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a object of User Settings.
|
||||
*
|
||||
* @return stdClass
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function settings()
|
||||
{
|
||||
@ -530,7 +455,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
/**
|
||||
* Returns a boolean value if the user owns the current Entity.
|
||||
*
|
||||
* @param string Entity
|
||||
* @param mixed $entity
|
||||
* @return 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.
|
||||
*
|
||||
* @param string Entity
|
||||
* @param mixed $entity
|
||||
* @return bool
|
||||
*/
|
||||
public function assigned($entity) : bool
|
||||
@ -552,7 +477,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
/**
|
||||
* Returns true if permissions exist in the map.
|
||||
*
|
||||
* @param string permission
|
||||
* @param string $permission
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPermission($permission) : bool
|
||||
|
Loading…
Reference in New Issue
Block a user