You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

43 lines
865 B

<?php
namespace App\Utilities;
use App\Models\User;
use Illuminate\Support\Arr;
use Jenssegers\Agent\Agent;
/**
* @mixin Request
* Class RequestMixin
*/
class BusinessInfoRequestMixin
{
public function getBusinessInfo()
{
return function () {
return Arr::get($this, '_business_info');
};
}
public function getFromBusinessInfo()
{
return function(string $key) {
return Arr::get($this, "_business_info.$key");
};
}
public function getBusinessUsers()
{
return function() {
return $this->getFromBusinessInfo('info.users');
};
}
public function isBusinessOwner()
{
return function(User $user) {
return Arr::get($this, "_business_info.info.users.{$user->id}.level") != enum('levels.owner.id');
};
}
}