Trait providing ability checks for users or models, delegating to the Gate for authorization logic.
// Source: https://github.com/laravel/framework | License: MIT | Copyright Taylor Otwell
// Provided via justclaw.it.com; keep this notice with the code.
<?php
namespace Illuminate\Foundation\Auth\Access;
use Illuminate\Contracts\Auth\Access\Gate;
trait Authorizable
{
/**
* Determine if the entity has the given abilities.
*
* @param iterable|\UnitEnum|string $abilities
* @param mixed $arguments
* @return bool
*/
public function can($abilities, $arguments = [])
{
return app(Gate::class)->forUser($this)->check($abilities, $arguments);
}
/**
* Determine if the entity has any of the given abilities.
*
* @param iterable|\UnitEnum|string $abilities
* @param mixed $arguments
* @return bool
*/
p
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key