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 __construct(SessionStore $session, string $key = null) { $this->session = $session; $this->key = $key; }
Constructor. @param \Illuminate\Session\Store $session @param string $key @return void
__construct
php
cartalyst/sentinel
src/Sessions/IlluminateSession.php
https://github.com/cartalyst/sentinel/blob/master/src/Sessions/IlluminateSession.php
BSD-3-Clause
public function __construct(string $key = null) { $this->key = $key; $this->startSession(); }
Constructor. @param string $key @return void
__construct
php
cartalyst/sentinel
src/Sessions/NativeSession.php
https://github.com/cartalyst/sentinel/blob/master/src/Sessions/NativeSession.php
BSD-3-Clause
public function __destruct() { $this->writeSession(); }
Called upon destruction of the native session handler. @return void
__destruct
php
cartalyst/sentinel
src/Sessions/NativeSession.php
https://github.com/cartalyst/sentinel/blob/master/src/Sessions/NativeSession.php
BSD-3-Clause
protected function startSession(): void { // Check that the session hasn't already been started if (session_status() != PHP_SESSION_ACTIVE && ! headers_sent()) { session_start(); } }
Starts the session if it does not exist. @return void
startSession
php
cartalyst/sentinel
src/Sessions/NativeSession.php
https://github.com/cartalyst/sentinel/blob/master/src/Sessions/NativeSession.php
BSD-3-Clause
protected function getSession() { if (isset($_SESSION[$this->key])) { $value = $_SESSION[$this->key]; if ($value) { return unserialize($value); } } }
Unserializes a value from the session and returns it. @return mixed
getSession
php
cartalyst/sentinel
src/Sessions/NativeSession.php
https://github.com/cartalyst/sentinel/blob/master/src/Sessions/NativeSession.php
BSD-3-Clause
protected function setSession($value): void { $_SESSION[$this->key] = serialize($value); }
Interacts with the $_SESSION global to set a property on it. The property is serialized initially. @param mixed $value @return void
setSession
php
cartalyst/sentinel
src/Sessions/NativeSession.php
https://github.com/cartalyst/sentinel/blob/master/src/Sessions/NativeSession.php
BSD-3-Clause
protected function forgetSession(): void { if (isset($_SESSION[$this->key])) { unset($_SESSION[$this->key]); } }
Forgets the Sentinel session from the global $_SESSION. @return void
forgetSession
php
cartalyst/sentinel
src/Sessions/NativeSession.php
https://github.com/cartalyst/sentinel/blob/master/src/Sessions/NativeSession.php
BSD-3-Clause
public function __construct( $model = 'Cartalyst\Sentinel\Throttling\EloquentThrottle', $globalInterval = null, $globalThresholds = null, $ipInterval = null, $ipThresholds = null, $userInterval = null, $userThresholds = null ) { $this->model = $model; if (isset($globalInterval)) { $this->setGlobalInterval($globalInterval); } if (isset($globalThresholds)) { $this->setGlobalThresholds($globalThresholds); } if (isset($ipInterval)) { $this->setIpInterval($ipInterval); } if (isset($ipThresholds)) { $this->setIpThresholds($ipThresholds); } if (isset($userInterval)) { $this->setUserInterval($userInterval); } if (isset($userThresholds)) { $this->setUserThresholds($userThresholds); } }
Create a new Illuminate throttle repository. @param string $model @param int $globalInterval @param array|int $globalThresholds @param int $ipInterval @param array|int $ipThresholds @param int $userInterval @param array|int $userThresholds @return void
__construct
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function getGlobalInterval() { return $this->globalInterval; }
Returns the global interval. @return int
getGlobalInterval
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function setGlobalInterval($globalInterval) { $this->globalInterval = (int) $globalInterval; }
Sets the global interval. @param int $globalInterval @return void
setGlobalInterval
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function getGlobalThresholds() { return $this->globalThresholds; }
Returns the global thresholds. @return array|int
getGlobalThresholds
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function setGlobalThresholds($globalThresholds) { $this->globalThresholds = is_array($globalThresholds) ? $globalThresholds : (int) $globalThresholds; }
Sets the global thresholds. @param array|int $globalThresholds @return void
setGlobalThresholds
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function getIpInterval() { return $this->ipInterval; }
Returns the IP address interval. @return int
getIpInterval
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function setIpInterval($ipInterval) { $this->ipInterval = (int) $ipInterval; }
Sets the IP address interval. @param int $ipInterval @return void
setIpInterval
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function getIpThresholds() { return $this->ipThresholds; }
Returns the IP address thresholds. @return array|int
getIpThresholds
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function setIpThresholds($ipThresholds) { $this->ipThresholds = is_array($ipThresholds) ? $ipThresholds : (int) $ipThresholds; }
Sets the IP address thresholds. @param array|int $ipThresholds @return void
setIpThresholds
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function getUserInterval() { return $this->userInterval; }
Returns the user interval. @return int
getUserInterval
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function setUserInterval($userInterval) { $this->userInterval = (int) $userInterval; }
Sets the user interval. @param int $userInterval @return void
setUserInterval
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function getUserThresholds() { return $this->userThresholds; }
Returns the user thresholds. @return array|int
getUserThresholds
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function setUserThresholds($userThresholds) { $this->userThresholds = is_array($userThresholds) ? $userThresholds : (int) $userThresholds; }
Sets the user thresholds. @param array|int $userThresholds @return void
setUserThresholds
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
protected function delay($type, $argument = null) { // Based on the given type, we will generate method and property names $typeStudly = Str::studly($type); $method = 'get'.$typeStudly.'Throttles'; $thresholds = $type.'Thresholds'; $throttles = $this->{$method}($argument); if (! $throttles->count()) { return 0; } if (is_array($this->{$thresholds})) { // Great, now we compare our delay against the most recent attempt $last = $throttles->last(); foreach (array_reverse($this->{$thresholds}, true) as $attempts => $delay) { if ($throttles->count() <= $attempts) { continue; } if ((int) $last->created_at->diffInSeconds() < $delay) { return $this->secondsToFree($last, $delay); } } } elseif ($throttles->count() >= $this->{$thresholds}) { $interval = $type.'Interval'; $first = $throttles->first(); return $this->secondsToFree($first, $this->{$interval}); } return 0; }
Returns a delay for the given type. @param string $type @param mixed $argument @return int
delay
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
protected function getGlobalThrottles() { if ($this->globalThrottles === null) { $this->globalThrottles = $this->loadGlobalThrottles(); } return $this->globalThrottles; }
Returns the global throttles collection. @return \Illuminate\Database\Eloquent\Collection
getGlobalThrottles
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
protected function loadGlobalThrottles() { $interval = Carbon::now() ->subSeconds($this->globalInterval) ; return $this->createModel() ->newQuery() ->where('type', 'global') ->where('created_at', '>', $interval) ->get() ; }
Loads and returns the global throttles collection. @return \Illuminate\Database\Eloquent\Collection
loadGlobalThrottles
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
protected function getIpThrottles($ipAddress) { if (! array_key_exists($ipAddress, $this->ipThrottles)) { $this->ipThrottles[$ipAddress] = $this->loadIpThrottles($ipAddress); } return $this->ipThrottles[$ipAddress]; }
Returns the IP address throttles collection. @param string $ipAddress @return \Illuminate\Database\Eloquent\Collection
getIpThrottles
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
protected function loadIpThrottles($ipAddress) { $interval = Carbon::now() ->subSeconds($this->ipInterval) ; return $this ->createModel() ->newQuery() ->where('type', 'ip') ->where('ip', $ipAddress) ->where('created_at', '>', $interval) ->get() ; }
Loads and returns the IP address throttles collection. @param string $ipAddress @return \Illuminate\Database\Eloquent\Collection
loadIpThrottles
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
protected function getUserThrottles(UserInterface $user) { $key = $user->getUserId(); if (! array_key_exists($key, $this->userThrottles)) { $this->userThrottles[$key] = $this->loadUserThrottles($user); } return $this->userThrottles[$key]; }
Returns the user throttles collection. @param \Cartalyst\Sentinel\Users\UserInterface $user @return \Illuminate\Database\Eloquent\Collection
getUserThrottles
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
protected function loadUserThrottles(UserInterface $user) { $interval = Carbon::now() ->subSeconds($this->userInterval) ; return $this ->createModel() ->newQuery() ->where('type', 'user') ->where('user_id', $user->getUserId()) ->where('created_at', '>', $interval) ->get() ; }
Loads and returns the user throttles collection. @param \Cartalyst\Sentinel\Users\UserInterface $user @return \Illuminate\Database\Eloquent\Collection
loadUserThrottles
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
protected function secondsToFree(EloquentThrottle $throttle, $interval) { return (int) $throttle->created_at->subSeconds($interval)->diffInSeconds(); }
Returns the seconds to free based on the given throttle and the presented delay in seconds, by comparing it to now. @param \Cartalyst\Sentinel\Throttling\EloquentThrottle $throttle @param int $interval @return int
secondsToFree
php
cartalyst/sentinel
src/Throttling/IlluminateThrottleRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Throttling/IlluminateThrottleRepository.php
BSD-3-Clause
public function activations(): HasMany { return $this->hasMany(static::$activationsModel, 'user_id'); }
Returns the activations relationship. @return \Illuminate\Database\Eloquent\Relations\HasMany
activations
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public function persistences(): HasMany { return $this->hasMany(static::$persistencesModel, 'user_id'); }
Returns the persistences relationship. @return \Illuminate\Database\Eloquent\Relations\HasMany
persistences
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public function reminders(): HasMany { return $this->hasMany(static::$remindersModel, 'user_id'); }
Returns the reminders relationship. @return \Illuminate\Database\Eloquent\Relations\HasMany
reminders
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public function roles(): BelongsToMany { return $this->belongsToMany(static::$rolesModel, 'role_users', 'user_id', 'role_id')->withTimestamps(); }
Returns the roles relationship. @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
roles
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public function throttle(): HasMany { return $this->hasMany(static::$throttlingModel, 'user_id'); }
Returns the throttle relationship. @return \Illuminate\Database\Eloquent\Relations\HasMany
throttle
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public function getLoginNames(): array { return $this->loginNames; }
Returns an array of login column names. @return array
getLoginNames
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public static function getRolesModel(): string { return static::$rolesModel; }
Returns the roles model. @return string
getRolesModel
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public static function setRolesModel(string $rolesModel): void { static::$rolesModel = $rolesModel; }
Sets the roles model. @param string $rolesModel @return void
setRolesModel
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public static function getPersistencesModel() { return static::$persistencesModel; }
Returns the persistences model. @return string
getPersistencesModel
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public static function setPersistencesModel(string $persistencesModel): void { static::$persistencesModel = $persistencesModel; }
Sets the persistences model. @param string $persistencesModel @return void
setPersistencesModel
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public static function getActivationsModel(): string { return static::$activationsModel; }
Returns the activations model. @return string
getActivationsModel
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public static function setActivationsModel(string $activationsModel): void { static::$activationsModel = $activationsModel; }
Sets the activations model. @param string $activationsModel @return void
setActivationsModel
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public static function getRemindersModel(): string { return static::$remindersModel; }
Returns the reminders model. @return string
getRemindersModel
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public static function setRemindersModel(string $remindersModel): void { static::$remindersModel = $remindersModel; }
Sets the reminders model. @param string $remindersModel @return void
setRemindersModel
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public static function getThrottlingModel(): string { return static::$throttlingModel; }
Returns the throttling model. @return string
getThrottlingModel
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public static function setThrottlingModel(string $throttlingModel): void { static::$throttlingModel = $throttlingModel; }
Sets the throttling model. @param string $throttlingModel @return void
setThrottlingModel
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.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 user. @param string $method @param array $parameters @return mixed
__call
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
protected function createPermissions(): PermissionsInterface { $userPermissions = $this->getPermissions(); $rolePermissions = []; foreach ($this->roles as $role) { $rolePermissions[] = $role->getPermissions(); } return new static::$permissionsClass($userPermissions, $rolePermissions); }
Creates a permissions object. @return \Cartalyst\Sentinel\Permissions\PermissionsInterface
createPermissions
php
cartalyst/sentinel
src/Users/EloquentUser.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/EloquentUser.php
BSD-3-Clause
public function __construct(HasherInterface $hasher, Dispatcher $dispatcher = null, string $model = null) { $this->hasher = $hasher; $this->dispatcher = $dispatcher; $this->model = $model; }
Constructor. @param \Cartalyst\Sentinel\Hashing\HasherInterface $hasher @param \Illuminate\Contracts\Events\Dispatcher $dispatcher @param string|null $model @return void
__construct
php
cartalyst/sentinel
src/Users/IlluminateUserRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/IlluminateUserRepository.php
BSD-3-Clause
public function fill(UserInterface $user, array $credentials): void { $this->fireEvent('sentinel.user.filling', compact('user', 'credentials')); $loginNames = $user->getLoginNames(); [$logins, $password, $attributes] = $this->parseCredentials($credentials, $loginNames); if (is_array($logins)) { $user->fill($logins); } else { $loginName = reset($loginNames); $user->fill([ $loginName => $logins, ]); } $user->fill($attributes); if (isset($password)) { $password = $this->hasher->hash($password); $user->fill([ 'password' => $password, ]); } $this->fireEvent('sentinel.user.filled', compact('user', 'credentials')); }
Fills a user with the given credentials, intelligently. @param \Cartalyst\Sentinel\Users\UserInterface $user @param array $credentials @return void
fill
php
cartalyst/sentinel
src/Users/IlluminateUserRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/IlluminateUserRepository.php
BSD-3-Clause
public function getHasher(): HasherInterface { return $this->hasher; }
Returns the hasher instance. @return \Cartalyst\Sentinel\Hashing\HasherInterface
getHasher
php
cartalyst/sentinel
src/Users/IlluminateUserRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/IlluminateUserRepository.php
BSD-3-Clause
public function setHasher(HasherInterface $hasher): void { $this->hasher = $hasher; }
Sets the hasher instance. @param \Cartalyst\Sentinel\Hashing\HasherInterface $hasher @return void
setHasher
php
cartalyst/sentinel
src/Users/IlluminateUserRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/IlluminateUserRepository.php
BSD-3-Clause
protected function parseCredentials(array $credentials, array $loginNames): array { if (isset($credentials['password'])) { $password = $credentials['password']; unset($credentials['password']); } else { $password = null; } $passedNames = array_intersect_key($credentials, array_flip($loginNames)); if (count($passedNames) > 0) { $logins = []; foreach ($passedNames as $name => $value) { $logins[$name] = $credentials[$name]; unset($credentials[$name]); } } elseif (isset($credentials['login'])) { $logins = $credentials['login']; unset($credentials['login']); } else { $logins = []; } return [$logins, $password, $credentials]; }
Parses the given credentials to return logins, password and others. @param array $credentials @param array $loginNames @throws \InvalidArgumentException @return array
parseCredentials
php
cartalyst/sentinel
src/Users/IlluminateUserRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/IlluminateUserRepository.php
BSD-3-Clause
protected function validateUser(array $credentials, int $id = null): bool { $instance = $this->createModel(); $loginNames = $instance->getLoginNames(); // We will simply parse credentials which checks logins and passwords [$logins, $password] = $this->parseCredentials($credentials, $loginNames); if ($id === null) { if (empty($logins)) { throw new InvalidArgumentException('No [login] credential was passed.'); } if (empty($password)) { throw new InvalidArgumentException('You have not passed a [password].'); } } return true; }
Validates the user. @param array $credentials @param int $id @throws \InvalidArgumentException @return bool
validateUser
php
cartalyst/sentinel
src/Users/IlluminateUserRepository.php
https://github.com/cartalyst/sentinel/blob/master/src/Users/IlluminateUserRepository.php
BSD-3-Clause
public function serialize(iterable $links): ?string { $elements = []; foreach ($links as $link) { if ($link->isTemplated()) { continue; } $attributesParts = ['', \sprintf('rel="%s"', implode(' ', $link->getRels()))]; foreach ($link->getAttributes() as $key => $value) { if (\is_array($value)) { foreach ($value as $v) { $attributesParts[] = \sprintf('%s="%s"', $key, preg_replace('/(?<!\\\\)"/', '\"', $v)); } continue; } if (!\is_bool($value)) { $attributesParts[] = \sprintf('%s="%s"', $key, preg_replace('/(?<!\\\\)"/', '\"', $value)); continue; } if (true === $value) { $attributesParts[] = $key; } } $elements[] = \sprintf('<%s>%s', $link->getHref(), implode('; ', $attributesParts)); } return $elements ? implode(',', $elements) : null; }
Builds the value of the "Link" HTTP header. @param LinkInterface[]|\Traversable $links
serialize
php
symfony/web-link
HttpHeaderSerializer.php
https://github.com/symfony/web-link/blob/master/HttpHeaderSerializer.php
MIT
public function __construct($message = '', $code = 0, Exception $previous = null) { if ($message instanceof BigInteger) { $message = $message->toString(); } parent::__construct($message, $code, $previous); }
InvalidPrimeException constructor. @param string $message @param int $code @param \Exception|null $previous
__construct
php
jenssegers/optimus
src/Exceptions/InvalidPrimeException.php
https://github.com/jenssegers/optimus/blob/master/src/Exceptions/InvalidPrimeException.php
MIT
public function deleteTranslations($locales = null): void { if ($locales === null) { $translations = $this->translations()->get(); } else { $locales = (array) $locales; $translations = $this->translations()->whereIn($this->getLocaleKey(), $locales)->get(); } $translations->each->delete(); // we need to manually "reload" the collection built from the relationship // otherwise $this->translations()->get() would NOT be the same as $this->translations $this->load('translations'); }
@param string|array|null $locales The locales to be deleted
deleteTranslations
php
Astrotomic/laravel-translatable
src/Translatable/Translatable.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Translatable.php
MIT
public static function make(array $rules, ?int $format = null, ?string $prefix = null, ?string $suffix = null, ?array $locales = null): array { /** @var RuleFactory $factory */ $factory = app(static::class, compact('format', 'prefix', 'suffix')); $factory->setLocales($locales); return $factory->parse($rules); }
Create a set of validation rules. @param array<mixed> $rules The validation rules to be parsed. @param int|null $format The format to be used for parsing (e.g., 'dot' or 'bracket'). @param string|null $prefix The prefix to be applied to each rule key. @param string|null $suffix The suffix to be applied to each rule key. @param array<string>|null $locales The locales to be used for translating rule attributes. @return array<string,mixed> The parsed validation rules.
make
php
Astrotomic/laravel-translatable
src/Translatable/Validation/RuleFactory.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/RuleFactory.php
MIT
public function setLocales(?array $locales = null): self { /** @var Locales */ $helper = app(Locales::class); if (is_null($locales)) { $this->locales = $helper->all(); return $this; } foreach ($locales as $locale) { if (! $helper->has($locale)) { throw new InvalidArgumentException(sprintf('The locale [%s] is not defined in available locales.', $locale)); } } $this->locales = $locales; return $this; }
Set the locales to be used for translating rule attributes. @param array<string>|null $locales The locales to be set. If null, all available locales will be used. @throws \InvalidArgumentException If a provided locale is not defined in the available locales.
setLocales
php
Astrotomic/laravel-translatable
src/Translatable/Validation/RuleFactory.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/RuleFactory.php
MIT
public function parse(array $input): array { $rules = []; foreach ($input as $key => $value) { if (! $this->isTranslatable($key)) { $rules[$key] = $value; continue; } foreach ($this->locales as $locale) { $rules[$this->formatKey($locale, $key)] = $this->formatRule($locale, $value); } } return $rules; }
Parse the input array of rules, applying format and translation to translatable attributes. @param array<mixed> $input The input array of rules to be parsed. @return array<mixed> The parsed array of rules.
parse
php
Astrotomic/laravel-translatable
src/Translatable/Validation/RuleFactory.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/RuleFactory.php
MIT
protected function formatRule(string $locale, $rule) { if (is_string($rule)) { if (strpos($rule, '|')) { return implode('|', array_map(function (string $rule) use ($locale) { return $this->replacePlaceholder($locale, $rule); }, explode('|', $rule))); } return $this->replacePlaceholder($locale, $rule); } elseif (is_array($rule)) { return array_map(function ($rule) use ($locale) { return $this->formatRule($locale, $rule); }, $rule); } return $rule; }
@param string|string[]|mixed $rule @return string|string[]|mixed
formatRule
php
Astrotomic/laravel-translatable
src/Translatable/Validation/RuleFactory.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/RuleFactory.php
MIT
public function __construct(protected string $model, protected string $field) { if (! class_exists($model)) { throw new \Exception("Class '$model' does not exist."); } if (Str::contains($field, ':')) { [$this->field, $this->locale] = explode(':', $field); } }
@param class-string<Model> $model @param string $field The field to check for existents
__construct
php
Astrotomic/laravel-translatable
src/Translatable/Validation/Rules/TranslatableExists.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/Rules/TranslatableExists.php
MIT
public function ignore(int|string|Model $id, ?string $idColumn = null): self { if ($id instanceof Model) { return $this->ignoreModel($id, $idColumn); } $this->ignore = $id; $this->idColumn = $idColumn ?? ((new $this->model)->getKeyName()); return $this; }
Ignore the given ID during the unique check. @return $this
ignore
php
Astrotomic/laravel-translatable
src/Translatable/Validation/Rules/TranslatableExists.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/Rules/TranslatableExists.php
MIT
public function ignoreModel(Model $model, ?string $idColumn = null): self { $this->idColumn = $idColumn ?? $model->getKeyName(); $this->ignore = $model->{$this->idColumn}; return $this; }
Ignore the given model during the unique check. @return $this
ignoreModel
php
Astrotomic/laravel-translatable
src/Translatable/Validation/Rules/TranslatableExists.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/Rules/TranslatableExists.php
MIT
public function validate(string $attribute, mixed $value, Closure $fail): void { if (! empty($value)) { $exists = $this->model::query() ->whereTranslation($this->field, $value, $this->locale) ->when( $this->ignore, fn (Builder $query) => $query->whereNot($this->idColumn, $this->ignore) ) ->exists(); if (! $exists) { $fail('translatable::validation.translatableExist')->translate(); } } }
Validate the given attribute against the exists constraint, or throw ValidationException. @param string $attribute attribute name @param mixed $value attribute value @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail @throws \Illuminate\Validation\ValidationException
validate
php
Astrotomic/laravel-translatable
src/Translatable/Validation/Rules/TranslatableExists.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/Rules/TranslatableExists.php
MIT
public function __invoke($attribute, $value, $fail): void { $this->validate($attribute, $value, $fail); }
Laravel 9 compatibility (InvokableRule interface) @param string $attribute @param mixed $value @param Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
__invoke
php
Astrotomic/laravel-translatable
src/Translatable/Validation/Rules/TranslatableExists.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/Rules/TranslatableExists.php
MIT
public function validate(string $attribute, mixed $value, Closure $fail): void { if (! empty($value)) { $query = $this->model::whereTranslation($this->field, $value, $this->locale); if ($this->ignore) { $query->whereNot($this->idColumn, $this->ignore); } $exists = $query->exists(); if ($exists) { $fail('translatable::validation.translatableUnique')->translate(); } } }
Validate if the given attribute is unique. @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
validate
php
Astrotomic/laravel-translatable
src/Translatable/Validation/Rules/TranslatableUnique.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/Rules/TranslatableUnique.php
MIT
public function __invoke($attribute, $value, $fail): void { $this->validate($attribute, $value, $fail); }
Laravel 9 compatibility (InvokableRule interface) @param string $attribute @param mixed $value @param Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
__invoke
php
Astrotomic/laravel-translatable
src/Translatable/Validation/Rules/TranslatableUnique.php
https://github.com/Astrotomic/laravel-translatable/blob/master/src/Translatable/Validation/Rules/TranslatableUnique.php
MIT
public function validate_field_unique(): void { $person = new Person(['name' => 'john doe']); $person->save(); $data = [ 'name' => 'john andrew', 'email' => '[email protected]', ]; $validator = Validator::make($data, [ 'name' => ['required', new TranslatableUnique(Person::class, 'name')], ]); self::assertFalse($validator->fails()); }
Validate that the field is unique. @test
validate_field_unique
php
Astrotomic/laravel-translatable
tests/CustomValidationTest.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/CustomValidationTest.php
MIT
public function validate_field_unique_fails(): void { $person = new Person(['name' => 'john doe']); $person->save(); $data = [ 'name:en' => 'john doe', 'email' => '[email protected]', ]; $this->expectException(ValidationException::class); Validator::make($data, [ 'name:en' => ['required', new TranslatableUnique(Person::class, 'name:en')], ])->validate(); }
Validate that the field is unique and fails. @test
validate_field_unique_fails
php
Astrotomic/laravel-translatable
tests/CustomValidationTest.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/CustomValidationTest.php
MIT
public function validate_field_rule_unique_fails(): void { $person = new Person(['name' => 'john doe']); $person->save(); $data = [ 'name:en' => 'john doe', 'email' => '[email protected]', ]; $this->expectException(ValidationException::class); $this->expectExceptionMessage(Lang::get('translatable::validation.translatableUnique', ['attribute' => 'name:en'])); Validator::make($data, [ 'name:en' => ['required', Rule::translatableUnique(Person::class, 'name:en')], ])->validate(); }
Validate that the field rule for unique fails. @test
validate_field_rule_unique_fails
php
Astrotomic/laravel-translatable
tests/CustomValidationTest.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/CustomValidationTest.php
MIT
public function validate_field_rule_unique_pass_on_update_ignore_model(): void { $vegetable = new Vegetable(['name' => 'Potatoes', 'quantity' => '5']); $vegetable->save(); $data = [ 'name:en' => 'Potatoes', 'quantity' => '3', ]; Validator::make($data, [ 'name:en' => ['required', Rule::translatableUnique(Vegetable::class, 'name:en')->ignore($vegetable)], ])->validate(); $this->assertTrue(true); }
Validate that the field rule for unique pass on update, ignoring model @test
validate_field_rule_unique_pass_on_update_ignore_model
php
Astrotomic/laravel-translatable
tests/CustomValidationTest.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/CustomValidationTest.php
MIT
public function validate_field_rule_unique_pass_on_update_ignore_int(): void { $vegetable = new Vegetable(['name' => 'Potatoes', 'quantity' => '5']); $vegetable->save(); $data = [ 'name:en' => 'Potatoes', 'quantity' => '3', ]; Validator::make($data, [ 'name:en' => ['required', Rule::translatableUnique(Vegetable::class, 'name:en')->ignore(1)], ])->validate(); $this->assertTrue(true); }
Validate that the field rule for unique pass on update. @test
validate_field_rule_unique_pass_on_update_ignore_int
php
Astrotomic/laravel-translatable
tests/CustomValidationTest.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/CustomValidationTest.php
MIT
public function validate_field_exists(): void { $person = new Person(['name' => 'john doe']); $person->save(); $data = [ 'name' => 'john andrew', 'email' => '[email protected]', ]; $this->expectException(ValidationException::class); $this->expectExceptionMessage(Lang::get('translatable::validation.translatableExist', ['attribute' => 'name'])); Validator::make($data, [ 'name' => ['required', new TranslatableExists(Person::class, 'name')], ])->validate(); }
Validate that the field exists. @test
validate_field_exists
php
Astrotomic/laravel-translatable
tests/CustomValidationTest.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/CustomValidationTest.php
MIT
public function validate_field_exists_fails(): void { $person = new Person(['name' => 'john doe']); $person->save(); $data = [ 'name' => 'john doe', 'email' => '[email protected]', ]; $validator = Validator::make($data, [ 'name' => ['required', new TranslatableExists(Person::class, 'name')], ]); self::assertFalse($validator->fails()); }
Validate that the field exists and fails. @test
validate_field_exists_fails
php
Astrotomic/laravel-translatable
tests/CustomValidationTest.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/CustomValidationTest.php
MIT
public function validate_field_rule_exists_fails(): void { $person = new Person(['name' => 'john doe']); $person->save(); $data = [ 'name' => 'john doe', 'email' => '[email protected]', ]; $validator = Validator::make($data, [ 'name' => ['required', Rule::translatableExists(Person::class, 'name')], ]); self::assertFalse($validator->fails()); }
Validate that the field rule for exists fails. @test
validate_field_rule_exists_fails
php
Astrotomic/laravel-translatable
tests/CustomValidationTest.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/CustomValidationTest.php
MIT
protected function setUp(): void { parent::setUp(); app('config')->set('translatable.locales', [ 'en', 'de' => [ 'DE', 'AT', ], ]); app(Locales::class)->load(); }
Set up the test environment before each test.
setUp
php
Astrotomic/laravel-translatable
tests/CustomValidationTest.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/CustomValidationTest.php
MIT
public function getNameAttribute($value) { return ucwords($value); }
Mutate name attribute into upper-case. @return string
getNameAttribute
php
Astrotomic/laravel-translatable
tests/Eloquent/Person.php
https://github.com/Astrotomic/laravel-translatable/blob/master/tests/Eloquent/Person.php
MIT
protected function schedule(Schedule $schedule) { // $schedule->command('inspire')->hourly(); }
Define the application's command schedule. @return void
schedule
php
hasinhayder/hydra
app/Console/Kernel.php
https://github.com/hasinhayder/hydra/blob/master/app/Console/Kernel.php
MIT
protected function commands() { $this->load(__DIR__.'/Commands'); require base_path('routes/console.php'); }
Register the commands for the application. @return void
commands
php
hasinhayder/hydra
app/Console/Kernel.php
https://github.com/hasinhayder/hydra/blob/master/app/Console/Kernel.php
MIT
public function register() { $this->reportable(function (Throwable $e) { // }); }
Register the exception handling callbacks for the application. @return void
register
php
hasinhayder/hydra
app/Exceptions/Handler.php
https://github.com/hasinhayder/hydra/blob/master/app/Exceptions/Handler.php
MIT
public function index() { return Role::all(); }
Display a listing of the resource. @return \Illuminate\Http\Response
index
php
hasinhayder/hydra
app/Http/Controllers/RoleController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/RoleController.php
MIT
public function store(Request $request) { $data = $request->validate([ 'name' => 'required', 'slug' => 'required', ]); $existing = Role::where('slug', $data['slug'])->first(); if (! $existing) { $role = Role::create([ 'name' => $data['name'], 'slug' => $data['slug'], ]); return $role; } return response(['error' => 1, 'message' => 'role already exists'], 409); }
Store a newly created resource in storage. @return \Illuminate\Http\Response
store
php
hasinhayder/hydra
app/Http/Controllers/RoleController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/RoleController.php
MIT
public function show(Role $role) { return $role; }
Display the specified resource. @return \App\Models\Role $role
show
php
hasinhayder/hydra
app/Http/Controllers/RoleController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/RoleController.php
MIT
public function update(Request $request, ?Role $role = null) { if (! $role) { return response(['error' => 1, 'message' => 'role doesn\'t exist'], 404); } $role->name = $request->name ?? $role->name; if ($request->slug) { if ($role->slug != 'admin' && $role->slug != 'super-admin') { //don't allow changing the admin slug, because it will make the routes inaccessbile due to faile ability check $role->slug = $request->slug; } } $role->update(); return $role; }
Update the specified resource in storage. @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response|Role
update
php
hasinhayder/hydra
app/Http/Controllers/RoleController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/RoleController.php
MIT
public function destroy(Role $role) { if ($role->slug != 'admin' && $role->slug != 'super-admin') { //don't allow changing the admin slug, because it will make the routes inaccessbile due to faile ability check $role->delete(); return response(['error' => 0, 'message' => 'role has been deleted']); } return response(['error' => 1, 'message' => 'you cannot delete this role'], 422); }
Remove the specified resource from storage. @return \Illuminate\Http\Response
destroy
php
hasinhayder/hydra
app/Http/Controllers/RoleController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/RoleController.php
MIT
public function index() { return User::all(); }
Display a listing of the resource. @return \Illuminate\Http\Response
index
php
hasinhayder/hydra
app/Http/Controllers/UserController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/UserController.php
MIT
public function store(Request $request) { $creds = $request->validate([ 'email' => 'required|email', 'password' => 'required', 'name' => 'nullable|string', ]); $user = User::where('email', $creds['email'])->first(); if ($user) { return response(['error' => 1, 'message' => 'user already exists'], 409); } $user = User::create([ 'email' => $creds['email'], 'password' => Hash::make($creds['password']), 'name' => $creds['name'], ]); $defaultRoleSlug = config('hydra.default_user_role_slug', 'user'); $user->roles()->attach(Role::where('slug', $defaultRoleSlug)->first()); return $user; }
Store a newly created resource in storage. @return \Illuminate\Http\Response
store
php
hasinhayder/hydra
app/Http/Controllers/UserController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/UserController.php
MIT
public function login(Request $request) { $creds = $request->validate([ 'email' => 'required|email', 'password' => 'required', ]); $user = User::where('email', $creds['email'])->first(); if (! $user || ! Hash::check($request->password, $user->password)) { return response(['error' => 1, 'message' => 'invalid credentials'], 401); } if (config('hydra.delete_previous_access_tokens_on_login', false)) { $user->tokens()->delete(); } $roles = $user->roles->pluck('slug')->all(); $plainTextToken = $user->createToken('hydra-api-token', $roles)->plainTextToken; return response(['error' => 0, 'id' => $user->id, 'name' => $user->name, 'token' => $plainTextToken], 200); }
Authenticate an user and dispatch token. @return \Illuminate\Http\Response
login
php
hasinhayder/hydra
app/Http/Controllers/UserController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/UserController.php
MIT
public function show(User $user) { return $user; }
Display the specified resource. @return \App\Models\User $user
show
php
hasinhayder/hydra
app/Http/Controllers/UserController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/UserController.php
MIT
public function update(Request $request, User $user) { $user->name = $request->name ?? $user->name; $user->email = $request->email ?? $user->email; $user->password = $request->password ? Hash::make($request->password) : $user->password; $user->email_verified_at = $request->email_verified_at ?? $user->email_verified_at; //check if the logged in user is updating it's own record $loggedInUser = $request->user(); if ($loggedInUser->id == $user->id) { $user->update(); } elseif ($loggedInUser->tokenCan('admin') || $loggedInUser->tokenCan('super-admin')) { $user->update(); } else { throw new MissingAbilityException('Not Authorized'); } return $user; }
Update the specified resource in storage. @return User @throws MissingAbilityException
update
php
hasinhayder/hydra
app/Http/Controllers/UserController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/UserController.php
MIT
public function destroy(User $user) { $adminRole = Role::where('slug', 'admin')->first(); $userRoles = $user->roles; if ($userRoles->contains($adminRole)) { //the current user is admin, then if there is only one admin - don't delete $numberOfAdmins = Role::where('slug', 'admin')->first()->users()->count(); if ($numberOfAdmins == 1) { return response(['error' => 1, 'message' => 'Create another admin before deleting this only admin user'], 409); } } $user->delete(); return response(['error' => 0, 'message' => 'user deleted']); }
Remove the specified resource from storage. @return \Illuminate\Http\Response
destroy
php
hasinhayder/hydra
app/Http/Controllers/UserController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/UserController.php
MIT
public function index(User $user) { return $user->load('roles'); }
Display a listing of the resource. @return \App\Models\User $user
index
php
hasinhayder/hydra
app/Http/Controllers/UserRoleController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/UserRoleController.php
MIT
public function store(Request $request, User $user) { $data = $request->validate([ 'role_id' => 'required|integer', ]); $role = Role::find($data['role_id']); if (! $user->roles()->find($data['role_id'])) { $user->roles()->attach($role); } return $user->load('roles'); }
Store a newly created resource in storage. @return \App\Models\User $user
store
php
hasinhayder/hydra
app/Http/Controllers/UserRoleController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/UserRoleController.php
MIT
public function destroy(User $user, Role $role) { $user->roles()->detach($role); return $user->load('roles'); }
Remove the specified resource from storage. @return \App\Models\User $user
destroy
php
hasinhayder/hydra
app/Http/Controllers/UserRoleController.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Controllers/UserRoleController.php
MIT
protected function redirectTo($request) { if (! $request->expectsJson()) { return route('login'); } }
Get the path the user should be redirected to when they are not authenticated. @param \Illuminate\Http\Request $request @return string|null
redirectTo
php
hasinhayder/hydra
app/Http/Middleware/Authenticate.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Middleware/Authenticate.php
MIT
public function handle(Request $request, Closure $next) { return $next($request); }
Handle an incoming request. @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
handle
php
hasinhayder/hydra
app/Http/Middleware/HydraLog.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Middleware/HydraLog.php
MIT
public function handle(Request $request, Closure $next, ...$guards) { $guards = empty($guards) ? [null] : $guards; foreach ($guards as $guard) { if (Auth::guard($guard)->check()) { return redirect(RouteServiceProvider::HOME); } } return $next($request); }
Handle an incoming request. @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next @param string|null ...$guards @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
handle
php
hasinhayder/hydra
app/Http/Middleware/RedirectIfAuthenticated.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Middleware/RedirectIfAuthenticated.php
MIT
public function hosts() { return [ $this->allSubdomainsOfApplicationUrl(), ]; }
Get the host patterns that should be trusted. @return array<int, string|null>
hosts
php
hasinhayder/hydra
app/Http/Middleware/TrustHosts.php
https://github.com/hasinhayder/hydra/blob/master/app/Http/Middleware/TrustHosts.php
MIT
public function boot() { $this->registerPolicies(); // }
Register any authentication / authorization services. @return void
boot
php
hasinhayder/hydra
app/Providers/AuthServiceProvider.php
https://github.com/hasinhayder/hydra/blob/master/app/Providers/AuthServiceProvider.php
MIT
public function boot() { Broadcast::routes(); require base_path('routes/channels.php'); }
Bootstrap any application services. @return void
boot
php
hasinhayder/hydra
app/Providers/BroadcastServiceProvider.php
https://github.com/hasinhayder/hydra/blob/master/app/Providers/BroadcastServiceProvider.php
MIT
public function shouldDiscoverEvents() { return false; }
Determine if events and listeners should be automatically discovered. @return bool
shouldDiscoverEvents
php
hasinhayder/hydra
app/Providers/EventServiceProvider.php
https://github.com/hasinhayder/hydra/blob/master/app/Providers/EventServiceProvider.php
MIT