idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
21,000 | public function setTablePrefix ( $ prefix ) { $ this -> tablePrefix = $ prefix ; $ this -> getQueryGrammar ( ) -> setTablePrefix ( $ prefix ) ; return $ this ; } | Set the table prefix in use by the connection . |
21,001 | protected function replaceMigration ( $ path , $ table , $ tableClassName ) { $ stub = str_replace ( [ '{{table}}' , '{{tableClassName}}' ] , [ $ table , $ tableClassName ] , $ this -> files -> get ( __DIR__ . '/stubs/jobs.stub' ) ) ; $ this -> files -> put ( $ path , $ stub ) ; } | Replace the generated migration with the job table stub . |
21,002 | protected function verificationUrl ( $ notifiable ) { return URL :: temporarySignedRoute ( 'verification.verify' , Carbon :: now ( ) -> addMinutes ( Config :: get ( 'auth.verification.expire' , 60 ) ) , [ 'id' => $ notifiable -> getKey ( ) ] ) ; } | Get the verification URL for the given notifiable . |
21,003 | public static function createFrom ( self $ from , $ to = null ) { $ request = $ to ? : new static ; $ files = $ from -> files -> all ( ) ; $ files = is_array ( $ files ) ? array_filter ( $ files ) : $ files ; $ request -> initialize ( $ from -> query -> all ( ) , $ from -> request -> all ( ) , $ from -> attributes -> a... | Create a new request instance from the given Laravel request . |
21,004 | public static function createFromBase ( SymfonyRequest $ request ) { if ( $ request instanceof static ) { return $ request ; } $ content = $ request -> content ; $ newRequest = ( new static ) -> duplicate ( $ request -> query -> all ( ) , $ request -> request -> all ( ) , $ request -> attributes -> all ( ) , $ request ... | Create an Illuminate request from a Symfony instance . |
21,005 | protected static function setRenamedColumns ( TableDiff $ tableDiff , Fluent $ command , Column $ column ) { $ tableDiff -> renamedColumns = [ $ command -> from => new Column ( $ command -> to , $ column -> getType ( ) , $ column -> toArray ( ) ) , ] ; return $ tableDiff ; } | Set the renamed columns on the table diff . |
21,006 | public function bootstrap ( ) { if ( ! $ this -> app -> hasBeenBootstrapped ( ) ) { $ this -> app -> bootstrapWith ( $ this -> bootstrappers ( ) ) ; } $ this -> app -> loadDeferredProviders ( ) ; if ( ! $ this -> commandsLoaded ) { $ this -> commands ( ) ; $ this -> commandsLoaded = true ; } } | Bootstrap the application for artisan commands . |
21,007 | public function show ( Request $ request ) { return $ request -> user ( ) -> hasVerifiedEmail ( ) ? redirect ( $ this -> redirectPath ( ) ) : view ( 'auth.verify' ) ; } | Show the email verification notice . |
21,008 | public function resend ( Request $ request ) { if ( $ request -> user ( ) -> hasVerifiedEmail ( ) ) { return redirect ( $ this -> redirectPath ( ) ) ; } $ request -> user ( ) -> sendEmailVerificationNotification ( ) ; return back ( ) -> with ( 'resent' , true ) ; } | Resend the email verification notification . |
21,009 | protected function calculateMac ( $ payload , $ bytes ) { return hash_hmac ( 'sha256' , $ this -> hash ( $ payload [ 'iv' ] , $ payload [ 'value' ] ) , $ bytes , true ) ; } | Calculate the hash of the given payload . |
21,010 | public function add ( $ key , $ message ) { if ( $ this -> isUnique ( $ key , $ message ) ) { $ this -> messages [ $ key ] [ ] = $ message ; } return $ this ; } | Add a message to the message bag . |
21,011 | public function merge ( $ messages ) { if ( $ messages instanceof MessageProvider ) { $ messages = $ messages -> getMessageBag ( ) -> getMessages ( ) ; } $ this -> messages = array_merge_recursive ( $ this -> messages , $ messages ) ; return $ this ; } | Merge a new array of messages into the message bag . |
21,012 | public function first ( $ key = null , $ format = null ) { $ messages = is_null ( $ key ) ? $ this -> all ( $ format ) : $ this -> get ( $ key , $ format ) ; $ firstMessage = Arr :: first ( $ messages , null , '' ) ; return is_array ( $ firstMessage ) ? Arr :: first ( $ firstMessage ) : $ firstMessage ; } | Get the first message from the message bag for a given key . |
21,013 | public function get ( $ key , $ format = null ) { if ( array_key_exists ( $ key , $ this -> messages ) ) { return $ this -> transform ( $ this -> messages [ $ key ] , $ this -> checkFormat ( $ format ) , $ key ) ; } if ( Str :: contains ( $ key , '*' ) ) { return $ this -> getMessagesForWildcardKey ( $ key , $ format )... | Get all of the messages from the message bag for a given key . |
21,014 | protected function getMessagesForWildcardKey ( $ key , $ format ) { return collect ( $ this -> messages ) -> filter ( function ( $ messages , $ messageKey ) use ( $ key ) { return Str :: is ( $ key , $ messageKey ) ; } ) -> map ( function ( $ messages , $ messageKey ) use ( $ format ) { return $ this -> transform ( $ m... | Get the messages for a wildcard key . |
21,015 | protected function channelName ( ) { if ( method_exists ( $ this -> notifiable , 'receivesBroadcastNotificationsOn' ) ) { return $ this -> notifiable -> receivesBroadcastNotificationsOn ( $ this -> notification ) ; } $ class = str_replace ( '\\' , '.' , get_class ( $ this -> notifiable ) ) ; return $ class . '.' . $ th... | Get the broadcast channel name for the event . |
21,016 | public function broadcastType ( ) { return method_exists ( $ this -> notification , 'broadcastType' ) ? $ this -> notification -> broadcastType ( ) : get_class ( $ this -> notification ) ; } | Get the type of the notification being broadcast . |
21,017 | protected function bootIfNotBooted ( ) { if ( ! isset ( static :: $ booted [ static :: class ] ) ) { static :: $ booted [ static :: class ] = true ; $ this -> fireModelEvent ( 'booting' , false ) ; static :: boot ( ) ; $ this -> fireModelEvent ( 'booted' , false ) ; } } | Check if the model needs to be booted and if so do it . |
21,018 | public static function withoutTouchingOn ( array $ models , callable $ callback ) { static :: $ ignoreOnTouch = array_values ( array_merge ( static :: $ ignoreOnTouch , $ models ) ) ; try { call_user_func ( $ callback ) ; } finally { static :: $ ignoreOnTouch = array_values ( array_diff ( static :: $ ignoreOnTouch , $ ... | Disables relationship model touching for the given model classes during given callback scope . |
21,019 | public static function isIgnoringTouch ( $ class = null ) { $ class = $ class ? : static :: class ; foreach ( static :: $ ignoreOnTouch as $ ignoredClass ) { if ( $ class === $ ignoredClass || is_subclass_of ( $ class , $ ignoredClass ) ) { return true ; } } return false ; } | Determine if the given model is ignoring touches . |
21,020 | public function loadMissing ( $ relations ) { $ relations = is_string ( $ relations ) ? func_get_args ( ) : $ relations ; $ this -> newCollection ( [ $ this ] ) -> loadMissing ( $ relations ) ; return $ this ; } | Eager load relations on the model if they are not already eager loaded . |
21,021 | public function loadCount ( $ relations ) { $ relations = is_string ( $ relations ) ? func_get_args ( ) : $ relations ; $ this -> newCollection ( [ $ this ] ) -> loadCount ( $ relations ) ; return $ this ; } | Eager load relation counts on the model . |
21,022 | public function registerGlobalScopes ( $ builder ) { foreach ( $ this -> getGlobalScopes ( ) as $ identifier => $ scope ) { $ builder -> withGlobalScope ( $ identifier , $ scope ) ; } return $ builder ; } | Register the global scopes for this builder instance . |
21,023 | public function fresh ( $ with = [ ] ) { if ( ! $ this -> exists ) { return ; } return static :: newQueryWithoutScopes ( ) -> with ( is_string ( $ with ) ? func_get_args ( ) : $ with ) -> where ( $ this -> getKeyName ( ) , $ this -> getKey ( ) ) -> first ( ) ; } | Reload a fresh model instance from the database . |
21,024 | public function refresh ( ) { if ( ! $ this -> exists ) { return $ this ; } $ this -> setRawAttributes ( static :: newQueryWithoutScopes ( ) -> findOrFail ( $ this -> getKey ( ) ) -> attributes ) ; $ this -> load ( collect ( $ this -> relations ) -> except ( 'pivot' ) -> keys ( ) -> toArray ( ) ) ; $ this -> syncOrigin... | Reload the current model instance with fresh attributes from the database . |
21,025 | public static function initializeAndGatherData ( $ attribute , $ masterData ) { $ data = Arr :: dot ( static :: initializeAttributeOnData ( $ attribute , $ masterData ) ) ; return array_merge ( $ data , static :: extractValuesForWildcards ( $ masterData , $ data , $ attribute ) ) ; } | Initialize and gather data for given attribute . |
21,026 | protected function compileCreateTable ( $ blueprint , $ command , $ connection ) { return sprintf ( '%s table %s (%s)' , $ blueprint -> temporary ? 'create temporary' : 'create' , $ this -> wrapTable ( $ blueprint ) , implode ( ', ' , $ this -> getColumns ( $ blueprint ) ) ) ; } | Create the main create table clause . |
21,027 | protected function compileCreateEngine ( $ sql , Connection $ connection , Blueprint $ blueprint ) { if ( isset ( $ blueprint -> engine ) ) { return $ sql . ' engine = ' . $ blueprint -> engine ; } elseif ( ! is_null ( $ engine = $ connection -> getConfig ( 'engine' ) ) ) { return $ sql . ' engine = ' . $ engine ; } re... | Append the engine specifications to a command . |
21,028 | public function compileDropUnique ( Blueprint $ blueprint , Fluent $ command ) { $ index = $ this -> wrap ( $ command -> index ) ; return "alter table {$this->wrapTable($blueprint)} drop index {$index}" ; } | Compile a drop unique key command . |
21,029 | protected function modifyCharset ( Blueprint $ blueprint , Fluent $ column ) { if ( ! is_null ( $ column -> charset ) ) { return ' character set ' . $ column -> charset ; } } | Get the SQL for a character set column modifier . |
21,030 | protected function modifyAfter ( Blueprint $ blueprint , Fluent $ column ) { if ( ! is_null ( $ column -> after ) ) { return ' after ' . $ this -> wrap ( $ column -> after ) ; } } | Get the SQL for an after column modifier . |
21,031 | protected function modifyComment ( Blueprint $ blueprint , Fluent $ column ) { if ( ! is_null ( $ column -> comment ) ) { return " comment '" . addslashes ( $ column -> comment ) . "'" ; } } | Get the SQL for a comment column modifier . |
21,032 | protected function modifySrid ( Blueprint $ blueprint , Fluent $ column ) { if ( ! is_null ( $ column -> srid ) && is_int ( $ column -> srid ) && $ column -> srid > 0 ) { return ' srid ' . $ column -> srid ; } } | Get the SQL for a SRID column modifier . |
21,033 | public function parseData ( array $ data ) { $ newData = [ ] ; foreach ( $ data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ value = $ this -> parseData ( $ value ) ; } if ( Str :: contains ( $ key , '.' ) ) { $ newData [ str_replace ( '.' , '->' , $ key ) ] = $ value ; } else { $ newData [ $ key ] = $ value... | Parse the data array converting dots to - > . |
21,034 | public function validated ( ) { if ( $ this -> invalid ( ) ) { throw new ValidationException ( $ this ) ; } $ results = [ ] ; $ missingValue = Str :: random ( 10 ) ; foreach ( array_keys ( $ this -> getRules ( ) ) as $ key ) { $ value = data_get ( $ this -> getData ( ) , $ key , $ missingValue ) ; if ( $ value !== $ mi... | Get the attributes and values that were validated . |
21,035 | protected function getExplicitKeys ( $ attribute ) { $ pattern = str_replace ( '\*' , '([^\.]+)' , preg_quote ( $ this -> getPrimaryAttribute ( $ attribute ) , '/' ) ) ; if ( preg_match ( '/^' . $ pattern . '/' , $ attribute , $ keys ) ) { array_shift ( $ keys ) ; return $ keys ; } return [ ] ; } | Get the explicit keys from an attribute flattened with dot notation . |
21,036 | protected function getPrimaryAttribute ( $ attribute ) { foreach ( $ this -> implicitAttributes as $ unparsed => $ parsed ) { if ( in_array ( $ attribute , $ parsed ) ) { return $ unparsed ; } } return $ attribute ; } | Get the primary attribute name . |
21,037 | protected function isNotNullIfMarkedAsNullable ( $ rule , $ attribute ) { if ( $ this -> isImplicit ( $ rule ) || ! $ this -> hasRule ( $ attribute , [ 'Nullable' ] ) ) { return true ; } return ! is_null ( Arr :: get ( $ this -> data , $ attribute , 0 ) ) ; } | Determine if the attribute fails the nullable check . |
21,038 | protected function hasNotFailedPreviousRuleIfPresenceRule ( $ rule , $ attribute ) { return in_array ( $ rule , [ 'Unique' , 'Exists' ] ) ? ! $ this -> messages -> has ( $ attribute ) : true ; } | Determine if it s a necessary presence validation . |
21,039 | protected function validateUsingCustomRule ( $ attribute , $ value , $ rule ) { if ( ! $ rule -> passes ( $ attribute , $ value ) ) { $ this -> failedRules [ $ attribute ] [ get_class ( $ rule ) ] = [ ] ; $ messages = ( array ) $ rule -> message ( ) ; foreach ( $ messages as $ message ) { $ this -> messages -> add ( $ ... | Validate an attribute using a custom rule object . |
21,040 | protected function attributesThatHaveMessages ( ) { return collect ( $ this -> messages ( ) -> toArray ( ) ) -> map ( function ( $ message , $ key ) { return explode ( '.' , $ key ) [ 0 ] ; } ) -> unique ( ) -> flip ( ) -> all ( ) ; } | Generate an array of all attributes that have messages . |
21,041 | public function setData ( array $ data ) { $ this -> data = $ this -> parseData ( $ data ) ; $ this -> setRules ( $ this -> initialRules ) ; return $ this ; } | Set the data under validation . |
21,042 | public function addRules ( $ rules ) { $ response = ( new ValidationRuleParser ( $ this -> data ) ) -> explode ( $ rules ) ; $ this -> rules = array_merge_recursive ( $ this -> rules , $ response -> rules ) ; $ this -> implicitAttributes = array_merge ( $ this -> implicitAttributes , $ response -> implicitAttributes ) ... | Parse the given rules and merge them into current rules . |
21,043 | public function getPresenceVerifierFor ( $ connection ) { return tap ( $ this -> getPresenceVerifier ( ) , function ( $ verifier ) use ( $ connection ) { $ verifier -> setConnection ( $ connection ) ; } ) ; } | Get the Presence Verifier implementation . |
21,044 | public function signedRoute ( $ name , $ parameters = [ ] , $ expiration = null , $ absolute = true ) { $ parameters = $ this -> formatParameters ( $ parameters ) ; if ( $ expiration ) { $ parameters = $ parameters + [ 'expires' => $ this -> availableAt ( $ expiration ) ] ; } ksort ( $ parameters ) ; $ key = call_user_... | Create a signed route URL for a named route . |
21,045 | public function temporarySignedRoute ( $ name , $ expiration , $ parameters = [ ] , $ absolute = true ) { return $ this -> signedRoute ( $ name , $ parameters , $ expiration , $ absolute ) ; } | Create a temporary signed route URL for a named route . |
21,046 | public function formatParameters ( $ parameters ) { $ parameters = Arr :: wrap ( $ parameters ) ; foreach ( $ parameters as $ key => $ parameter ) { if ( $ parameter instanceof UrlRoutable ) { $ parameters [ $ key ] = $ parameter -> getRouteKey ( ) ; } } return $ parameters ; } | Format the array of URL parameters . |
21,047 | protected function extractQueryString ( $ path ) { if ( ( $ queryPosition = strpos ( $ path , '?' ) ) !== false ) { return [ substr ( $ path , 0 , $ queryPosition ) , substr ( $ path , $ queryPosition ) , ] ; } return [ $ path , '' ] ; } | Extract the query string from the given path . |
21,048 | public function format ( $ root , $ path , $ route = null ) { $ path = '/' . trim ( $ path , '/' ) ; if ( $ this -> formatHostUsing ) { $ root = call_user_func ( $ this -> formatHostUsing , $ root , $ route ) ; } if ( $ this -> formatPathUsing ) { $ path = call_user_func ( $ this -> formatPathUsing , $ path , $ route )... | Format the given URL segments into a single URL . |
21,049 | protected function routeUrl ( ) { if ( ! $ this -> routeGenerator ) { $ this -> routeGenerator = new RouteUrlGenerator ( $ this , $ this -> request ) ; } return $ this -> routeGenerator ; } | Get the Route URL generator instance . |
21,050 | public function choose ( $ line , $ number , $ locale ) { $ segments = explode ( '|' , $ line ) ; if ( ( $ value = $ this -> extract ( $ segments , $ number ) ) !== null ) { return trim ( $ value ) ; } $ segments = $ this -> stripConditions ( $ segments ) ; $ pluralIndex = $ this -> getPluralIndex ( $ locale , $ number... | Select a proper translation string based on the given number . |
21,051 | private function extract ( $ segments , $ number ) { foreach ( $ segments as $ part ) { if ( ! is_null ( $ line = $ this -> extractFromString ( $ part , $ number ) ) ) { return $ line ; } } } | Extract a translation string using inline conditions . |
21,052 | private function extractFromString ( $ part , $ number ) { preg_match ( '/^[\{\[]([^\[\]\{\}]*)[\}\]](.*)/s' , $ part , $ matches ) ; if ( count ( $ matches ) !== 3 ) { return ; } $ condition = $ matches [ 1 ] ; $ value = $ matches [ 2 ] ; if ( Str :: contains ( $ condition , ',' ) ) { [ $ from , $ to ] = explode ( ','... | Get the translation string if the condition matches . |
21,053 | public function withLocale ( $ locale , $ callback ) { if ( ! $ locale ) { return $ callback ( ) ; } $ app = Container :: getInstance ( ) ; $ original = $ app -> getLocale ( ) ; try { $ app -> setLocale ( $ locale ) ; return $ callback ( ) ; } finally { $ app -> setLocale ( $ original ) ; } } | Run the callback with the given locale . |
21,054 | public static function withMessages ( array $ messages ) { return new static ( tap ( ValidatorFacade :: make ( [ ] , [ ] ) , function ( $ validator ) use ( $ messages ) { foreach ( $ messages as $ key => $ value ) { foreach ( Arr :: wrap ( $ value ) as $ message ) { $ validator -> errors ( ) -> add ( $ key , $ message ... | Create a new validation exception from a plain array of messages . |
21,055 | protected function setupWildcardListen ( $ event , $ listener ) { $ this -> wildcards [ $ event ] [ ] = $ this -> makeListener ( $ listener , true ) ; $ this -> wildcardsCache = [ ] ; } | Setup a wildcard listener callback . |
21,056 | public function hasListeners ( $ eventName ) { return isset ( $ this -> listeners [ $ eventName ] ) || isset ( $ this -> wildcards [ $ eventName ] ) ; } | Determine if a given event has listeners . |
21,057 | protected function addInterfaceListeners ( $ eventName , array $ listeners = [ ] ) { foreach ( class_implements ( $ eventName ) as $ interface ) { if ( isset ( $ this -> listeners [ $ interface ] ) ) { foreach ( $ this -> listeners [ $ interface ] as $ names ) { $ listeners = array_merge ( $ listeners , ( array ) $ nam... | Add the listeners for the event s interfaces to the given array . |
21,058 | protected function propagateListenerOptions ( $ listener , $ job ) { return tap ( $ job , function ( $ job ) use ( $ listener ) { $ job -> tries = $ listener -> tries ?? null ; $ job -> timeout = $ listener -> timeout ?? null ; $ job -> timeoutAt = method_exists ( $ listener , 'retryUntil' ) ? $ listener -> retryUntil ... | Propagate listener options to the job . |
21,059 | public function compileAdd ( Blueprint $ blueprint , Fluent $ command ) { return sprintf ( 'alter table %s add %s' , $ this -> wrapTable ( $ blueprint ) , implode ( ', ' , $ this -> getColumns ( $ blueprint ) ) ) ; } | Compile a column addition table command . |
21,060 | protected function typeEnum ( Fluent $ column ) { return sprintf ( 'nvarchar(255) check ("%s" in (%s))' , $ column -> name , $ this -> quoteString ( $ column -> allowed ) ) ; } | Create the column definition for an enumeration type . |
21,061 | protected function modifyCollate ( Blueprint $ blueprint , Fluent $ column ) { if ( ! is_null ( $ column -> collation ) ) { return ' collate ' . $ column -> collation ; } } | Get the SQL for a collation column modifier . |
21,062 | protected static function getTableWithColumnChanges ( Blueprint $ blueprint , Table $ table ) { $ table = clone $ table ; foreach ( $ blueprint -> getChangedColumns ( ) as $ fluent ) { $ column = static :: getDoctrineColumn ( $ table , $ fluent ) ; foreach ( $ fluent -> getAttributes ( ) as $ key => $ value ) { if ( ! ... | Get a copy of the given Doctrine table after making the column changes . |
21,063 | protected static function getDoctrineColumnChangeOptions ( Fluent $ fluent ) { $ options = [ 'type' => static :: getDoctrineColumnType ( $ fluent [ 'type' ] ) ] ; if ( in_array ( $ fluent [ 'type' ] , [ 'text' , 'mediumText' , 'longText' ] ) ) { $ options [ 'length' ] = static :: calculateDoctrineTextLength ( $ fluent ... | Get the Doctrine column change options . |
21,064 | public function getQueueableId ( ) { if ( isset ( $ this -> attributes [ $ this -> getKeyName ( ) ] ) ) { return $ this -> getKey ( ) ; } return sprintf ( '%s:%s:%s:%s:%s:%s' , $ this -> foreignKey , $ this -> getAttribute ( $ this -> foreignKey ) , $ this -> relatedKey , $ this -> getAttribute ( $ this -> relatedKey )... | Get the queueable identity for the entity . |
21,065 | public function channel ( $ channel , $ callback , $ options = [ ] ) { $ this -> channels [ $ channel ] = $ callback ; $ this -> channelOptions [ $ channel ] = $ options ; return $ this ; } | Register a channel authenticator . |
21,066 | protected function extractParameters ( $ callback ) { if ( is_callable ( $ callback ) ) { return ( new ReflectionFunction ( $ callback ) ) -> getParameters ( ) ; } elseif ( is_string ( $ callback ) ) { return $ this -> extractParametersFromClass ( $ callback ) ; } throw new Exception ( 'Given channel handler is an unkn... | Extracts the parameters out of what the user passed to handle the channel authentication . |
21,067 | protected function extractParametersFromClass ( $ callback ) { $ reflection = new ReflectionClass ( $ callback ) ; if ( ! $ reflection -> hasMethod ( 'join' ) ) { throw new Exception ( 'Class based channel must define a "join" method.' ) ; } return $ reflection -> getMethod ( 'join' ) -> getParameters ( ) ; } | Extracts the parameters out of a class channel s join method . |
21,068 | protected function resolveBinding ( $ key , $ value , $ callbackParameters ) { $ newValue = $ this -> resolveExplicitBindingIfPossible ( $ key , $ value ) ; return $ newValue === $ value ? $ this -> resolveImplicitBindingIfPossible ( $ key , $ value , $ callbackParameters ) : $ newValue ; } | Resolve the given parameter binding . |
21,069 | protected function resolveExplicitBindingIfPossible ( $ key , $ value ) { $ binder = $ this -> binder ( ) ; if ( $ binder && $ binder -> getBindingCallback ( $ key ) ) { return call_user_func ( $ binder -> getBindingCallback ( $ key ) , $ value ) ; } return $ value ; } | Resolve an explicit parameter binding if applicable . |
21,070 | protected function resolveImplicitBindingIfPossible ( $ key , $ value , $ callbackParameters ) { foreach ( $ callbackParameters as $ parameter ) { if ( ! $ this -> isImplicitlyBindable ( $ key , $ parameter ) ) { continue ; } $ instance = $ parameter -> getClass ( ) -> newInstance ( ) ; if ( ! $ model = $ instance -> r... | Resolve an implicit parameter binding if applicable . |
21,071 | protected function isImplicitlyBindable ( $ key , $ parameter ) { return $ parameter -> name === $ key && $ parameter -> getClass ( ) && $ parameter -> getClass ( ) -> isSubclassOf ( UrlRoutable :: class ) ; } | Determine if a given key and parameter is implicitly bindable . |
21,072 | protected function binder ( ) { if ( ! $ this -> bindingRegistrar ) { $ this -> bindingRegistrar = Container :: getInstance ( ) -> bound ( BindingRegistrar :: class ) ? Container :: getInstance ( ) -> make ( BindingRegistrar :: class ) : null ; } return $ this -> bindingRegistrar ; } | Get the model binding registrar instance . |
21,073 | protected function normalizeChannelHandlerToCallable ( $ callback ) { return is_callable ( $ callback ) ? $ callback : function ( ... $ args ) use ( $ callback ) { return Container :: getInstance ( ) -> make ( $ callback ) -> join ( ... $ args ) ; } ; } | Normalize the given callback into a callable . |
21,074 | protected function retrieveChannelOptions ( $ channel ) { foreach ( $ this -> channelOptions as $ pattern => $ options ) { if ( ! $ this -> channelNameMatchesPattern ( $ channel , $ pattern ) ) { continue ; } return $ options ; } return [ ] ; } | Retrieve options for a certain channel . |
21,075 | protected function fireCustomModelEvent ( $ event , $ method ) { if ( ! isset ( $ this -> dispatchesEvents [ $ event ] ) ) { return ; } $ result = static :: $ dispatcher -> $ method ( new $ this -> dispatchesEvents [ $ event ] ( $ this ) ) ; if ( ! is_null ( $ result ) ) { return $ result ; } } | Fire a custom model event for the given event . |
21,076 | protected function filterModelEventResults ( $ result ) { if ( is_array ( $ result ) ) { $ result = array_filter ( $ result , function ( $ response ) { return ! is_null ( $ response ) ; } ) ; } return $ result ; } | Filter the model event results . |
21,077 | public static function flushEventListeners ( ) { if ( ! isset ( static :: $ dispatcher ) ) { return ; } $ instance = new static ; foreach ( $ instance -> getObservableEvents ( ) as $ event ) { static :: $ dispatcher -> forget ( "eloquent.{$event}: " . static :: class ) ; } foreach ( array_values ( $ instance -> dispatc... | Remove all of the event listeners for the model . |
21,078 | protected function addDateAttributesToArray ( array $ attributes ) { foreach ( $ this -> getDates ( ) as $ key ) { if ( ! isset ( $ attributes [ $ key ] ) ) { continue ; } $ attributes [ $ key ] = $ this -> serializeDate ( $ this -> asDateTime ( $ attributes [ $ key ] ) ) ; } return $ attributes ; } | Add the date attributes to the attributes array . |
21,079 | protected function addMutatedAttributesToArray ( array $ attributes , array $ mutatedAttributes ) { foreach ( $ mutatedAttributes as $ key ) { if ( ! array_key_exists ( $ key , $ attributes ) ) { continue ; } $ attributes [ $ key ] = $ this -> mutateAttributeForArray ( $ key , $ attributes [ $ key ] ) ; } return $ attr... | Add the mutated attributes to the attributes array . |
21,080 | protected function getCastType ( $ key ) { if ( $ this -> isCustomDateTimeCast ( $ this -> getCasts ( ) [ $ key ] ) ) { return 'custom_datetime' ; } if ( $ this -> isDecimalCast ( $ this -> getCasts ( ) [ $ key ] ) ) { return 'decimal' ; } return trim ( strtolower ( $ this -> getCasts ( ) [ $ key ] ) ) ; } | Get the type of cast for a model attribute . |
21,081 | public function fillJsonAttribute ( $ key , $ value ) { [ $ key , $ path ] = explode ( '->' , $ key , 2 ) ; $ this -> attributes [ $ key ] = $ this -> asJson ( $ this -> getArrayAttributeWithValue ( $ path , $ key , $ value ) ) ; return $ this ; } | Set a given JSON attribute on the model . |
21,082 | protected function getArrayAttributeByKey ( $ key ) { return isset ( $ this -> attributes [ $ key ] ) ? $ this -> fromJson ( $ this -> attributes [ $ key ] ) : [ ] ; } | Get an array attribute or return an empty array if it is not set . |
21,083 | public function only ( $ attributes ) { $ results = [ ] ; foreach ( is_array ( $ attributes ) ? $ attributes : func_get_args ( ) as $ attribute ) { $ results [ $ attribute ] = $ this -> getAttribute ( $ attribute ) ; } return $ results ; } | Get a subset of the model s attributes . |
21,084 | public function syncOriginalAttributes ( $ attributes ) { $ attributes = is_array ( $ attributes ) ? $ attributes : func_get_args ( ) ; foreach ( $ attributes as $ attribute ) { $ this -> original [ $ attribute ] = $ this -> attributes [ $ attribute ] ; } return $ this ; } | Sync multiple original attribute with their current values . |
21,085 | protected function hasChanges ( $ changes , $ attributes = null ) { if ( empty ( $ attributes ) ) { return count ( $ changes ) > 0 ; } foreach ( Arr :: wrap ( $ attributes ) as $ attribute ) { if ( array_key_exists ( $ attribute , $ changes ) ) { return true ; } } return false ; } | Determine if any of the given attributes were changed . |
21,086 | public function append ( $ attributes ) { $ this -> appends = array_unique ( array_merge ( $ this -> appends , is_string ( $ attributes ) ? func_get_args ( ) : $ attributes ) ) ; return $ this ; } | Append attributes to query when building a query . |
21,087 | protected function whereTime ( Builder $ query , $ where ) { $ value = $ this -> parameter ( $ where [ 'value' ] ) ; return $ this -> wrap ( $ where [ 'column' ] ) . '::time ' . $ where [ 'operator' ] . ' ' . $ value ; } | Compile a where time clause . |
21,088 | protected function compileJsonUpdateColumn ( $ key , $ value ) { $ parts = explode ( '->' , $ key ) ; $ field = $ this -> wrap ( array_shift ( $ parts ) ) ; $ path = '\'{"' . implode ( '","' , $ parts ) . '"}\'' ; return "{$field} = jsonb_set({$field}::jsonb, {$path}, {$this->parameter($value)})" ; } | Prepares a JSON column being updated using the JSONB_SET function . |
21,089 | protected function clean ( $ request ) { $ this -> cleanParameterBag ( $ request -> query ) ; if ( $ request -> isJson ( ) ) { $ this -> cleanParameterBag ( $ request -> json ( ) ) ; } elseif ( $ request -> request !== $ request -> query ) { $ this -> cleanParameterBag ( $ request -> request ) ; } } | Clean the request s data . |
21,090 | protected function cleanArray ( array $ data , $ keyPrefix = '' ) { return collect ( $ data ) -> map ( function ( $ value , $ key ) use ( $ keyPrefix ) { return $ this -> cleanValue ( $ keyPrefix . $ key , $ value ) ; } ) -> all ( ) ; } | Clean the data in the given array . |
21,091 | public function normalizeChannelName ( $ channel ) { if ( $ this -> isGuardedChannel ( $ channel ) ) { return Str :: startsWith ( $ channel , 'private-' ) ? Str :: replaceFirst ( 'private-' , '' , $ channel ) : Str :: replaceFirst ( 'presence-' , '' , $ channel ) ; } return $ channel ; } | Remove prefix from channel name . |
21,092 | public function json ( $ data = [ ] , $ status = 200 , array $ headers = [ ] , $ options = 0 ) { return new JsonResponse ( $ data , $ status , $ headers , $ options ) ; } | Create a new JSON response instance . |
21,093 | public function jsonp ( $ callback , $ data = [ ] , $ status = 200 , array $ headers = [ ] , $ options = 0 ) { return $ this -> json ( $ data , $ status , $ headers , $ options ) -> setCallback ( $ callback ) ; } | Create a new JSONP response instance . |
21,094 | public function streamDownload ( $ callback , $ name = null , array $ headers = [ ] , $ disposition = 'attachment' ) { $ response = new StreamedResponse ( $ callback , 200 , $ headers ) ; if ( ! is_null ( $ name ) ) { $ response -> headers -> set ( 'Content-Disposition' , $ response -> headers -> makeDisposition ( $ di... | Create a new streamed response instance as a file download . |
21,095 | protected function newHasOne ( Builder $ query , Model $ parent , $ foreignKey , $ localKey ) { return new HasOne ( $ query , $ parent , $ foreignKey , $ localKey ) ; } | Instantiate a new HasOne relationship . |
21,096 | protected function newHasOneThrough ( Builder $ query , Model $ farParent , Model $ throughParent , $ firstKey , $ secondKey , $ localKey , $ secondLocalKey ) { return new HasOneThrough ( $ query , $ farParent , $ throughParent , $ firstKey , $ secondKey , $ localKey , $ secondLocalKey ) ; } | Instantiate a new HasOneThrough relationship . |
21,097 | protected function newMorphOne ( Builder $ query , Model $ parent , $ type , $ id , $ localKey ) { return new MorphOne ( $ query , $ parent , $ type , $ id , $ localKey ) ; } | Instantiate a new MorphOne relationship . |
21,098 | protected function newMorphTo ( Builder $ query , Model $ parent , $ foreignKey , $ ownerKey , $ type , $ relation ) { return new MorphTo ( $ query , $ parent , $ foreignKey , $ ownerKey , $ type , $ relation ) ; } | Instantiate a new MorphTo relationship . |
21,099 | protected function newHasMany ( Builder $ query , Model $ parent , $ foreignKey , $ localKey ) { return new HasMany ( $ query , $ parent , $ foreignKey , $ localKey ) ; } | Instantiate a new HasMany relationship . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.