idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
21,100
protected function newHasManyThrough ( Builder $ query , Model $ farParent , Model $ throughParent , $ firstKey , $ secondKey , $ localKey , $ secondLocalKey ) { return new HasManyThrough ( $ query , $ farParent , $ throughParent , $ firstKey , $ secondKey , $ localKey , $ secondLocalKey ) ; }
Instantiate a new HasManyThrough relationship .
21,101
protected function newMorphMany ( Builder $ query , Model $ parent , $ type , $ id , $ localKey ) { return new MorphMany ( $ query , $ parent , $ type , $ id , $ localKey ) ; }
Instantiate a new MorphMany relationship .
21,102
protected function newMorphToMany ( Builder $ query , Model $ parent , $ name , $ table , $ foreignPivotKey , $ relatedPivotKey , $ parentKey , $ relatedKey , $ relationName = null , $ inverse = false ) { return new MorphToMany ( $ query , $ parent , $ name , $ table , $ foreignPivotKey , $ relatedPivotKey , $ parentKe...
Instantiate a new MorphToMany relationship .
21,103
public function parseConfiguration ( $ config ) { if ( is_string ( $ config ) ) { $ config = [ 'url' => $ config ] ; } $ url = $ config [ 'url' ] ?? null ; $ config = Arr :: except ( $ config , 'url' ) ; if ( ! $ url ) { return $ config ; } $ parsedUrl = $ this -> parseUrl ( $ url ) ; return array_merge ( $ config , $ ...
Parse the database configuration hydrating options using a database configuration URL if possible .
21,104
protected function getPrimaryOptions ( $ url ) { return array_filter ( [ 'driver' => $ this -> getDriver ( $ url ) , 'database' => $ this -> getDatabase ( $ url ) , 'host' => $ url [ 'host' ] ?? null , 'port' => $ url [ 'port' ] ?? null , 'username' => $ url [ 'user' ] ?? null , 'password' => $ url [ 'pass' ] ?? null ,...
Get the primary database connection options .
21,105
protected function getQueryOptions ( $ url ) { $ queryString = $ url [ 'query' ] ?? null ; if ( ! $ queryString ) { return [ ] ; } $ query = [ ] ; parse_str ( $ queryString , $ query ) ; return $ this -> parseStringsToNativeTypes ( $ query ) ; }
Get all of the additional database options from the query string .
21,106
protected function parseUrl ( $ url ) { $ url = preg_replace ( '#^(sqlite3?):///#' , '$1://null/' , $ url ) ; $ parsedUrl = parse_url ( $ url ) ; if ( $ parsedUrl === false ) { throw new InvalidArgumentException ( 'The database configuration URL is malformed.' ) ; } return $ this -> parseStringsToNativeTypes ( array_ma...
Parse the string URL to an array of components .
21,107
protected function parseStringsToNativeTypes ( $ value ) { if ( is_array ( $ value ) ) { return array_map ( [ $ this , 'parseStringsToNativeTypes' ] , $ value ) ; } if ( ! is_string ( $ value ) ) { return $ value ; } $ parsedValue = json_decode ( $ value , true ) ; if ( json_last_error ( ) === JSON_ERROR_NONE ) { retur...
Convert string casted values to their native types .
21,108
protected function fatalExceptionFromError ( array $ error , $ traceOffset = null ) { return new FatalErrorException ( $ error [ 'message' ] , $ error [ 'type' ] , 0 , $ error [ 'file' ] , $ error [ 'line' ] , $ traceOffset ) ; }
Create a new fatal exception instance from an error array .
21,109
protected function compileAggregate ( Builder $ query , $ aggregate ) { $ column = $ this -> columnize ( $ aggregate [ 'columns' ] ) ; if ( $ query -> distinct && $ column !== '*' ) { $ column = 'distinct ' . $ column ; } return 'select ' . $ aggregate [ 'function' ] . '(' . $ column . ') as aggregate' ; }
Compile an aggregated select clause .
21,110
protected function concatenateWhereClauses ( $ query , $ sql ) { $ conjunction = $ query instanceof JoinClause ? 'on' : 'where' ; return $ conjunction . ' ' . $ this -> removeLeadingBoolean ( implode ( ' ' , $ sql ) ) ; }
Format the where clause statements into one string .
21,111
protected function whereNotInRaw ( Builder $ query , $ where ) { if ( ! empty ( $ where [ 'values' ] ) ) { return $ this -> wrap ( $ where [ 'column' ] ) . ' not in (' . implode ( ', ' , $ where [ 'values' ] ) . ')' ; } return '1 = 1' ; }
Compile a where not in raw clause .
21,112
protected function whereNotInSub ( Builder $ query , $ where ) { return $ this -> wrap ( $ where [ 'column' ] ) . ' not in (' . $ this -> compileSelect ( $ where [ 'query' ] ) . ')' ; }
Compile a where not in sub - select clause .
21,113
protected function whereInRaw ( Builder $ query , $ where ) { if ( ! empty ( $ where [ 'values' ] ) ) { return $ this -> wrap ( $ where [ 'column' ] ) . ' in (' . implode ( ', ' , $ where [ 'values' ] ) . ')' ; } return '0 = 1' ; }
Compile a where in raw clause .
21,114
protected function whereColumn ( Builder $ query , $ where ) { return $ this -> wrap ( $ where [ 'first' ] ) . ' ' . $ where [ 'operator' ] . ' ' . $ this -> wrap ( $ where [ 'second' ] ) ; }
Compile a where clause comparing two columns ..
21,115
protected function whereSub ( Builder $ query , $ where ) { $ select = $ this -> compileSelect ( $ where [ 'query' ] ) ; return $ this -> wrap ( $ where [ 'column' ] ) . ' ' . $ where [ 'operator' ] . " ($select)" ; }
Compile a where condition with a sub - select .
21,116
protected function whereRowValues ( Builder $ query , $ where ) { $ columns = $ this -> columnize ( $ where [ 'columns' ] ) ; $ values = $ this -> parameterize ( $ where [ 'values' ] ) ; return '(' . $ columns . ') ' . $ where [ 'operator' ] . ' (' . $ values . ')' ; }
Compile a where row values condition .
21,117
protected function whereJsonBoolean ( Builder $ query , $ where ) { $ column = $ this -> wrapJsonBooleanSelector ( $ where [ 'column' ] ) ; $ value = $ this -> wrapJsonBooleanValue ( $ this -> parameter ( $ where [ 'value' ] ) ) ; return $ column . ' ' . $ where [ 'operator' ] . ' ' . $ value ; }
Compile a where JSON boolean clause .
21,118
protected function whereJsonContains ( Builder $ query , $ where ) { $ not = $ where [ 'not' ] ? 'not ' : '' ; return $ not . $ this -> compileJsonContains ( $ where [ 'column' ] , $ this -> parameter ( $ where [ 'value' ] ) ) ; }
Compile a where JSON contains clause .
21,119
protected function whereJsonLength ( Builder $ query , $ where ) { return $ this -> compileJsonLength ( $ where [ 'column' ] , $ where [ 'operator' ] , $ this -> parameter ( $ where [ 'value' ] ) ) ; }
Compile a where JSON length clause .
21,120
protected function compileHaving ( array $ having ) { if ( $ having [ 'type' ] === 'Raw' ) { return $ having [ 'boolean' ] . ' ' . $ having [ 'sql' ] ; } elseif ( $ having [ 'type' ] === 'between' ) { return $ this -> compileHavingBetween ( $ having ) ; } return $ this -> compileBasicHaving ( $ having ) ; }
Compile a single having clause .
21,121
protected function compileHavingBetween ( $ having ) { $ between = $ having [ 'not' ] ? 'not between' : 'between' ; $ column = $ this -> wrap ( $ having [ 'column' ] ) ; $ min = $ this -> parameter ( head ( $ having [ 'values' ] ) ) ; $ max = $ this -> parameter ( last ( $ having [ 'values' ] ) ) ; return $ having [ 'b...
Compile a between having clause .
21,122
protected function compileOrdersToArray ( Builder $ query , $ orders ) { return array_map ( function ( $ order ) { return $ order [ 'sql' ] ?? $ this -> wrap ( $ order [ 'column' ] ) . ' ' . $ order [ 'direction' ] ; } , $ orders ) ; }
Compile the query orders to an array .
21,123
protected function compileUnionAggregate ( Builder $ query ) { $ sql = $ this -> compileAggregate ( $ query , $ query -> aggregate ) ; $ query -> aggregate = null ; return $ sql . ' from (' . $ this -> compileSelect ( $ query ) . ') as ' . $ this -> wrapTable ( 'temp_table' ) ; }
Compile a union aggregate query into SQL .
21,124
protected function wrapJsonFieldAndPath ( $ column ) { $ parts = explode ( '->' , $ column , 2 ) ; $ field = $ this -> wrap ( $ parts [ 0 ] ) ; $ path = count ( $ parts ) > 1 ? ', ' . $ this -> wrapJsonPath ( $ parts [ 1 ] , '->' ) : '' ; return [ $ field , $ path ] ; }
Split the given JSON selector into the field and the optional path and wrap them separately .
21,125
public function serverShouldRun ( Event $ event , DateTimeInterface $ time ) { return $ this -> schedulingMutex -> create ( $ event , $ time ) ; }
Determine if the server is allowed to run this event .
21,126
public function useCache ( $ store ) { if ( $ this -> eventMutex instanceof CacheEventMutex ) { $ this -> eventMutex -> useStore ( $ store ) ; } if ( $ this -> schedulingMutex instanceof CacheSchedulingMutex ) { $ this -> schedulingMutex -> useStore ( $ store ) ; } return $ this ; }
Specify the cache store that should be used to store mutexes .
21,127
public function authorize ( $ ability , $ arguments = [ ] ) { [ $ ability , $ arguments ] = $ this -> parseAbilityAndArguments ( $ ability , $ arguments ) ; return app ( Gate :: class ) -> authorize ( $ ability , $ arguments ) ; }
Authorize a given action for the current user .
21,128
public function authorizeResource ( $ model , $ parameter = null , array $ options = [ ] , $ request = null ) { $ parameter = $ parameter ? : Str :: snake ( class_basename ( $ model ) ) ; $ middleware = [ ] ; foreach ( $ this -> resourceAbilityMap ( ) as $ method => $ ability ) { $ modelName = in_array ( $ method , $ t...
Authorize a resource action based on the incoming request .
21,129
protected function addSslOptions ( $ dsn , array $ config ) { foreach ( [ 'sslmode' , 'sslcert' , 'sslkey' , 'sslrootcert' ] as $ option ) { if ( isset ( $ config [ $ option ] ) ) { $ dsn .= ";{$option}={$config[$option]}" ; } } return $ dsn ; }
Add the SSL options to the DSN .
21,130
protected function processInsertGetIdForOdbc ( Connection $ connection ) { $ result = $ connection -> selectFromWriteConnection ( 'SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS int) AS insertid' ) ; if ( ! $ result ) { throw new Exception ( 'Unable to retrieve lastInsertID for ODBC.' ) ; } $ row = $ result [ 0 ...
Process an insert get ID query for ODBC .
21,131
protected function runSingleServerEvent ( $ event ) { if ( $ this -> schedule -> serverShouldRun ( $ event , $ this -> startedAt ) ) { $ this -> runEvent ( $ event ) ; } else { $ this -> line ( '<info>Skipping command (has already run on another server):</info> ' . $ event -> getSummaryForDisplay ( ) ) ; } }
Run the given single server event .
21,132
protected function addLookups ( $ route ) { if ( $ name = $ route -> getName ( ) ) { $ this -> nameList [ $ name ] = $ route ; } $ action = $ route -> getAction ( ) ; if ( isset ( $ action [ 'controller' ] ) ) { $ this -> addToActionList ( $ action , $ route ) ; } }
Add the route to any look - up tables if necessary .
21,133
public function refreshNameLookups ( ) { $ this -> nameList = [ ] ; foreach ( $ this -> allRoutes as $ route ) { if ( $ route -> getName ( ) ) { $ this -> nameList [ $ route -> getName ( ) ] = $ route ; } } }
Refresh the name look - up table .
21,134
public function refreshActionLookups ( ) { $ this -> actionList = [ ] ; foreach ( $ this -> allRoutes as $ route ) { if ( isset ( $ route -> getAction ( ) [ 'controller' ] ) ) { $ this -> addToActionList ( $ route -> getAction ( ) , $ route ) ; } } }
Refresh the action look - up table .
21,135
public function get ( $ method = null ) { return is_null ( $ method ) ? $ this -> getRoutes ( ) : Arr :: get ( $ this -> routes , $ method , [ ] ) ; }
Get routes from the collection by method .
21,136
public function bind ( Request $ request ) { $ this -> compileRoute ( ) ; $ this -> parameters = ( new RouteParameterBinder ( $ this ) ) -> parameters ( $ request ) ; $ this -> originalParameters = $ this -> parameters ; return $ this ; }
Bind the route to a given request for execution .
21,137
public function where ( $ name , $ expression = null ) { foreach ( $ this -> parseWhere ( $ name , $ expression ) as $ name => $ expression ) { $ this -> wheres [ $ name ] = $ expression ; } return $ this ; }
Set a regular expression requirement on the route .
21,138
protected function whereArray ( array $ wheres ) { foreach ( $ wheres as $ name => $ expression ) { $ this -> where ( $ name , $ expression ) ; } return $ this ; }
Set a list of regular expression requirements on the route .
21,139
public function domain ( $ domain = null ) { if ( is_null ( $ domain ) ) { return $ this -> getDomain ( ) ; } $ this -> action [ 'domain' ] = $ domain ; return $ this ; }
Get or set the domain for the route .
21,140
public function named ( ... $ patterns ) { if ( is_null ( $ routeName = $ this -> getName ( ) ) ) { return false ; } foreach ( $ patterns as $ pattern ) { if ( Str :: is ( $ pattern , $ routeName ) ) { return true ; } } return false ; }
Determine whether the route s name matches the given patterns .
21,141
public function uses ( $ action ) { $ action = is_string ( $ action ) ? $ this -> addGroupNamespaceToStringUses ( $ action ) : $ action ; return $ this -> setAction ( array_merge ( $ this -> action , $ this -> parseAction ( [ 'uses' => $ action , 'controller' => $ action , ] ) ) ) ; }
Set the handler for the route .
21,142
protected function addGroupNamespaceToStringUses ( $ action ) { $ groupStack = last ( $ this -> router -> getGroupStack ( ) ) ; if ( isset ( $ groupStack [ 'namespace' ] ) && strpos ( $ action , '\\' ) !== 0 ) { return $ groupStack [ 'namespace' ] . '\\' . $ action ; } return $ action ; }
Parse a string based action for the uses fluent method .
21,143
public function gatherMiddleware ( ) { if ( ! is_null ( $ this -> computedMiddleware ) ) { return $ this -> computedMiddleware ; } $ this -> computedMiddleware = [ ] ; return $ this -> computedMiddleware = array_unique ( array_merge ( $ this -> middleware ( ) , $ this -> controllerMiddleware ( ) ) , SORT_REGULAR ) ; }
Get all middleware including the ones from the controller .
21,144
public function controllerMiddleware ( ) { if ( ! $ this -> isControllerAction ( ) ) { return [ ] ; } return $ this -> controllerDispatcher ( ) -> getMiddleware ( $ this -> getController ( ) , $ this -> getControllerMethod ( ) ) ; }
Get the middleware for the route s controller .
21,145
public function controllerDispatcher ( ) { if ( $ this -> container -> bound ( ControllerDispatcherContract :: class ) ) { return $ this -> container -> make ( ControllerDispatcherContract :: class ) ; } return new ControllerDispatcher ( $ this -> container ) ; }
Get the dispatcher for the route s controller .
21,146
public static function parentPlaceholder ( $ section = '' ) { if ( ! isset ( static :: $ parentPlaceholder [ $ section ] ) ) { static :: $ parentPlaceholder [ $ section ] = '##parent-placeholder-' . sha1 ( $ section ) . '##' ; } return static :: $ parentPlaceholder [ $ section ] ; }
Get the parent placeholder for the current request .
21,147
protected function promptForProviderOrTag ( ) { $ choice = $ this -> choice ( "Which provider or tag's files would you like to publish?" , $ choices = $ this -> publishableChoices ( ) ) ; if ( $ choice == $ choices [ 0 ] || is_null ( $ choice ) ) { return ; } $ this -> parseChoice ( $ choice ) ; }
Prompt for which provider or tag to publish .
21,148
protected function publishableChoices ( ) { return array_merge ( [ '<comment>Publish files from all providers and tags listed below</comment>' ] , preg_filter ( '/^/' , '<comment>Provider: </comment>' , Arr :: sort ( ServiceProvider :: publishableProviders ( ) ) ) , preg_filter ( '/^/' , '<comment>Tag: </comment>' , Ar...
The choices available via the prompt .
21,149
protected function publishTag ( $ tag ) { foreach ( $ this -> pathsToPublish ( $ tag ) as $ from => $ to ) { $ this -> publishItem ( $ from , $ to ) ; } }
Publishes the assets for a tag .
21,150
protected function publishItem ( $ from , $ to ) { if ( $ this -> files -> isFile ( $ from ) ) { return $ this -> publishFile ( $ from , $ to ) ; } elseif ( $ this -> files -> isDirectory ( $ from ) ) { return $ this -> publishDirectory ( $ from , $ to ) ; } $ this -> error ( "Can't locate path: <{$from}>" ) ; }
Publish the given item from and to the given location .
21,151
protected function moveManagedFiles ( $ manager ) { foreach ( $ manager -> listContents ( 'from://' , true ) as $ file ) { if ( $ file [ 'type' ] === 'file' && ( ! $ manager -> has ( 'to://' . $ file [ 'path' ] ) || $ this -> option ( 'force' ) ) ) { $ manager -> put ( 'to://' . $ file [ 'path' ] , $ manager -> read ( ...
Move all the files in the given MountManager .
21,152
protected function resolveHandler ( $ job , $ command ) { $ handler = $ this -> dispatcher -> getCommandHandler ( $ command ) ? : null ; if ( $ handler ) { $ this -> setJobInstanceIfNecessary ( $ job , $ handler ) ; } return $ handler ; }
Resolve the handler for the given command .
21,153
protected function resolveJob ( $ payload , $ queue ) { return new SyncJob ( $ this -> container , $ payload , $ this -> connectionName , $ queue ) ; }
Resolve a Sync job instance .
21,154
protected function getGateArguments ( $ request , $ models ) { if ( is_null ( $ models ) ) { return [ ] ; } return collect ( $ models ) -> map ( function ( $ model ) use ( $ request ) { return $ model instanceof Model ? $ model : $ this -> getModel ( $ request , $ model ) ; } ) -> all ( ) ; }
Get the arguments parameter for the gate .
21,155
protected function getModel ( $ request , $ model ) { if ( $ this -> isClassName ( $ model ) ) { return trim ( $ model ) ; } else { return $ request -> route ( $ model , null ) ? : ( ( preg_match ( "/^['\"](.*)['\"]$/" , trim ( $ model ) , $ matches ) ) ? $ matches [ 1 ] : null ) ; } }
Get the model to authorize .
21,156
public function startPush ( $ section , $ content = '' ) { if ( $ content === '' ) { if ( ob_start ( ) ) { $ this -> pushStack [ ] = $ section ; } } else { $ this -> extendPush ( $ section , $ content ) ; } }
Start injecting content into a push section .
21,157
protected function extendPush ( $ section , $ content ) { if ( ! isset ( $ this -> pushes [ $ section ] ) ) { $ this -> pushes [ $ section ] = [ ] ; } if ( ! isset ( $ this -> pushes [ $ section ] [ $ this -> renderCount ] ) ) { $ this -> pushes [ $ section ] [ $ this -> renderCount ] = $ content ; } else { $ this -> p...
Append content to a given push section .
21,158
public function startPrepend ( $ section , $ content = '' ) { if ( $ content === '' ) { if ( ob_start ( ) ) { $ this -> pushStack [ ] = $ section ; } } else { $ this -> extendPrepend ( $ section , $ content ) ; } }
Start prepending content into a push section .
21,159
public function stopPrepend ( ) { if ( empty ( $ this -> pushStack ) ) { throw new InvalidArgumentException ( 'Cannot end a prepend operation without first starting one.' ) ; } return tap ( array_pop ( $ this -> pushStack ) , function ( $ last ) { $ this -> extendPrepend ( $ last , ob_get_clean ( ) ) ; } ) ; }
Stop prepending content into a push section .
21,160
protected function extendPrepend ( $ section , $ content ) { if ( ! isset ( $ this -> prepends [ $ section ] ) ) { $ this -> prepends [ $ section ] = [ ] ; } if ( ! isset ( $ this -> prepends [ $ section ] [ $ this -> renderCount ] ) ) { $ this -> prepends [ $ section ] [ $ this -> renderCount ] = $ content ; } else { ...
Prepend content to a given stack .
21,161
public function register ( ) { $ this -> registered = true ; return $ this -> registrar -> register ( $ this -> name , $ this -> controller , $ this -> options ) ; }
Register the resource route .
21,162
protected static function callBoundMethod ( $ container , $ callback , $ default ) { if ( ! is_array ( $ callback ) ) { return $ default instanceof Closure ? $ default ( ) : $ default ; } $ method = static :: normalizeMethod ( $ callback ) ; if ( $ container -> hasMethodBinding ( $ method ) ) { return $ container -> ca...
Call a method that has been bound to the container .
21,163
protected static function addDependencyForCallParameter ( $ container , $ parameter , array & $ parameters , & $ dependencies ) { if ( array_key_exists ( $ parameter -> name , $ parameters ) ) { $ dependencies [ ] = $ parameters [ $ parameter -> name ] ; unset ( $ parameters [ $ parameter -> name ] ) ; } elseif ( $ par...
Get the dependency for the given call parameter .
21,164
public function attribute ( $ key , $ value ) { if ( ! in_array ( $ key , $ this -> allowedAttributes ) ) { throw new InvalidArgumentException ( "Attribute [{$key}] does not exist." ) ; } $ this -> attributes [ Arr :: get ( $ this -> aliases , $ key , $ key ) ] = $ value ; return $ this ; }
Set the value for a given attribute .
21,165
protected function registerRoute ( $ method , $ uri , $ action = null ) { if ( ! is_array ( $ action ) ) { $ action = array_merge ( $ this -> attributes , $ action ? [ 'uses' => $ action ] : [ ] ) ; } return $ this -> router -> { $ method } ( $ uri , $ this -> compileAction ( $ action ) ) ; }
Register a new route with the router .
21,166
protected function compileAction ( $ action ) { if ( is_null ( $ action ) ) { return $ this -> attributes ; } if ( is_string ( $ action ) || $ action instanceof Closure ) { $ action = [ 'uses' => $ action ] ; } return array_merge ( $ this -> attributes , $ action ) ; }
Compile the action into an array including the attributes .
21,167
protected function compileViews ( Collection $ views ) { $ compiler = $ this -> laravel [ 'view' ] -> getEngineResolver ( ) -> resolve ( 'blade' ) -> getCompiler ( ) ; $ views -> map ( function ( SplFileInfo $ file ) use ( $ compiler ) { $ compiler -> compile ( $ file -> getRealPath ( ) ) ; } ) ; }
Compile the given view files .
21,168
protected function bladeFilesIn ( array $ paths ) { return collect ( Finder :: create ( ) -> in ( $ paths ) -> exclude ( 'vendor' ) -> name ( '*.blade.php' ) -> files ( ) ) ; }
Get the Blade files in the given path .
21,169
protected function paths ( ) { $ finder = $ this -> laravel [ 'view' ] -> getFinder ( ) ; return collect ( $ finder -> getPaths ( ) ) -> merge ( collect ( $ finder -> getHints ( ) ) -> flatten ( ) ) ; }
Get all of the possible view paths .
21,170
protected function resolveMaxAttempts ( $ request , $ maxAttempts ) { if ( Str :: contains ( $ maxAttempts , '|' ) ) { $ maxAttempts = explode ( '|' , $ maxAttempts , 2 ) [ $ request -> user ( ) ? 1 : 0 ] ; } if ( ! is_numeric ( $ maxAttempts ) && $ request -> user ( ) ) { $ maxAttempts = $ request -> user ( ) -> { $ m...
Resolve the number of attempts if the user is authenticated or not .
21,171
protected function buildException ( $ key , $ maxAttempts ) { $ retryAfter = $ this -> getTimeUntilNextRetry ( $ key ) ; $ headers = $ this -> getHeaders ( $ maxAttempts , $ this -> calculateRemainingAttempts ( $ key , $ maxAttempts , $ retryAfter ) , $ retryAfter ) ; return new ThrottleRequestsException ( 'Too Many At...
Create a too many attempts exception .
21,172
protected function getHeaders ( $ maxAttempts , $ remainingAttempts , $ retryAfter = null ) { $ headers = [ 'X-RateLimit-Limit' => $ maxAttempts , 'X-RateLimit-Remaining' => $ remainingAttempts , ] ; if ( ! is_null ( $ retryAfter ) ) { $ headers [ 'Retry-After' ] = $ retryAfter ; $ headers [ 'X-RateLimit-Reset' ] = $ t...
Get the limit headers information .
21,173
protected function calculateRemainingAttempts ( $ key , $ maxAttempts , $ retryAfter = null ) { if ( is_null ( $ retryAfter ) ) { return $ this -> limiter -> retriesLeft ( $ key , $ maxAttempts ) ; } return 0 ; }
Calculate the number of remaining attempts .
21,174
public function buildCommand ( Event $ event ) { if ( $ event -> runInBackground ) { return $ this -> buildBackgroundCommand ( $ event ) ; } return $ this -> buildForegroundCommand ( $ event ) ; }
Build the command for the given event .
21,175
protected static function name ( $ expression ) { if ( trim ( $ expression ) === '' ) { throw new InvalidArgumentException ( 'Console command definition is empty.' ) ; } if ( ! preg_match ( '/[^\s]+/' , $ expression , $ matches ) ) { throw new InvalidArgumentException ( 'Unable to determine command name from signature....
Extract the name of the command from the expression .
21,176
protected function userFromRecaller ( $ recaller ) { if ( ! $ recaller -> valid ( ) || $ this -> recallAttempted ) { return ; } $ this -> recallAttempted = true ; $ this -> viaRemember = ! is_null ( $ user = $ this -> provider -> retrieveByToken ( $ recaller -> id ( ) , $ recaller -> token ( ) ) ) ; return $ user ; }
Pull a user from the repository by its remember me cookie token .
21,177
protected function recaller ( ) { if ( is_null ( $ this -> request ) ) { return ; } if ( $ recaller = $ this -> request -> cookies -> get ( $ this -> getRecallerName ( ) ) ) { return new Recaller ( $ recaller ) ; } }
Get the decrypted recaller cookie for the request .
21,178
public function once ( array $ credentials = [ ] ) { $ this -> fireAttemptEvent ( $ credentials ) ; if ( $ this -> validate ( $ credentials ) ) { $ this -> setUser ( $ this -> lastAttempted ) ; return true ; } return false ; }
Log a user into the application without sessions or cookies .
21,179
protected function clearUserDataFromStorage ( ) { $ this -> session -> remove ( $ this -> getName ( ) ) ; if ( ! is_null ( $ this -> recaller ( ) ) ) { $ this -> getCookieJar ( ) -> queue ( $ this -> getCookieJar ( ) -> forget ( $ this -> getRecallerName ( ) ) ) ; } }
Remove the user data from the session and cookies .
21,180
protected function cycleRememberToken ( AuthenticatableContract $ user ) { $ user -> setRememberToken ( $ token = Str :: random ( 60 ) ) ; $ this -> provider -> updateRememberToken ( $ user , $ token ) ; }
Refresh the remember me token for the user .
21,181
public function attempting ( $ callback ) { if ( isset ( $ this -> events ) ) { $ this -> events -> listen ( Events \ Attempting :: class , $ callback ) ; } }
Register an authentication attempt event listener .
21,182
protected function fireOtherDeviceLogoutEvent ( $ user ) { if ( isset ( $ this -> events ) ) { $ this -> events -> dispatch ( new Events \ OtherDeviceLogout ( $ this -> name , $ user ) ) ; } }
Fire the other device logout event if the dispatcher is set .
21,183
protected function fireFailedEvent ( $ user , array $ credentials ) { if ( isset ( $ this -> events ) ) { $ this -> events -> dispatch ( new Events \ Failed ( $ this -> name , $ user , $ credentials ) ) ; } }
Fire the failed authentication attempt event with the given arguments .
21,184
protected function newModelQuery ( $ model = null ) { return is_null ( $ model ) ? $ this -> createModel ( ) -> newQuery ( ) : $ model -> newQuery ( ) ; }
Get a new query builder for the model instance .
21,185
protected function hasValidJson ( $ jsonError ) { if ( $ jsonError === JSON_ERROR_NONE ) { return true ; } return $ this -> hasEncodingOption ( JSON_PARTIAL_OUTPUT_ON_ERROR ) && in_array ( $ jsonError , [ JSON_ERROR_RECURSION , JSON_ERROR_INF_OR_NAN , JSON_ERROR_UNSUPPORTED_TYPE , ] ) ; }
Determine if an error occurred during JSON encoding .
21,186
public function getJobRetryDelay ( $ job ) { if ( ! method_exists ( $ job , 'retryAfter' ) && ! isset ( $ job -> retryAfter ) ) { return ; } $ delay = $ job -> retryAfter ?? $ job -> retryAfter ( ) ; return $ delay instanceof DateTimeInterface ? $ this -> secondsUntil ( $ delay ) : $ delay ; }
Get the retry delay for an object - based queue handler .
21,187
public function getJobExpiration ( $ job ) { if ( ! method_exists ( $ job , 'retryUntil' ) && ! isset ( $ job -> timeoutAt ) ) { return ; } $ expiration = $ job -> timeoutAt ?? $ job -> retryUntil ( ) ; return $ expiration instanceof DateTimeInterface ? $ expiration -> getTimestamp ( ) : $ expiration ; }
Get the expiration timestamp for an object - based queue handler .
21,188
protected function withCreatePayloadHooks ( $ queue , array $ payload ) { if ( ! empty ( static :: $ createPayloadCallbacks ) ) { foreach ( static :: $ createPayloadCallbacks as $ callback ) { $ payload = array_merge ( $ payload , call_user_func ( $ callback , $ this -> getConnectionName ( ) , $ queue , $ payload ) ) ;...
Create the given payload using any registered payload hooks .
21,189
protected function addModifiers ( $ sql , Blueprint $ blueprint , Fluent $ column ) { foreach ( $ this -> modifiers as $ modifier ) { if ( method_exists ( $ this , $ method = "modify{$modifier}" ) ) { $ sql .= $ this -> { $ method } ( $ blueprint , $ column ) ; } } return $ sql ; }
Add the column modifiers to the definition .
21,190
protected function getCommandByName ( Blueprint $ blueprint , $ name ) { $ commands = $ this -> getCommandsByName ( $ blueprint , $ name ) ; if ( count ( $ commands ) > 0 ) { return reset ( $ commands ) ; } }
Get the primary key command if it exists on the blueprint .
21,191
public function getDoctrineTableDiff ( Blueprint $ blueprint , SchemaManager $ schema ) { $ table = $ this -> getTablePrefix ( ) . $ blueprint -> getTable ( ) ; return tap ( new TableDiff ( $ table ) , function ( $ tableDiff ) use ( $ schema , $ table ) { $ tableDiff -> fromTable = $ schema -> listTableDetails ( $ tabl...
Create an empty Doctrine DBAL TableDiff from the Blueprint .
21,192
public function databasePath ( $ path = '' ) { return ( $ this -> databasePath ? : $ this -> basePath . DIRECTORY_SEPARATOR . 'database' ) . ( $ path ? DIRECTORY_SEPARATOR . $ path : $ path ) ; }
Get the path to the database directory .
21,193
public function loadDeferredProviders ( ) { foreach ( $ this -> deferredServices as $ service => $ provider ) { $ this -> loadDeferredProvider ( $ service ) ; } $ this -> deferredServices = [ ] ; }
Load and boot all of the remaining deferred providers .
21,194
public function booted ( $ callback ) { $ this -> bootedCallbacks [ ] = $ callback ; if ( $ this -> isBooted ( ) ) { $ this -> fireAppCallbacks ( [ $ callback ] ) ; } }
Register a new booted listener .
21,195
public function prepareBindingsForDelete ( array $ bindings ) { $ cleanBindings = Arr :: except ( $ bindings , [ 'select' , 'join' ] ) ; return array_values ( array_merge ( $ bindings [ 'join' ] , Arr :: flatten ( $ cleanBindings ) ) ) ; }
Prepare the bindings for a delete statement .
21,196
protected function addConditions ( $ query , $ conditions ) { foreach ( $ conditions as $ key => $ value ) { if ( $ value instanceof Closure ) { $ query -> where ( function ( $ query ) use ( $ value ) { $ value ( $ query ) ; } ) ; } else { $ this -> addWhere ( $ query , $ key , $ value ) ; } } return $ query ; }
Add the given conditions to the query .
21,197
protected function transformUseVariables ( $ data ) { foreach ( $ data as $ key => $ value ) { $ data [ $ key ] = $ this -> getSerializedPropertyValue ( $ value ) ; } return $ data ; }
Transform the use variables before serialization .
21,198
protected function resolveUseVariables ( $ data ) { foreach ( $ data as $ key => $ value ) { $ data [ $ key ] = $ this -> getRestoredPropertyValue ( $ value ) ; } return $ data ; }
Resolve the use variables after unserialization .
21,199
protected function getManifest ( ) { if ( ! is_null ( $ this -> manifest ) ) { return $ this -> manifest ; } if ( ! file_exists ( $ this -> manifestPath ) ) { $ this -> build ( ) ; } $ this -> files -> get ( $ this -> manifestPath ) ; return $ this -> manifest = file_exists ( $ this -> manifestPath ) ? $ this -> files ...
Get the current package manifest .