idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
21,200
protected function allContacts ( Swift_Mime_SimpleMessage $ message ) { return array_merge ( ( array ) $ message -> getTo ( ) , ( array ) $ message -> getCc ( ) , ( array ) $ message -> getBcc ( ) ) ; }
Get all of the contacts for the message .
21,201
public static function make ( $ model , $ relation ) { $ class = get_class ( $ model ) ; $ instance = new static ( "Call to undefined relationship [{$relation}] on model [{$class}]." ) ; $ instance -> model = $ model ; $ instance -> relation = $ relation ; return $ instance ; }
Create a new exception instance .
21,202
protected function getJsonBindingParameter ( $ value ) { if ( $ value instanceof Expression ) { return $ value -> getValue ( ) ; } switch ( $ type = gettype ( $ value ) ) { case 'boolean' : return $ value ? 'true' : 'false' ; case 'NULL' : case 'integer' : case 'double' : case 'string' : return '?' ; case 'object' : ca...
Translate the given value into the appropriate JSON binding parameter .
21,203
protected function prepareResponse ( $ request , Exception $ e ) { if ( ! $ this -> isHttpException ( $ e ) && config ( 'app.debug' ) ) { return $ this -> toIlluminateResponse ( $ this -> convertExceptionToResponse ( $ e ) , $ e ) ; } if ( ! $ this -> isHttpException ( $ e ) ) { $ e = new HttpException ( 500 , $ e -> g...
Prepare a response for the given exception .
21,204
protected function renderExceptionContent ( Exception $ e ) { try { return config ( 'app.debug' ) && class_exists ( Whoops :: class ) ? $ this -> renderExceptionWithWhoops ( $ e ) : $ this -> renderExceptionWithSymfony ( $ e , config ( 'app.debug' ) ) ; } catch ( Exception $ e ) { return $ this -> renderExceptionWithSy...
Get the response content for the given exception .
21,205
protected function renderExceptionWithSymfony ( Exception $ e , $ debug ) { return ( new SymfonyExceptionHandler ( $ debug ) ) -> getHtml ( FlattenException :: create ( $ e ) ) ; }
Render an exception to a string using Symfony .
21,206
protected function registerErrorViewPaths ( ) { $ paths = collect ( config ( 'view.paths' ) ) ; View :: replaceNamespace ( 'errors' , $ paths -> map ( function ( $ path ) { return "{$path}/errors" ; } ) -> push ( __DIR__ . '/views' ) -> all ( ) ) ; }
Register the error template hint paths .
21,207
protected function toIlluminateResponse ( $ response , Exception $ e ) { if ( $ response instanceof SymfonyRedirectResponse ) { $ response = new RedirectResponse ( $ response -> getTargetUrl ( ) , $ response -> getStatusCode ( ) , $ response -> headers -> all ( ) ) ; } else { $ response = new Response ( $ response -> g...
Map the given exception into an Illuminate response .
21,208
protected function prepareJsonResponse ( $ request , Exception $ e ) { return new JsonResponse ( $ this -> convertExceptionToArray ( $ e ) , $ this -> isHttpException ( $ e ) ? $ e -> getStatusCode ( ) : 500 , $ this -> isHttpException ( $ e ) ? $ e -> getHeaders ( ) : [ ] , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES )...
Prepare a JSON response for the given exception .
21,209
protected function buildPayload ( $ notifiable , Notification $ notification ) { return [ 'id' => $ notification -> id , 'type' => get_class ( $ notification ) , 'data' => $ this -> getData ( $ notifiable , $ notification ) , 'read_at' => null , ] ; }
Build an array payload for the DatabaseNotification Model .
21,210
public function compileAdd ( Blueprint $ blueprint , Fluent $ command ) { $ columns = $ this -> prefixArray ( 'add column' , $ this -> getColumns ( $ blueprint ) ) ; return collect ( $ columns ) -> map ( function ( $ column ) use ( $ blueprint ) { return 'alter table ' . $ this -> wrapTable ( $ blueprint ) . ' ' . $ co...
Compile alter table commands for adding columns .
21,211
protected static function removeNodeModules ( ) { tap ( new Filesystem , function ( $ files ) { $ files -> deleteDirectory ( base_path ( 'node_modules' ) ) ; $ files -> delete ( base_path ( 'yarn.lock' ) ) ; } ) ; }
Remove the installed Node modules .
21,212
protected function setCustomModes ( PDO $ connection , array $ config ) { $ modes = implode ( ',' , $ config [ 'modes' ] ) ; $ connection -> prepare ( "set session sql_mode='{$modes}'" ) -> execute ( ) ; }
Set the custom modes on the connection .
21,213
protected function replaceNotIn ( $ message , $ attribute , $ rule , $ parameters ) { return $ this -> replaceIn ( $ message , $ attribute , $ rule , $ parameters ) ; }
Replace all place - holders for the not_in rule .
21,214
protected function replaceRequiredWith ( $ message , $ attribute , $ rule , $ parameters ) { return str_replace ( ':values' , implode ( ' / ' , $ this -> getAttributeList ( $ parameters ) ) , $ message ) ; }
Replace all place - holders for the required_with rule .
21,215
protected function replaceRequiredWithAll ( $ message , $ attribute , $ rule , $ parameters ) { return $ this -> replaceRequiredWith ( $ message , $ attribute , $ rule , $ parameters ) ; }
Replace all place - holders for the required_with_all rule .
21,216
protected function replaceRequiredWithout ( $ message , $ attribute , $ rule , $ parameters ) { return $ this -> replaceRequiredWith ( $ message , $ attribute , $ rule , $ parameters ) ; }
Replace all place - holders for the required_without rule .
21,217
protected function replaceRequiredWithoutAll ( $ message , $ attribute , $ rule , $ parameters ) { return $ this -> replaceRequiredWith ( $ message , $ attribute , $ rule , $ parameters ) ; }
Replace all place - holders for the required_without_all rule .
21,218
protected function replaceLt ( $ message , $ attribute , $ rule , $ parameters ) { if ( is_null ( $ value = $ this -> getValue ( $ parameters [ 0 ] ) ) ) { return str_replace ( ':value' , $ parameters [ 0 ] , $ message ) ; } return str_replace ( ':value' , $ this -> getSize ( $ attribute , $ value ) , $ message ) ; }
Replace all place - holders for the lt rule .
21,219
protected function replaceBeforeOrEqual ( $ message , $ attribute , $ rule , $ parameters ) { return $ this -> replaceBefore ( $ message , $ attribute , $ rule , $ parameters ) ; }
Replace all place - holders for the before_or_equal rule .
21,220
protected function replaceAfter ( $ message , $ attribute , $ rule , $ parameters ) { return $ this -> replaceBefore ( $ message , $ attribute , $ rule , $ parameters ) ; }
Replace all place - holders for the after rule .
21,221
protected function replaceAfterOrEqual ( $ message , $ attribute , $ rule , $ parameters ) { return $ this -> replaceBefore ( $ message , $ attribute , $ rule , $ parameters ) ; }
Replace all place - holders for the after_or_equal rule .
21,222
protected function replaceDateEquals ( $ message , $ attribute , $ rule , $ parameters ) { return $ this -> replaceBefore ( $ message , $ attribute , $ rule , $ parameters ) ; }
Replace all place - holders for the date_equals rule .
21,223
protected function replaceDimensions ( $ message , $ attribute , $ rule , $ parameters ) { $ parameters = $ this -> parseNamedParameters ( $ parameters ) ; if ( is_array ( $ parameters ) ) { foreach ( $ parameters as $ key => $ value ) { $ message = str_replace ( ':' . $ key , $ value , $ message ) ; } } return $ messa...
Replace all place - holders for the dimensions rule .
21,224
protected function replaceStartsWith ( $ message , $ attribute , $ rule , $ parameters ) { foreach ( $ parameters as & $ parameter ) { $ parameter = $ this -> getDisplayableValue ( $ attribute , $ parameter ) ; } return str_replace ( ':values' , implode ( ', ' , $ parameters ) , $ message ) ; }
Replace all place - holders for the starts_with rule .
21,225
public function replace ( $ path , $ content ) { clearstatcache ( true , $ path ) ; $ path = realpath ( $ path ) ? : $ path ; $ tempPath = tempnam ( dirname ( $ path ) , basename ( $ path ) ) ; chmod ( $ tempPath , 0777 - umask ( ) ) ; file_put_contents ( $ tempPath , $ content ) ; rename ( $ tempPath , $ path ) ; }
Write the contents of a file replacing it atomically if it already exists .
21,226
public function create ( Event $ event ) { return $ this -> cache -> store ( $ this -> store ) -> add ( $ event -> mutexName ( ) , true , $ event -> expiresAt * 60 ) ; }
Attempt to obtain an event mutex for the given event .
21,227
public function exists ( Event $ event ) { return $ this -> cache -> store ( $ this -> store ) -> has ( $ event -> mutexName ( ) ) ; }
Determine if an event mutex exists for the given event .
21,228
public function forget ( Event $ event ) { $ this -> cache -> store ( $ this -> store ) -> forget ( $ event -> mutexName ( ) ) ; }
Clear the event mutex for the given event .
21,229
public function parameters ( $ request ) { $ parameters = $ this -> bindPathParameters ( $ request ) ; if ( ! is_null ( $ this -> route -> compiled -> getHostRegex ( ) ) ) { $ parameters = $ this -> bindHostParameters ( $ request , $ parameters ) ; } return $ this -> replaceDefaults ( $ parameters ) ; }
Get the parameters for the route .
21,230
protected function bindHostParameters ( $ request , $ parameters ) { preg_match ( $ this -> route -> compiled -> getHostRegex ( ) , $ request -> getHost ( ) , $ matches ) ; return array_merge ( $ this -> matchToKeys ( array_slice ( $ matches , 1 ) ) , $ parameters ) ; }
Extract the parameter list from the host part of the request .
21,231
public function composers ( array $ composers ) { $ registered = [ ] ; foreach ( $ composers as $ callback => $ views ) { $ registered = array_merge ( $ registered , $ this -> composer ( $ views , $ callback ) ) ; } return $ registered ; }
Register multiple view composers via an array .
21,232
public function composer ( $ views , $ callback ) { $ composers = [ ] ; foreach ( ( array ) $ views as $ view ) { $ composers [ ] = $ this -> addViewEvent ( $ view , $ callback , 'composing: ' ) ; } return $ composers ; }
Register a view composer event .
21,233
protected function addClassEvent ( $ view , $ class , $ prefix ) { $ name = $ prefix . $ view ; $ callback = $ this -> buildClassEventCallback ( $ class , $ prefix ) ; $ this -> addEventListener ( $ name , $ callback ) ; return $ callback ; }
Register a class based view composer .
21,234
public function has ( $ ability ) { $ abilities = is_array ( $ ability ) ? $ ability : func_get_args ( ) ; foreach ( $ abilities as $ ability ) { if ( ! isset ( $ this -> abilities [ $ ability ] ) ) { return false ; } } return true ; }
Determine if a given ability has been defined .
21,235
public function resource ( $ name , $ class , array $ abilities = null ) { $ abilities = $ abilities ? : [ 'view' => 'view' , 'create' => 'create' , 'update' => 'update' , 'delete' => 'delete' , ] ; foreach ( $ abilities as $ ability => $ method ) { $ this -> define ( $ name . '.' . $ ability , $ class . '@' . $ method...
Define abilities for a resource .
21,236
public function check ( $ abilities , $ arguments = [ ] ) { return collect ( $ abilities ) -> every ( function ( $ ability ) use ( $ arguments ) { try { return ( bool ) $ this -> raw ( $ ability , $ arguments ) ; } catch ( AuthorizationException $ e ) { return false ; } } ) ; }
Determine if all of the given abilities should be granted for the current user .
21,237
public function any ( $ abilities , $ arguments = [ ] ) { return collect ( $ abilities ) -> contains ( function ( $ ability ) use ( $ arguments ) { return $ this -> check ( $ ability , $ arguments ) ; } ) ; }
Determine if any one of the given abilities should be granted for the current user .
21,238
public function raw ( $ ability , $ arguments = [ ] ) { $ arguments = Arr :: wrap ( $ arguments ) ; $ user = $ this -> resolveUser ( ) ; $ result = $ this -> callBeforeCallbacks ( $ user , $ ability , $ arguments ) ; if ( is_null ( $ result ) ) { $ result = $ this -> callAuthCallback ( $ user , $ ability , $ arguments ...
Get the raw result from the authorization callback .
21,239
protected function methodAllowsGuests ( $ class , $ method ) { try { $ reflection = new ReflectionClass ( $ class ) ; $ method = $ reflection -> getMethod ( $ method ) ; } catch ( Exception $ e ) { return false ; } if ( $ method ) { $ parameters = $ method -> getParameters ( ) ; return isset ( $ parameters [ 0 ] ) && $...
Determine if the given class method allows guests .
21,240
protected function callbackAllowsGuests ( $ callback ) { $ parameters = ( new ReflectionFunction ( $ callback ) ) -> getParameters ( ) ; return isset ( $ parameters [ 0 ] ) && $ this -> parameterAllowsGuests ( $ parameters [ 0 ] ) ; }
Determine if the callback allows guests .
21,241
protected function parameterAllowsGuests ( $ parameter ) { return ( $ parameter -> getClass ( ) && $ parameter -> allowsNull ( ) ) || ( $ parameter -> isDefaultValueAvailable ( ) && is_null ( $ parameter -> getDefaultValue ( ) ) ) ; }
Determine if the given parameter allows guests .
21,242
protected function guessPolicyName ( $ class ) { if ( $ this -> guessPolicyNamesUsingCallback ) { return Arr :: wrap ( call_user_func ( $ this -> guessPolicyNamesUsingCallback , $ class ) ) ; } $ classDirname = str_replace ( '/' , '\\' , dirname ( str_replace ( '\\' , '/' , $ class ) ) ) ; return [ $ classDirname . '\\...
Guess the policy name for the given class .
21,243
protected function callPolicyBefore ( $ policy , $ user , $ ability , $ arguments ) { if ( ! method_exists ( $ policy , 'before' ) ) { return ; } if ( $ this -> canBeCalledWithUser ( $ user , $ policy , 'before' ) ) { return $ policy -> before ( $ user , $ ability , ... $ arguments ) ; } }
Call the before method on the given policy if applicable .
21,244
protected function callPolicyMethod ( $ policy , $ method , $ user , array $ arguments ) { if ( isset ( $ arguments [ 0 ] ) && is_string ( $ arguments [ 0 ] ) ) { array_shift ( $ arguments ) ; } if ( ! is_callable ( [ $ policy , $ method ] ) ) { return ; } if ( $ this -> canBeCalledWithUser ( $ user , $ policy , $ meth...
Call the appropriate method on the given policy .
21,245
protected function setupManager ( ) { $ factory = new ConnectionFactory ( $ this -> container ) ; $ this -> manager = new DatabaseManager ( $ this -> container , $ factory ) ; }
Build the database manager instance .
21,246
public function bootEloquent ( ) { Eloquent :: setConnectionResolver ( $ this -> manager ) ; if ( $ dispatcher = $ this -> getEventDispatcher ( ) ) { Eloquent :: setEventDispatcher ( $ dispatcher ) ; } }
Bootstrap Eloquent so it is ready for usage .
21,247
protected function preferredLocale ( $ notifiable , $ notification ) { return $ notification -> locale ?? $ this -> locale ?? value ( function ( ) use ( $ notifiable ) { if ( $ notifiable instanceof HasLocalePreference ) { return $ notifiable -> preferredLocale ( ) ; } } ) ; }
Get the notifiable s preferred locale for the notification .
21,248
public function command ( $ method , array $ parameters = [ ] ) { $ start = microtime ( true ) ; $ result = $ this -> client -> { $ method } ( ... $ parameters ) ; $ time = round ( ( microtime ( true ) - $ start ) * 1000 , 2 ) ; if ( isset ( $ this -> events ) ) { $ this -> event ( new CommandExecuted ( $ method , $ pa...
Run a command against the Redis database .
21,249
public function displayName ( ) { $ reflection = new ReflectionFunction ( $ this -> closure -> getClosure ( ) ) ; return 'Closure (' . basename ( $ reflection -> getFileName ( ) ) . ':' . $ reflection -> getStartLine ( ) . ')' ; }
Get the display name for the queued job .
21,250
public function forDebug ( ) { return tap ( new PrettyPageHandler , function ( $ handler ) { $ handler -> handleUnconditionally ( true ) ; $ this -> registerApplicationPaths ( $ handler ) -> registerBlacklist ( $ handler ) -> registerEditor ( $ handler ) ; } ) ; }
Create a new Whoops handler for debug mode .
21,251
protected function registerBlacklist ( $ handler ) { foreach ( config ( 'app.debug_blacklist' , [ ] ) as $ key => $ secrets ) { foreach ( $ secrets as $ secret ) { $ handler -> blacklist ( $ key , $ secret ) ; } } return $ this ; }
Register the blacklist with the handler .
21,252
protected function store ( $ results ) { $ results -> each ( function ( $ model ) { if ( ! isset ( $ this -> connection ) ) { $ model -> setConnection ( $ model -> newQueryWithoutScopes ( ) -> getConnection ( ) -> getName ( ) ) ; } $ model -> save ( ) ; } ) ; }
Set the connection name on the results and store them .
21,253
public function raw ( array $ attributes = [ ] ) { if ( $ this -> amount === null ) { return $ this -> getRawAttributes ( $ attributes ) ; } if ( $ this -> amount < 1 ) { return [ ] ; } return array_map ( function ( ) use ( $ attributes ) { return $ this -> getRawAttributes ( $ attributes ) ; } , range ( 1 , $ this -> ...
Create an array of raw attribute arrays .
21,254
protected function getRawAttributes ( array $ attributes = [ ] ) { if ( ! isset ( $ this -> definitions [ $ this -> class ] [ $ this -> name ] ) ) { throw new InvalidArgumentException ( "Unable to locate factory with name [{$this->name}] [{$this->class}]." ) ; } $ definition = call_user_func ( $ this -> definitions [ $...
Get a raw attributes array for the model .
21,255
protected function stateAttributes ( $ state , array $ attributes ) { $ stateAttributes = $ this -> states [ $ this -> class ] [ $ state ] ; if ( ! is_callable ( $ stateAttributes ) ) { return $ stateAttributes ; } return call_user_func ( $ stateAttributes , $ this -> faker , $ attributes ) ; }
Get the state attributes .
21,256
protected function expandAttributes ( array $ attributes ) { foreach ( $ attributes as & $ attribute ) { if ( is_callable ( $ attribute ) && ! is_string ( $ attribute ) && ! is_array ( $ attribute ) ) { $ attribute = $ attribute ( $ attributes ) ; } if ( $ attribute instanceof static ) { $ attribute = $ attribute -> cr...
Expand all attributes to their underlying values .
21,257
protected function stateHasAfterCallback ( $ state ) { return isset ( $ this -> afterMaking [ $ this -> class ] [ $ state ] ) || isset ( $ this -> afterCreating [ $ this -> class ] [ $ state ] ) ; }
Determine if the given state has an after callback .
21,258
public static function merge ( $ new , $ old ) { if ( isset ( $ new [ 'domain' ] ) ) { unset ( $ old [ 'domain' ] ) ; } $ new = array_merge ( static :: formatAs ( $ new , $ old ) , [ 'namespace' => static :: formatNamespace ( $ new , $ old ) , 'prefix' => static :: formatPrefix ( $ new , $ old ) , 'where' => static :: ...
Merge route groups into a new array .
21,259
public function dispatchToQueue ( $ command ) { $ connection = $ command -> connection ?? null ; $ queue = call_user_func ( $ this -> queueResolver , $ connection ) ; if ( ! $ queue instanceof Queue ) { throw new RuntimeException ( 'Queue resolver did not return a Queue implementation.' ) ; } if ( method_exists ( $ com...
Dispatch a command to its appropriate handler behind a queue .
21,260
protected function collectResource ( $ resource ) { if ( $ resource instanceof MissingValue ) { return $ resource ; } $ collects = $ this -> collects ( ) ; $ this -> collection = $ collects && ! $ resource -> first ( ) instanceof $ collects ? $ resource -> mapInto ( $ collects ) : $ resource -> toBase ( ) ; return $ re...
Map the given collection resource into its individual resources .
21,261
protected function collects ( ) { if ( $ this -> collects ) { return $ this -> collects ; } if ( Str :: endsWith ( class_basename ( $ this ) , 'Collection' ) && class_exists ( $ class = Str :: replaceLast ( 'Collection' , '' , get_class ( $ this ) ) ) ) { return $ class ; } }
Get the resource that this resource collects .
21,262
protected function createCommand ( $ connection , $ queue , ListenerOptions $ options ) { return array_filter ( [ $ this -> phpBinary ( ) , $ this -> artisanBinary ( ) , 'queue:work' , $ connection , '--once' , "--queue={$queue}" , "--delay={$options->delay}" , "--memory={$options->memory}" , "--sleep={$options->sleep}...
Create the command with the listener options .
21,263
protected function handleWorkerOutput ( $ type , $ line ) { if ( isset ( $ this -> outputHandler ) ) { call_user_func ( $ this -> outputHandler , $ type , $ line ) ; } }
Handle output from the worker process .
21,264
public static function forModel ( $ container , $ class , $ callback = null ) { return function ( $ value ) use ( $ container , $ class , $ callback ) { if ( is_null ( $ value ) ) { return ; } $ instance = $ container -> make ( $ class ) ; if ( $ model = $ instance -> resolveRouteBinding ( $ value ) ) { return $ model ...
Create a Route model binding for a model .
21,265
public function loadCount ( $ relations ) { if ( $ this -> isEmpty ( ) ) { return $ this ; } $ models = $ this -> first ( ) -> newModelQuery ( ) -> whereKey ( $ this -> modelKeys ( ) ) -> select ( $ this -> first ( ) -> getKeyName ( ) ) -> withCount ( ... func_get_args ( ) ) -> get ( ) ; $ attributes = Arr :: except ( ...
Load a set of relationship counts onto the collection .
21,266
public function loadMissing ( $ relations ) { if ( is_string ( $ relations ) ) { $ relations = func_get_args ( ) ; } foreach ( $ relations as $ key => $ value ) { if ( is_numeric ( $ key ) ) { $ key = $ value ; } $ segments = explode ( '.' , explode ( ':' , $ key ) [ 0 ] ) ; if ( Str :: contains ( $ key , ':' ) ) { $ s...
Load a set of relationships onto the collection if they are not already eager loaded .
21,267
protected function loadMissingRelation ( self $ models , array $ path ) { $ relation = array_shift ( $ path ) ; $ name = explode ( ':' , key ( $ relation ) ) [ 0 ] ; if ( is_string ( reset ( $ relation ) ) ) { $ relation = reset ( $ relation ) ; } $ models -> filter ( function ( $ model ) use ( $ name ) { return ! is_n...
Load a relationship path if it is not already eager loaded .
21,268
public function loadMorph ( $ relation , $ relations ) { $ this -> pluck ( $ relation ) -> filter ( ) -> groupBy ( function ( $ model ) { return get_class ( $ model ) ; } ) -> each ( function ( $ models , $ className ) use ( $ relations ) { static :: make ( $ models ) -> load ( $ relations [ $ className ] ?? [ ] ) ; } ...
Load a set of relationships onto the mixed relationship collection .
21,269
public function fresh ( $ with = [ ] ) { if ( $ this -> isEmpty ( ) ) { return new static ; } $ model = $ this -> first ( ) ; $ freshModels = $ model -> newQueryWithoutScopes ( ) -> with ( is_string ( $ with ) ? func_get_args ( ) : $ with ) -> whereIn ( $ model -> getKeyName ( ) , $ this -> modelKeys ( ) ) -> get ( ) -...
Reload a fresh model instance from the database for all the entities .
21,270
public function unique ( $ key = null , $ strict = false ) { if ( ! is_null ( $ key ) ) { return parent :: unique ( $ key , $ strict ) ; } return new static ( array_values ( $ this -> getDictionary ( ) ) ) ; }
Return only unique items from the collection .
21,271
public function except ( $ keys ) { $ dictionary = Arr :: except ( $ this -> getDictionary ( ) , $ keys ) ; return new static ( array_values ( $ dictionary ) ) ; }
Returns all models in the collection except the models with specified keys .
21,272
public function getQueueableIds ( ) { if ( $ this -> isEmpty ( ) ) { return [ ] ; } return $ this -> first ( ) instanceof QueueableEntity ? $ this -> map -> getQueueableId ( ) -> all ( ) : $ this -> modelKeys ( ) ; }
Get the identifiers for all of the entities .
21,273
public function getQueueableConnection ( ) { if ( $ this -> isEmpty ( ) ) { return ; } $ connection = $ this -> first ( ) -> getConnectionName ( ) ; $ this -> each ( function ( $ model ) use ( $ connection ) { if ( $ model -> getConnectionName ( ) !== $ connection ) { throw new LogicException ( 'Queueing collections wi...
Get the connection of the entities being queued .
21,274
public static function resolved ( Closure $ callback ) { static :: $ app -> afterResolving ( static :: getFacadeAccessor ( ) , function ( $ service ) use ( $ callback ) { $ callback ( $ service ) ; } ) ; }
Run a Closure when the facade has been resolved .
21,275
public static function spy ( ) { if ( ! static :: isMock ( ) ) { $ class = static :: getMockableClass ( ) ; return tap ( $ class ? Mockery :: spy ( $ class ) : Mockery :: spy ( ) , function ( $ spy ) { static :: swap ( $ spy ) ; } ) ; } }
Convert the facade into a Mockery spy .
21,276
public static function swap ( $ instance ) { static :: $ resolvedInstance [ static :: getFacadeAccessor ( ) ] = $ instance ; if ( isset ( static :: $ app ) ) { static :: $ app -> instance ( static :: getFacadeAccessor ( ) , $ instance ) ; } }
Hotswap the underlying instance behind the facade .
21,277
public function refresh ( $ status = 302 , $ headers = [ ] ) { return $ this -> to ( $ this -> generator -> getRequest ( ) -> path ( ) , $ status , $ headers ) ; }
Create a new redirect response to the current URI .
21,278
public function secure ( $ path , $ status = 302 , $ headers = [ ] ) { return $ this -> to ( $ path , $ status , $ headers , true ) ; }
Create a new redirect response to the given HTTPS path .
21,279
public static function endsWith ( $ haystack , $ needles ) { foreach ( ( array ) $ needles as $ needle ) { if ( substr ( $ haystack , - strlen ( $ needle ) ) === ( string ) $ needle ) { return true ; } } return false ; }
Determine if a given string ends with a given substring .
21,280
public static function finish ( $ value , $ cap ) { $ quoted = preg_quote ( $ cap , '/' ) ; return preg_replace ( '/(?:' . $ quoted . ')+$/u' , '' , $ value ) . $ cap ; }
Cap a string with a single instance of a given value .
21,281
public static function pluralStudly ( $ value , $ count = 2 ) { $ parts = preg_split ( '/(.)(?=[A-Z])/u' , $ value , - 1 , PREG_SPLIT_DELIM_CAPTURE ) ; $ lastWord = array_pop ( $ parts ) ; return implode ( '' , $ parts ) . self :: plural ( $ lastWord , $ count ) ; }
Pluralize the last word of an English studly caps case string .
21,282
public static function start ( $ value , $ prefix ) { $ quoted = preg_quote ( $ prefix , '/' ) ; return $ prefix . preg_replace ( '/^(?:' . $ quoted . ')+/u' , '' , $ value ) ; }
Begin a string with a single instance of a given value .
21,283
protected function explodeRules ( $ rules ) { foreach ( $ rules as $ key => $ rule ) { if ( Str :: contains ( $ key , '*' ) ) { $ rules = $ this -> explodeWildcardRules ( $ rules , $ key , [ $ rule ] ) ; unset ( $ rules [ $ key ] ) ; } else { $ rules [ $ key ] = $ this -> explodeExplicitRule ( $ rule ) ; } } return $ r...
Explode the rules into an array of explicit rules .
21,284
protected function explodeExplicitRule ( $ rule ) { if ( is_string ( $ rule ) ) { return explode ( '|' , $ rule ) ; } elseif ( is_object ( $ rule ) ) { return [ $ this -> prepareRule ( $ rule ) ] ; } return array_map ( [ $ this , 'prepareRule' ] , $ rule ) ; }
Explode the explicit rule into an array if necessary .
21,285
protected function prepareRule ( $ rule ) { if ( $ rule instanceof Closure ) { $ rule = new ClosureValidationRule ( $ rule ) ; } if ( ! is_object ( $ rule ) || $ rule instanceof RuleContract || ( $ rule instanceof Exists && $ rule -> queryCallbacks ( ) ) || ( $ rule instanceof Unique && $ rule -> queryCallbacks ( ) ) )...
Prepare the given rule for the Validator .
21,286
protected static function parseParameters ( $ rule , $ parameter ) { $ rule = strtolower ( $ rule ) ; if ( in_array ( $ rule , [ 'regex' , 'not_regex' , 'notregex' ] , true ) ) { return [ $ parameter ] ; } return str_getcsv ( $ parameter ) ; }
Parse a parameter list .
21,287
protected function getInlineMessage ( $ attribute , $ rule ) { $ inlineEntry = $ this -> getFromLocalArray ( $ attribute , Str :: snake ( $ rule ) ) ; return is_array ( $ inlineEntry ) && in_array ( $ rule , $ this -> sizeRules ) ? $ inlineEntry [ $ this -> getAttributeType ( $ attribute ) ] : $ inlineEntry ; }
Get the proper inline error message for standard and size rules .
21,288
protected function getWildcardCustomMessages ( $ messages , $ search , $ default ) { foreach ( $ messages as $ key => $ message ) { if ( $ search === $ key || ( Str :: contains ( $ key , [ '*' ] ) && Str :: is ( $ key , $ search ) ) ) { return $ message ; } } return $ default ; }
Check the given messages for a wildcard key .
21,289
protected function handleManyResult ( $ keys , $ key , $ value ) { if ( is_null ( $ value ) ) { $ this -> event ( new CacheMissed ( $ key ) ) ; return isset ( $ keys [ $ key ] ) ? value ( $ keys [ $ key ] ) : null ; } $ this -> event ( new CacheHit ( $ key , $ value ) ) ; return $ value ; }
Handle a result for the many method .
21,290
protected function putManyForever ( array $ values ) { $ result = true ; foreach ( $ values as $ key => $ value ) { if ( ! $ this -> forever ( $ key , $ value ) ) { $ result = false ; } } return $ result ; }
Store multiple items in the cache indefinitely .
21,291
public function rememberForever ( $ key , Closure $ callback ) { $ value = $ this -> get ( $ key ) ; if ( ! is_null ( $ value ) ) { return $ value ; } $ this -> forever ( $ key , $ value = $ callback ( ) ) ; return $ value ; }
Get an item from the cache or execute the given Closure and store the result forever .
21,292
protected function getSeconds ( $ ttl ) { $ duration = $ this -> parseDateInterval ( $ ttl ) ; if ( $ duration instanceof DateTimeInterface ) { $ duration = Carbon :: now ( ) -> diffInRealSeconds ( $ duration , false ) ; } return ( int ) $ duration > 0 ? $ duration : 0 ; }
Calculate the number of seconds for the given TTL .
21,293
protected function isExpired ( array $ item , $ expiration = null ) { $ expiration = $ expiration ? : Carbon :: now ( ) ; return isset ( $ item [ $ this -> expirationAttribute ] ) && $ expiration -> getTimestamp ( ) >= $ item [ $ this -> expirationAttribute ] [ 'N' ] ; }
Determine if the given item is expired .
21,294
protected function unserialize ( $ value ) { if ( filter_var ( $ value , FILTER_VALIDATE_INT ) !== false ) { return ( int ) $ value ; } if ( is_numeric ( $ value ) ) { return ( float ) $ value ; } return unserialize ( $ value ) ; }
Unserialize the value .
21,295
public function has ( $ key ) { $ keys = is_array ( $ key ) ? $ key : func_get_args ( ) ; $ input = $ this -> all ( ) ; foreach ( $ keys as $ value ) { if ( ! Arr :: has ( $ input , $ value ) ) { return false ; } } return true ; }
Determine if the request contains a given input item key .
21,296
public function hasAny ( $ keys ) { $ keys = is_array ( $ keys ) ? $ keys : func_get_args ( ) ; $ input = $ this -> all ( ) ; foreach ( $ keys as $ key ) { if ( Arr :: has ( $ input , $ key ) ) { return true ; } } return false ; }
Determine if the request contains any of the given inputs .
21,297
public function anyFilled ( $ keys ) { $ keys = is_array ( $ keys ) ? $ keys : func_get_args ( ) ; foreach ( $ keys as $ key ) { if ( $ this -> filled ( $ key ) ) { return true ; } } return false ; }
Determine if the request contains a non - empty value for any of the given inputs .
21,298
protected function prepareQueryBuilder ( $ columns = [ '*' ] ) { $ builder = $ this -> query -> applyScopes ( ) ; return $ builder -> addSelect ( $ this -> shouldSelect ( $ builder -> getQuery ( ) -> columns ? [ ] : $ columns ) ) ; }
Prepare the query builder for query execution .
21,299
public function getRelationExistenceQueryForThroughSelfRelation ( Builder $ query , Builder $ parentQuery , $ columns = [ '*' ] ) { $ table = $ this -> throughParent -> getTable ( ) . ' as ' . $ hash = $ this -> getRelationCountHash ( ) ; $ query -> join ( $ table , $ hash . '.' . $ this -> secondLocalKey , '=' , $ thi...
Add the constraints for a relationship query on the same table as the through parent .