code
stringlengths
31
1.39M
docstring
stringlengths
23
16.8k
func_name
stringlengths
1
126
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
166
url
stringlengths
50
220
license
stringclasses
7 values
public function getBasicResponse() { // Default the basic response if ($this->basicResponse === null) { $this->basicResponse = function () { if (headers_sent()) { throw new RuntimeException('Attempting basic auth after headers have already been sent.'); } header('WWW-Authenticate: Basic'); header('HTTP/1.0 401 Unauthorized'); echo 'Invalid credentials.'; exit; }; } $response = $this->basicResponse; return $response(); }
Sends a response when HTTP basic authentication fails. @throws \RuntimeException @return mixed
getBasicResponse
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function creatingBasicResponse(Closure $basicResponse): void { $this->basicResponse = $basicResponse; }
Sets the callback which creates a basic response. @param \Closure $basicResonse @return void
creatingBasicResponse
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function login(UserInterface $user, bool $remember = false) { $this->fireEvent('sentinel.logging-in', $user); $this->persistences->persist($user, $remember); $response = $this->users->recordLogin($user); if (! $response) { return false; } $this->fireEvent('sentinel.logged-in', $user); return $this->user = $user; }
Persists a login for the given user. @param \Cartalyst\Sentinel\Users\UserInterface $user @param bool $remember @return bool|\Cartalyst\Sentinel\Users\UserInterface
login
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function loginAndRemember(UserInterface $user) { return $this->login($user, true); }
Persists a login for the given user, with the "remember" flag. @param \Cartalyst\Sentinel\Users\UserInterface $user @return bool|\Cartalyst\Sentinel\Users\UserInterface
loginAndRemember
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function logout(UserInterface $user = null, bool $everywhere = false): bool { $currentUser = $this->check(); $this->fireEvent('sentinel.logging-out', $user); if ($user && $user !== $currentUser) { $this->persistences->flush($user, false); $this->fireEvent('sentinel.logged-out', $user); return true; } $user = $user ?: $currentUser; if ($user === false) { $this->fireEvent('sentinel.logged-out', $user); return true; } $method = $everywhere === true ? 'flush' : 'forget'; $this->persistences->{$method}($user); $this->user = null; $this->fireEvent('sentinel.logged-out', $user); return $this->users->recordLogout($user); }
Logs the current user out. @param \Cartalyst\Sentinel\Users\UserInterface|null $user @param bool $everywhere @return bool
logout
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function bypassCheckpoints(Closure $callback, array $checkpoints = []) { $originalCheckpoints = $this->checkpoints; $activeCheckpoints = []; foreach (array_keys($originalCheckpoints) as $checkpoint) { if ($checkpoints && ! in_array($checkpoint, $checkpoints)) { $activeCheckpoints[$checkpoint] = $originalCheckpoints[$checkpoint]; } } // Temporarily replace the registered checkpoints $this->checkpoints = $activeCheckpoints; // Fire the callback $result = $callback($this); // Reset checkpoints $this->checkpoints = $originalCheckpoints; return $result; }
Pass a closure to Sentinel to bypass checkpoints. @param \Closure $callback @param array $checkpoints @return mixed
bypassCheckpoints
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function checkpointsStatus(): bool { return $this->checkpointsStatus; }
Checks if checkpoints are enabled. @return bool
checkpointsStatus
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function getCheckpoints(): array { return $this->checkpoints; }
Returns all the added Checkpoints. @return array
getCheckpoints
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function addCheckpoint(string $key, CheckpointInterface $checkpoint): void { $this->checkpoints[$key] = $checkpoint; }
Add a new checkpoint to Sentinel. @param string $key @param \Cartalyst\Sentinel\Checkpoints\CheckpointInterface $checkpoint @return void
addCheckpoint
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function removeCheckpoint(string $key): void { if (isset($this->checkpoints[$key])) { unset($this->checkpoints[$key]); } }
Removes a checkpoint. @param string $key @return void
removeCheckpoint
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function removeCheckpoints(array $checkpoints = []): void { foreach ($checkpoints as $checkpoint) { $this->removeCheckpoint($checkpoint); } }
Removes the given checkpoints. @param array $checkpoints @return void
removeCheckpoints
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
protected function cycleCheckpoints(string $method, UserInterface $user = null, bool $halt = true): bool { if (! $this->checkpointsStatus) { return true; } foreach ($this->checkpoints as $checkpoint) { $response = $checkpoint->{$method}($user); if (! $response && $halt) { return false; } } return true; }
Cycles through all the registered checkpoints for a user. Checkpoints may throw their own exceptions, however, if just one returns false, the cycle fails. @param string $method @param \Cartalyst\Sentinel\Users\UserInterface $user @param bool $halt @return bool
cycleCheckpoints
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function getUser(bool $check = true): ?UserInterface { if ($check && $this->user === null) { $this->check(); } return $this->user; }
Returns the currently logged in user, lazily checking for it. @param bool $check @return \Cartalyst\Sentinel\Users\UserInterface|null
getUser
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function setUser(UserInterface $user) { $this->user = $user; }
Sets the user associated with Sentinel (does not log in). @param \Cartalyst\Sentinel\Users\UserInterface $user @return void
setUser
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function getUserRepository(): UserRepositoryInterface { return $this->users; }
Returns the user repository. @return \Cartalyst\Sentinel\Users\UserRepositoryInterface
getUserRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function setUserRepository(UserRepositoryInterface $users): void { $this->users = $users; $this->userMethods = []; }
Sets the user repository. @param \Cartalyst\Sentinel\Users\UserRepositoryInterface $users @return void
setUserRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function getRoleRepository(): RoleRepositoryInterface { return $this->roles; }
Returns the role repository. @return \Cartalyst\Sentinel\Roles\RoleRepositoryInterface
getRoleRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function setRoleRepository(RoleRepositoryInterface $roles): void { $this->roles = $roles; }
Sets the role repository. @param \Cartalyst\Sentinel\Roles\RoleRepositoryInterface $roles @return void
setRoleRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function getPersistenceRepository(): PersistenceRepositoryInterface { return $this->persistences; }
Returns the persistences repository. @return \Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface
getPersistenceRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function setPersistenceRepository(PersistenceRepositoryInterface $persistences): void { $this->persistences = $persistences; }
Sets the persistences repository. @param \Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface $persistences @return void
setPersistenceRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function getActivationRepository(): ActivationRepositoryInterface { return $this->activations; }
Returns the activations repository. @return \Cartalyst\Sentinel\Activations\ActivationRepositoryInterface
getActivationRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function setActivationRepository(ActivationRepositoryInterface $activations): void { $this->activations = $activations; }
Sets the activations repository. @param \Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations @return void
setActivationRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function getReminderRepository(): ReminderRepositoryInterface { return $this->reminders; }
Returns the reminders repository. @return \Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface
getReminderRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function setReminderRepository(ReminderRepositoryInterface $reminders): void { $this->reminders = $reminders; }
Sets the reminders repository. @param \Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface $reminders @return void
setReminderRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function getThrottleRepository(): ThrottleRepositoryInterface { return $this->throttle; }
Returns the throttle repository. @return \Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface
getThrottleRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function setThrottleRepository(ThrottleRepositoryInterface $throttle): void { $this->throttle = $throttle; }
Sets the throttle repository. @param \Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface $throttle @return void
setThrottleRepository
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
protected function getUserMethods(): array { if (empty($this->userMethods)) { $users = $this->getUserRepository(); $methods = get_class_methods($users); $this->userMethods = array_diff($methods, ['__construct']); } return $this->userMethods; }
Returns all accessible methods on the associated user repository. @return array
getUserMethods
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function __call($method, $parameters) { $methods = $this->getUserMethods(); if (in_array($method, $methods)) { $users = $this->getUserRepository(); return call_user_func_array([$users, $method], $parameters); } if (Str::startsWith($method, 'findUserBy')) { $user = $this->getUserRepository(); $method = 'findBy'.substr($method, 10); return call_user_func_array([$user, $method], $parameters); } if (Str::startsWith($method, 'findRoleBy')) { $roles = $this->getRoleRepository(); $method = 'findBy'.substr($method, 10); return call_user_func_array([$roles, $method], $parameters); } $methods = ['getRoles', 'inRole', 'inAnyRole', 'hasAccess', 'hasAnyAccess']; $className = get_class($this); if (in_array($method, $methods)) { $user = $this->getUser(); if ($user === null) { throw new BadMethodCallException("Method {$className}::{$method}() can only be called if a user is logged in."); } return call_user_func_array([$user, $method], $parameters); } throw new BadMethodCallException("Call to undefined method {$className}::{$method}()"); }
Dynamically pass missing methods to Sentinel. @param string $method @param array $parameters @throws \BadMethodCallException @return mixed
__call
php
cartalyst/sentinel
src/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Sentinel.php
BSD-3-Clause
public function __construct(string $model, int $expires) { $this->model = $model; $this->expires = $expires; }
Constructor. @param string $model @param int $expires @return void
__construct
php
cartalyst/sentinel
src/Activations/IlluminateActivationRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Activations/IlluminateActivationRepository.php
BSD-3-Clause
protected function expires(): Carbon { return Carbon::now()->subSeconds($this->expires); }
Returns the expiration date. @return \Carbon\Carbon
expires
php
cartalyst/sentinel
src/Activations/IlluminateActivationRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Activations/IlluminateActivationRepository.php
BSD-3-Clause
protected function generateActivationCode(): string { return Str::random(32); }
Returns the random string used for the activation code. @return string
generateActivationCode
php
cartalyst/sentinel
src/Activations/IlluminateActivationRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Activations/IlluminateActivationRepository.php
BSD-3-Clause
public function __construct(ActivationRepositoryInterface $activations) { $this->activations = $activations; }
Constructor. @param \Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations @return void
__construct
php
cartalyst/sentinel
src/Checkpoints/ActivationCheckpoint.php
https://github.com/cartalyst/sentinel/blob/master/src/Checkpoints/ActivationCheckpoint.php
BSD-3-Clause
protected function checkActivation(UserInterface $user): bool { $completed = $this->activations->completed($user); if (! $completed) { $exception = new NotActivatedException('Your account has not been activated yet.'); $exception->setUser($user); throw $exception; } return true; }
Checks the activation status of the given user. @param \Cartalyst\Sentinel\Users\UserInterface $user @throws \Cartalyst\Sentinel\Checkpoints\NotActivatedException @return bool
checkActivation
php
cartalyst/sentinel
src/Checkpoints/ActivationCheckpoint.php
https://github.com/cartalyst/sentinel/blob/master/src/Checkpoints/ActivationCheckpoint.php
BSD-3-Clause
public function getUser(): UserInterface { return $this->user; }
Returns the user. @return \Cartalyst\Sentinel\Users\UserInterface
getUser
php
cartalyst/sentinel
src/Checkpoints/NotActivatedException.php
https://github.com/cartalyst/sentinel/blob/master/src/Checkpoints/NotActivatedException.php
BSD-3-Clause
public function setUser(UserInterface $user): void { $this->user = $user; }
Sets the user associated with Sentinel (does not log in). @param \Cartalyst\Sentinel\Users\UserInterface @return void
setUser
php
cartalyst/sentinel
src/Checkpoints/NotActivatedException.php
https://github.com/cartalyst/sentinel/blob/master/src/Checkpoints/NotActivatedException.php
BSD-3-Clause
public function __construct(ThrottleRepositoryInterface $throttle, $ipAddress = null) { $this->throttle = $throttle; if (isset($ipAddress)) { $this->ipAddress = $ipAddress; } }
Constructor. @param \Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface $throttle @param string $ipAddress @return void
__construct
php
cartalyst/sentinel
src/Checkpoints/ThrottleCheckpoint.php
https://github.com/cartalyst/sentinel/blob/master/src/Checkpoints/ThrottleCheckpoint.php
BSD-3-Clause
protected function checkThrottling(string $action, UserInterface $user = null): bool { // If we are just checking an existing logged in person, the global delay // shouldn't stop them being logged in at all. Only their IP address and // user a if ($action === 'login') { $globalDelay = $this->throttle->globalDelay(); if ($globalDelay > 0) { $this->throwException("Too many unsuccessful attempts have been made globally, logins are locked for another [{$globalDelay}] second(s).", 'global', $globalDelay); } } // Suspicious activity from a single IP address will not only lock // logins but also any logged in users from that IP address. This // should deter a single hacker who may have guessed a password // within the configured throttling limit. if (isset($this->ipAddress)) { $ipDelay = $this->throttle->ipDelay($this->ipAddress); if ($ipDelay > 0) { $this->throwException("Suspicious activity has occured on your IP address and you have been denied access for another [{$ipDelay}] second(s).", 'ip', $ipDelay); } } // We will only suspend people logging into a user account. This will // leave the logged in user unaffected. Picture a famous person who's // account is being locked as they're logged in, purely because // others are trying to hack it. if ($action === 'login' && isset($user)) { $userDelay = $this->throttle->userDelay($user); if ($userDelay > 0) { $this->throwException("Too many unsuccessful login attempts have been made against your account. Please try again after another [{$userDelay}] second(s).", 'user', $userDelay); } } return true; }
Checks the throttling status of the given user. @param string $action @param \Cartalyst\Sentinel\Users\UserInterface|null $user @return bool
checkThrottling
php
cartalyst/sentinel
src/Checkpoints/ThrottleCheckpoint.php
https://github.com/cartalyst/sentinel/blob/master/src/Checkpoints/ThrottleCheckpoint.php
BSD-3-Clause
protected function throwException(string $message, string $type, int $delay): void { $exception = new ThrottlingException($message); $exception->setDelay($delay); $exception->setType($type); throw $exception; }
Throws a throttling exception. @param string $message @param string $type @param int $delay @throws \Cartalyst\Sentinel\Checkpoints\ThrottlingException @return void
throwException
php
cartalyst/sentinel
src/Checkpoints/ThrottleCheckpoint.php
https://github.com/cartalyst/sentinel/blob/master/src/Checkpoints/ThrottleCheckpoint.php
BSD-3-Clause
public function setDelay(int $delay): self { $this->delay = $delay; return $this; }
Sets the delay. @param int $delay @return $this
setDelay
php
cartalyst/sentinel
src/Checkpoints/ThrottlingException.php
https://github.com/cartalyst/sentinel/blob/master/src/Checkpoints/ThrottlingException.php
BSD-3-Clause
public function setType(string $type): self { $this->type = $type; return $this; }
Sets the type. @param string $type @return $this
setType
php
cartalyst/sentinel
src/Checkpoints/ThrottlingException.php
https://github.com/cartalyst/sentinel/blob/master/src/Checkpoints/ThrottlingException.php
BSD-3-Clause
public function getFree(): Carbon { return Carbon::now()->addSeconds($this->delay); }
Returns a Carbon object representing the time which the throttle is lifted. @return \Carbon\Carbon
getFree
php
cartalyst/sentinel
src/Checkpoints/ThrottlingException.php
https://github.com/cartalyst/sentinel/blob/master/src/Checkpoints/ThrottlingException.php
BSD-3-Clause
public function __construct(Request $request, CookieJar $jar, $key = null) { $this->request = $request; $this->jar = $jar; if (isset($key)) { $this->key = $key; } }
Constructor. @param \Illuminate\Http\Request $request @param \Illuminate\Cookie\CookieJar $jar @param string $key @return void
__construct
php
cartalyst/sentinel
src/Cookies/IlluminateCookie.php
https://github.com/cartalyst/sentinel/blob/master/src/Cookies/IlluminateCookie.php
BSD-3-Clause
public function __construct($options = []) { if (is_array($options)) { $this->options = array_merge($this->options, $options); } else { $this->options['name'] = $options; } }
Constructor. @param array|string $options @return void
__construct
php
cartalyst/sentinel
src/Cookies/NativeCookie.php
https://github.com/cartalyst/sentinel/blob/master/src/Cookies/NativeCookie.php
BSD-3-Clause
protected function minutesToLifetime(int $minutes): int { return time() + ($minutes * 60); }
Takes a minutes parameter (relative to now) and converts it to a lifetime (unix timestamp). @param int $minutes @return int
minutesToLifetime
php
cartalyst/sentinel
src/Cookies/NativeCookie.php
https://github.com/cartalyst/sentinel/blob/master/src/Cookies/NativeCookie.php
BSD-3-Clause
protected function setCookie($value, int $lifetime, string $path = null, string $domain = null, bool $secure = null, bool $httpOnly = null) { setcookie( $this->options['name'], json_encode($value), $lifetime, $path ?: $this->options['path'], $domain ?: $this->options['domain'], $secure ?: $this->options['secure'], $httpOnly ?: $this->options['http_only'] ); }
Sets a PHP cookie. @param mixed $value @param int $lifetime @param string $path @param string $domain @param bool $secure @param bool $httpOnly @return void
setCookie
php
cartalyst/sentinel
src/Cookies/NativeCookie.php
https://github.com/cartalyst/sentinel/blob/master/src/Cookies/NativeCookie.php
BSD-3-Clause
public function get() { return null; }
Returns the Sentinel cookie value. @return mixed
get
php
cartalyst/sentinel
src/Cookies/NullCookie.php
https://github.com/cartalyst/sentinel/blob/master/src/Cookies/NullCookie.php
BSD-3-Clause
public function __construct(Closure $hash, Closure $check) { $this->hash = $hash; $this->check = $check; }
Constructor. @param \Closure $hash @param \Closure $check @return void
__construct
php
cartalyst/sentinel
src/Hashing/CallbackHasher.php
https://github.com/cartalyst/sentinel/blob/master/src/Hashing/CallbackHasher.php
BSD-3-Clause
protected function createSalt(): string { $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./'; $max = strlen($pool) - 1; $salt = ''; for ($i = 0; $i < $this->saltLength; $i++) { $salt .= $pool[random_int(0, $max)]; } return $salt; }
Create a random string for a salt. @return string
createSalt
php
cartalyst/sentinel
src/Hashing/Hasher.php
https://github.com/cartalyst/sentinel/blob/master/src/Hashing/Hasher.php
BSD-3-Clause
protected function slowEquals(string $a, string $b): bool { $diff = strlen($a) ^ strlen($b); for ($i = 0; $i < strlen($a) && $i < strlen($b); $i++) { $diff |= ord($a[$i]) ^ ord($b[$i]); } return $diff === 0; }
Compares two strings $a and $b in length-constant time. @param string $a @param string $b @return bool
slowEquals
php
cartalyst/sentinel
src/Hashing/Hasher.php
https://github.com/cartalyst/sentinel/blob/master/src/Hashing/Hasher.php
BSD-3-Clause
protected function prepareResources() { // Publish config $config = realpath(__DIR__.'/../config/config.php'); $this->mergeConfigFrom($config, 'cartalyst.sentinel'); $this->publishes([ $config => config_path('cartalyst.sentinel.php'), ], 'config'); // Publish migrations $migrations = realpath(__DIR__.'/../migrations'); $this->publishes([ $migrations => $this->app->databasePath().'/migrations', ], 'migrations'); }
Prepare the package resources. @return void
prepareResources
php
cartalyst/sentinel
src/Laravel/SentinelServiceProvider.php
https://github.com/cartalyst/sentinel/blob/master/src/Laravel/SentinelServiceProvider.php
BSD-3-Clause
protected function registerCheckpoints() { $this->registerActivationCheckpoint(); $this->registerThrottleCheckpoint(); $this->app->singleton('sentinel.checkpoints', function ($app) { $activeCheckpoints = $app['config']->get('cartalyst.sentinel.checkpoints'); $checkpoints = []; foreach ($activeCheckpoints as $checkpoint) { if (! $app->offsetExists("sentinel.checkpoint.{$checkpoint}")) { throw new InvalidArgumentException("Invalid checkpoint [{$checkpoint}] given."); } $checkpoints[$checkpoint] = $app["sentinel.checkpoint.{$checkpoint}"]; } return $checkpoints; }); }
Registers the checkpoints. @throws \InvalidArgumentException @return void
registerCheckpoints
php
cartalyst/sentinel
src/Laravel/SentinelServiceProvider.php
https://github.com/cartalyst/sentinel/blob/master/src/Laravel/SentinelServiceProvider.php
BSD-3-Clause
protected function registerActivationCheckpoint() { $this->registerActivations(); $this->app->singleton('sentinel.checkpoint.activation', function ($app) { return new ActivationCheckpoint($app['sentinel.activations']); }); }
Registers the activation checkpoint. @return void
registerActivationCheckpoint
php
cartalyst/sentinel
src/Laravel/SentinelServiceProvider.php
https://github.com/cartalyst/sentinel/blob/master/src/Laravel/SentinelServiceProvider.php
BSD-3-Clause
protected function registerThrottleCheckpoint() { $this->registerThrottling(); $this->app->singleton('sentinel.checkpoint.throttle', function ($app) { return new ThrottleCheckpoint( $app['sentinel.throttling'], $app['request']->getClientIp() ); }); }
Registers the throttle checkpoint. @return void
registerThrottleCheckpoint
php
cartalyst/sentinel
src/Laravel/SentinelServiceProvider.php
https://github.com/cartalyst/sentinel/blob/master/src/Laravel/SentinelServiceProvider.php
BSD-3-Clause
protected function garbageCollect() { $config = $this->app['config']->get('cartalyst.sentinel'); $this->sweep( $this->app['sentinel.activations'], $config['activations']['lottery'] ); $this->sweep( $this->app['sentinel.reminders'], $config['reminders']['lottery'] ); }
Garbage collect activations and reminders. @return void
garbageCollect
php
cartalyst/sentinel
src/Laravel/SentinelServiceProvider.php
https://github.com/cartalyst/sentinel/blob/master/src/Laravel/SentinelServiceProvider.php
BSD-3-Clause
protected function sweep($repository, array $lottery) { if ($this->configHitsLottery($lottery)) { try { $repository->removeExpired(); } catch (Exception $e) { } } }
Sweep expired codes. @param mixed $repository @param array $lottery @return void
sweep
php
cartalyst/sentinel
src/Laravel/SentinelServiceProvider.php
https://github.com/cartalyst/sentinel/blob/master/src/Laravel/SentinelServiceProvider.php
BSD-3-Clause
protected function configHitsLottery(array $lottery) { return mt_rand(1, $lottery[1]) <= $lottery[0]; }
Determine if the configuration odds hit the lottery. @param array $lottery @return bool
configHitsLottery
php
cartalyst/sentinel
src/Laravel/SentinelServiceProvider.php
https://github.com/cartalyst/sentinel/blob/master/src/Laravel/SentinelServiceProvider.php
BSD-3-Clause
protected function setUserResolver() { $this->app->rebinding('request', function ($app, $request) { $request->setUserResolver(function () use ($app) { return $app['sentinel']->getUser(); }); }); }
Sets the user resolver on the request class. @return void
setUserResolver
php
cartalyst/sentinel
src/Laravel/SentinelServiceProvider.php
https://github.com/cartalyst/sentinel/blob/master/src/Laravel/SentinelServiceProvider.php
BSD-3-Clause
protected function setOverrides() { $config = $this->app['config']->get('cartalyst.sentinel'); $users = $config['users']['model']; $roles = $config['roles']['model']; $persistences = $config['persistences']['model']; if (class_exists($users)) { if (method_exists($users, 'setRolesModel')) { forward_static_call_array([$users, 'setRolesModel'], [$roles]); } if (method_exists($users, 'setPersistencesModel')) { forward_static_call_array([$users, 'setPersistencesModel'], [$persistences]); } if (method_exists($users, 'setPermissionsClass')) { forward_static_call_array([$users, 'setPermissionsClass'], [$config['permissions']['class']]); } } if (class_exists($roles) && method_exists($roles, 'setUsersModel')) { forward_static_call_array([$roles, 'setUsersModel'], [$users]); } if (class_exists($persistences) && method_exists($persistences, 'setUsersModel')) { forward_static_call_array([$persistences, 'setUsersModel'], [$users]); } }
Performs the necessary overrides. @return void
setOverrides
php
cartalyst/sentinel
src/Laravel/SentinelServiceProvider.php
https://github.com/cartalyst/sentinel/blob/master/src/Laravel/SentinelServiceProvider.php
BSD-3-Clause
public function __construct($file = null) { $this->file = $file ?: __DIR__.'/../config/config.php'; $this->load(); }
Constructor. @param string $file @return void
__construct
php
cartalyst/sentinel
src/Native/ConfigRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/ConfigRepository.php
BSD-3-Clause
protected function load() { $this->config = require $this->file; }
Load the configuration file. @return void
load
php
cartalyst/sentinel
src/Native/ConfigRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/ConfigRepository.php
BSD-3-Clause
public function __construct($config = null) { if (is_string($config)) { $this->config = new ConfigRepository($config); } else { $this->config = $config ?: new ConfigRepository(); } }
Constructor. @param array $config @return void
__construct
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
public function createSentinel() { $persistence = $this->createPersistence(); $users = $this->createUsers(); $roles = $this->createRoles(); $activations = $this->createActivations(); $dispatcher = $this->getEventDispatcher(); $sentinel = new Sentinel( $persistence, $users, $roles, $activations, $dispatcher ); $throttle = $this->createThrottling(); $ipAddress = $this->getIpAddress(); $checkpoints = $this->createCheckpoints($activations, $throttle, $ipAddress); foreach ($checkpoints as $key => $checkpoint) { $sentinel->addCheckpoint($key, $checkpoint); } $reminders = $this->createReminders($users); $sentinel->setActivationRepository($activations); $sentinel->setReminderRepository($reminders); $sentinel->setThrottleRepository($throttle); return $sentinel; }
Creates a sentinel instance. @return \Cartalyst\Sentinel\Sentinel
createSentinel
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createPersistence() { $session = $this->createSession(); $cookie = $this->createCookie(); $model = $this->config['persistences']['model']; $single = $this->config['persistences']['single']; $users = $this->config['users']['model']; if (class_exists($users) && method_exists($users, 'setPersistencesModel')) { forward_static_call_array([$users, 'setPersistencesModel'], [$model]); } return new IlluminatePersistenceRepository($session, $cookie, $model, $single); }
Creates a persistences repository. @return \Cartalyst\Sentinel\Persistences\IlluminatePersistenceRepository
createPersistence
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createSession() { return new NativeSession($this->config['session']); }
Creates a session. @return \Cartalyst\Sentinel\Sessions\NativeSession
createSession
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createCookie() { return new NativeCookie($this->config['cookie']); }
Creates a cookie. @return \Cartalyst\Sentinel\Cookies\NativeCookie
createCookie
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createUsers() { $hasher = $this->createHasher(); $model = $this->config['users']['model']; $roles = $this->config['roles']['model']; $persistences = $this->config['persistences']['model']; if (class_exists($roles) && method_exists($roles, 'setUsersModel')) { forward_static_call_array([$roles, 'setUsersModel'], [$model]); } if (class_exists($persistences) && method_exists($persistences, 'setUsersModel')) { forward_static_call_array([$persistences, 'setUsersModel'], [$model]); } return new IlluminateUserRepository($hasher, $this->getEventDispatcher(), $model); }
Creates a user repository. @return \Cartalyst\Sentinel\Users\IlluminateUserRepository
createUsers
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createHasher() { return new NativeHasher(); }
Creates a hasher. @return \Cartalyst\Sentinel\Hashing\NativeHasher
createHasher
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createRoles() { $model = $this->config['roles']['model']; $users = $this->config['users']['model']; if (class_exists($users) && method_exists($users, 'setRolesModel')) { forward_static_call_array([$users, 'setRolesModel'], [$model]); } return new IlluminateRoleRepository($model); }
Creates a role repository. @return \Cartalyst\Sentinel\Roles\IlluminateRoleRepository
createRoles
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createActivations() { $model = $this->config['activations']['model']; $expires = $this->config['activations']['expires']; return new IlluminateActivationRepository($model, $expires); }
Creates an activation repository. @return \Cartalyst\Sentinel\Activations\IlluminateActivationRepository
createActivations
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function getIpAddress() { $request = Request::createFromGlobals(); return $request->getClientIp(); }
Returns the client's ip address. @return string
getIpAddress
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createActivationCheckpoint(IlluminateActivationRepository $activations) { return new ActivationCheckpoint($activations); }
Create an activation checkpoint. @param \Cartalyst\Sentinel\Activations\IlluminateActivationRepository $activations @return \Cartalyst\Sentinel\Checkpoints\ActivationCheckpoint
createActivationCheckpoint
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createCheckpoints(IlluminateActivationRepository $activations, IlluminateThrottleRepository $throttle, $ipAddress) { $activeCheckpoints = $this->config['checkpoints']; $activation = $this->createActivationCheckpoint($activations); $throttle = $this->createThrottleCheckpoint($throttle, $ipAddress); $checkpoints = []; foreach ($activeCheckpoints as $checkpoint) { if (! isset(${$checkpoint})) { throw new InvalidArgumentException("Invalid checkpoint [{$checkpoint}] given."); } $checkpoints[$checkpoint] = ${$checkpoint}; } return $checkpoints; }
Create activation and throttling checkpoints. @param \Cartalyst\Sentinel\Activations\IlluminateActivationRepository $activations @param \Cartalyst\Sentinel\Throttling\IlluminateThrottleRepository $throttle @param string $ipAddress @throws \InvalidArgumentException @return array
createCheckpoints
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createThrottleCheckpoint(IlluminateThrottleRepository $throttle, $ipAddress) { return new ThrottleCheckpoint($throttle, $ipAddress); }
Create a throttle checkpoint. @param \Cartalyst\Sentinel\Throttling\IlluminateThrottleRepository $throttle @param string $ipAddress @return \Cartalyst\Sentinel\Checkpoints\ThrottleCheckpoint
createThrottleCheckpoint
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createThrottling() { $model = $this->config['throttling']['model']; foreach (['global', 'ip', 'user'] as $type) { ${"{$type}Interval"} = $this->config['throttling'][$type]['interval']; ${"{$type}Thresholds"} = $this->config['throttling'][$type]['thresholds']; } return new IlluminateThrottleRepository( $model, $globalInterval, $globalThresholds, $ipInterval, $ipThresholds, $userInterval, $userThresholds ); }
Create a throttling repository. @return \Cartalyst\Sentinel\Throttling\IlluminateThrottleRepository
createThrottling
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function getEventDispatcher() { if (! $this->dispatcher) { $this->dispatcher = new Dispatcher(); } return $this->dispatcher; }
Returns the event dispatcher. @return \Illuminate\Contracts\Events\Dispatcher
getEventDispatcher
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
protected function createReminders(IlluminateUserRepository $users) { $model = $this->config['reminders']['model']; $expires = $this->config['reminders']['expires']; return new IlluminateReminderRepository($users, $model, $expires); }
Create a reminder repository. @param \Cartalyst\Sentinel\Users\IlluminateUserRepository $users @return \Cartalyst\Sentinel\Reminders\IlluminateReminderRepository
createReminders
php
cartalyst/sentinel
src/Native/SentinelBootstrapper.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/SentinelBootstrapper.php
BSD-3-Clause
public function __construct(SentinelBootstrapper $bootstrapper = null) { if ($bootstrapper === null) { $bootstrapper = new SentinelBootstrapper(); } $this->sentinel = $bootstrapper->createSentinel(); }
Constructor. @param \Cartalyst\Sentinel\Native\SentinelBootstrapper $bootstrapper @return void
__construct
php
cartalyst/sentinel
src/Native/Facades/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/Facades/Sentinel.php
BSD-3-Clause
public function getSentinel() { return $this->sentinel; }
Returns the Sentinel instance. @return \Cartalyst\Sentinel\Sentinel
getSentinel
php
cartalyst/sentinel
src/Native/Facades/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/Facades/Sentinel.php
BSD-3-Clause
public static function instance(SentinelBootstrapper $bootstrapper = null) { if (static::$instance === null) { static::$instance = new static($bootstrapper); } return static::$instance; }
Creates a new Native Bootstraper instance. @param \Cartalyst\Sentinel\Native\SentinelBootstrapper $bootstrapper @return \Cartalyst\Sentinel\Native\SentinelBootstrapper
instance
php
cartalyst/sentinel
src/Native/Facades/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/Facades/Sentinel.php
BSD-3-Clause
public static function __callStatic($method, $args) { $instance = static::instance()->getSentinel(); switch (count($args)) { case 0: return $instance->{$method}(); case 1: return $instance->{$method}($args[0]); case 2: return $instance->{$method}($args[0], $args[1]); case 3: return $instance->{$method}($args[0], $args[1], $args[2]); case 4: return $instance->{$method}($args[0], $args[1], $args[2], $args[3]); default: return call_user_func_array([$instance, $method], $args); } }
Handle dynamic, static calls to the object. @param string $method @param array $args @return mixed
__callStatic
php
cartalyst/sentinel
src/Native/Facades/Sentinel.php
https://github.com/cartalyst/sentinel/blob/master/src/Native/Facades/Sentinel.php
BSD-3-Clause
public function setPermissions(array $permissions): self { $this->permissions = $permissions; return $this; }
Sets permissions. @param array $permissions @return $this
setPermissions
php
cartalyst/sentinel
src/Permissions/PermissibleTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissibleTrait.php
BSD-3-Clause
public static function getPermissionsClass(): string { return static::$permissionsClass; }
Returns the permissions class name. @return string
getPermissionsClass
php
cartalyst/sentinel
src/Permissions/PermissibleTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissibleTrait.php
BSD-3-Clause
public static function setPermissionsClass(string $permissionsClass): void { static::$permissionsClass = $permissionsClass; }
Sets the permissions class name. @param string $permissionsClass @return void
setPermissionsClass
php
cartalyst/sentinel
src/Permissions/PermissibleTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissibleTrait.php
BSD-3-Clause
public function __construct(array $permissions = null, array $secondaryPermissions = null) { $this->permissions = $permissions; $this->secondaryPermissions = $secondaryPermissions; }
Constructor. @param array|null $permissions @param array|null $secondaryPermissions @return void
__construct
php
cartalyst/sentinel
src/Permissions/PermissionsTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissionsTrait.php
BSD-3-Clause
public function getPermissions(): array { return $this->permissions ?? []; }
Returns the main permissions. @return array
getPermissions
php
cartalyst/sentinel
src/Permissions/PermissionsTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissionsTrait.php
BSD-3-Clause
public function getSecondaryPermissions(): array { return $this->secondaryPermissions ?? []; }
Returns the secondary permissions. @return array
getSecondaryPermissions
php
cartalyst/sentinel
src/Permissions/PermissionsTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissionsTrait.php
BSD-3-Clause
public function setSecondaryPermissions(array $secondaryPermissions): self { $this->secondaryPermissions = $secondaryPermissions; $this->preparedPermissions = null; return $this; }
Sets secondary permissions. @param array $secondaryPermissions @return $this
setSecondaryPermissions
php
cartalyst/sentinel
src/Permissions/PermissionsTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissionsTrait.php
BSD-3-Clause
protected function getPreparedPermissions(): array { if ($this->preparedPermissions === null) { $this->preparedPermissions = $this->createPreparedPermissions(); } return $this->preparedPermissions; }
Lazily grab the prepared permissions. @return array
getPreparedPermissions
php
cartalyst/sentinel
src/Permissions/PermissionsTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissionsTrait.php
BSD-3-Clause
protected function preparePermissions(array &$prepared, array $permissions): void { foreach ($permissions as $keys => $value) { foreach ($this->extractClassPermissions($keys) as $key) { // If the value is not in the array, we're opting in if (! array_key_exists($key, $prepared)) { $prepared[$key] = $value; continue; } // If our value is in the array and equals false, it will override if ($value === false) { $prepared[$key] = $value; } } } }
Does the heavy lifting of preparing permissions. @param array $prepared @param array $permissions @return void
preparePermissions
php
cartalyst/sentinel
src/Permissions/PermissionsTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissionsTrait.php
BSD-3-Clause
protected function extractClassPermissions(string $key): array { if (! Str::contains($key, '@')) { return (array) $key; } $keys = []; list($class, $methods) = explode('@', $key); foreach (explode(',', $methods) as $method) { $keys[] = "{$class}@{$method}"; } return $keys; }
Takes the given permission key and inspects it for a class & method. If it exists, methods may be comma-separated, e.g. Class@method1,method2. @param string $key @return array
extractClassPermissions
php
cartalyst/sentinel
src/Permissions/PermissionsTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissionsTrait.php
BSD-3-Clause
protected function checkPermission(array $prepared, string $permission): bool { if (array_key_exists($permission, $prepared)) { return $prepared[$permission] === true; } foreach ($prepared as $key => $value) { $key = (string) $key; if ((Str::is($permission, $key) || Str::is($key, $permission)) && $value === true) { return true; } } return false; }
Checks a permission in the prepared array, including wildcard checks and permissions. @param array $prepared @param string $permission @return bool
checkPermission
php
cartalyst/sentinel
src/Permissions/PermissionsTrait.php
https://github.com/cartalyst/sentinel/blob/master/src/Permissions/PermissionsTrait.php
BSD-3-Clause
public static function getUsersModel(): string { return static::$usersModel; }
Get the Users model FQCN. @return string
getUsersModel
php
cartalyst/sentinel
src/Persistences/EloquentPersistence.php
https://github.com/cartalyst/sentinel/blob/master/src/Persistences/EloquentPersistence.php
BSD-3-Clause
public static function setUsersModel(string $usersModel): void { static::$usersModel = $usersModel; }
Set the Users model FQCN. @param string $usersModel @return void
setUsersModel
php
cartalyst/sentinel
src/Persistences/EloquentPersistence.php
https://github.com/cartalyst/sentinel/blob/master/src/Persistences/EloquentPersistence.php
BSD-3-Clause
public function __construct(SessionInterface $session, CookieInterface $cookie, string $model = null, bool $single = false) { $this->model = $model; $this->session = $session; $this->cookie = $cookie; $this->single = $single; }
Create a new Sentinel persistence repository. @param \Cartalyst\Sentinel\Sessions\SessionInterface $session @param \Cartalyst\Sentinel\Cookies\CookieInterface $cookie @param string $model @param bool $single @return void
__construct
php
cartalyst/sentinel
src/Persistences/IlluminatePersistenceRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Persistences/IlluminatePersistenceRepository.php
BSD-3-Clause
public function __construct(UserRepositoryInterface $users, string $model = null, int $expires = null) { $this->users = $users; $this->model = $model; $this->expires = $expires; }
Constructor. @param \Cartalyst\Sentinel\Users\UserRepositoryInterface $users @param string $model @param int $expires @return void
__construct
php
cartalyst/sentinel
src/Reminders/IlluminateReminderRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Reminders/IlluminateReminderRepository.php
BSD-3-Clause
protected function expires(): Carbon { return Carbon::now()->subSeconds($this->expires); }
Returns the expiration date. @return \Carbon\Carbon
expires
php
cartalyst/sentinel
src/Reminders/IlluminateReminderRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Reminders/IlluminateReminderRepository.php
BSD-3-Clause
protected function generateReminderCode(): string { return Str::random(32); }
Returns the random string used for the reminder code. @return string
generateReminderCode
php
cartalyst/sentinel
src/Reminders/IlluminateReminderRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Reminders/IlluminateReminderRepository.php
BSD-3-Clause
public function users(): BelongsToMany { return $this->belongsToMany(static::$usersModel, 'role_users', 'role_id', 'user_id')->withTimestamps(); }
The Users relationship. @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
users
php
cartalyst/sentinel
src/Roles/EloquentRole.php
https://github.com/cartalyst/sentinel/blob/master/src/Roles/EloquentRole.php
BSD-3-Clause
public function __call($method, $parameters) { $methods = ['hasAccess', 'hasAnyAccess']; if (in_array($method, $methods)) { $permissions = $this->getPermissionsInstance(); return call_user_func_array([$permissions, $method], $parameters); } return parent::__call($method, $parameters); }
Dynamically pass missing methods to the permissions. @param string $method @param array $parameters @return mixed
__call
php
cartalyst/sentinel
src/Roles/EloquentRole.php
https://github.com/cartalyst/sentinel/blob/master/src/Roles/EloquentRole.php
BSD-3-Clause
public function __construct(string $model = null) { $this->model = $model; }
Create a new Illuminate role repository. @param string $model @return void
__construct
php
cartalyst/sentinel
src/Roles/IlluminateRoleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Roles/IlluminateRoleRepository.php
BSD-3-Clause