/home/techb158/immovalet.com/vendor/yajra/laravel-datatables-html/src/Html
Edit: /home/techb158/immovalet.com/vendor/yajra/laravel-datatables-html/src/Html/HasAuthorizations.php (2174B)
authorized(false);
}
/**
* Make a button if the user is authorized.
*
* @param string $permission
* @param string|array $options
* @param Authorizable|null $user
* @return static
*/
public static function makeIfCan($permission, $options = [], Authorizable $user = null)
{
if (is_null($user)) {
$user = auth()->user();
}
if ($user->can($permission)) {
return static::make($options);
}
return static::make([])->authorized(false);
}
/**
* Make a button if the user is not authorized.
*
* @param string $permission
* @param string|array $options
* @param Authorizable|null $user
* @return static
*/
public static function makeIfCannot($permission, $options = [], Authorizable $user = null)
{
if (is_null($user)) {
$user = auth()->user();
}
if (! $user->can($permission)) {
return static::make($options);
}
return static::make([])->authorized(false);
}
/**
* Set authorization status of the button.
*
* @param bool|callable $bool
* @return static
*/
public function authorized($bool)
{
$this->authorized = value($bool);
return $this;
}
/**
* Convert the Fluent instance to an array.
*
* @return array
*/
public function toArray()
{
if ($this->authorized) {
return parent::toArray();
}
return [];
}
}