idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
20,900 | protected static function pathsForProviderAndGroup ( $ provider , $ group ) { if ( ! empty ( static :: $ publishes [ $ provider ] ) && ! empty ( static :: $ publishGroups [ $ group ] ) ) { return array_intersect_key ( static :: $ publishes [ $ provider ] , static :: $ publishGroups [ $ group ] ) ; } return [ ] ; } | Get the paths for the provider and group . |
20,901 | public function commands ( $ commands ) { $ commands = is_array ( $ commands ) ? $ commands : func_get_args ( ) ; Artisan :: starting ( function ( $ artisan ) use ( $ commands ) { $ artisan -> resolveCommands ( $ commands ) ; } ) ; } | Register the package s custom Artisan commands . |
20,902 | private function inTimeInterval ( $ startTime , $ endTime ) { return function ( ) use ( $ startTime , $ endTime ) { return Carbon :: now ( $ this -> timezone ) -> between ( Carbon :: parse ( $ startTime , $ this -> timezone ) , Carbon :: parse ( $ endTime , $ this -> timezone ) , true ) ; } ; } | Schedule the event to run between start and end time . |
20,903 | public function twiceDaily ( $ first = 1 , $ second = 13 ) { $ hours = $ first . ',' . $ second ; return $ this -> spliceIntoPosition ( 1 , 0 ) -> spliceIntoPosition ( 2 , $ hours ) ; } | Schedule the event to run twice daily . |
20,904 | public function twiceMonthly ( $ first = 1 , $ second = 16 ) { $ days = $ first . ',' . $ second ; return $ this -> spliceIntoPosition ( 1 , 0 ) -> spliceIntoPosition ( 2 , 0 ) -> spliceIntoPosition ( 3 , $ days ) ; } | Schedule the event to run twice monthly . |
20,905 | protected function createNativeDriver ( ) { $ lifetime = $ this -> app [ 'config' ] [ 'session.lifetime' ] ; return $ this -> buildSession ( new FileSessionHandler ( $ this -> app [ 'files' ] , $ this -> app [ 'config' ] [ 'session.files' ] , $ lifetime ) ) ; } | Create an instance of the file session driver . |
20,906 | protected function registerRequestRebindHandler ( ) { $ this -> app -> rebinding ( 'request' , function ( $ app , $ request ) { $ request -> setUserResolver ( function ( $ guard = null ) use ( $ app ) { return call_user_func ( $ app [ 'auth' ] -> userResolver ( ) , $ guard ) ; } ) ; } ) ; } | Handle the re - binding of the request binding . |
20,907 | protected function registerEventRebindHandler ( ) { $ this -> app -> rebinding ( 'events' , function ( $ app , $ dispatcher ) { if ( ! $ app -> resolved ( 'auth' ) ) { return ; } if ( method_exists ( $ guard = $ app [ 'auth' ] -> guard ( ) , 'setDispatcher' ) ) { $ guard -> setDispatcher ( $ dispatcher ) ; } } ) ; } | Handle the re - binding of the event dispatcher binding . |
20,908 | protected function messageBuilder ( $ notifiable , $ notification , $ message ) { return function ( $ mailMessage ) use ( $ notifiable , $ notification , $ message ) { $ this -> buildMessage ( $ mailMessage , $ notifiable , $ notification , $ message ) ; } ; } | Get the mailer Closure for the message . |
20,909 | protected function buildView ( $ message ) { if ( $ message -> view ) { return $ message -> view ; } return [ 'html' => $ this -> markdown -> render ( $ message -> markdown , $ message -> data ( ) ) , 'text' => $ this -> markdown -> renderText ( $ message -> markdown , $ message -> data ( ) ) , ] ; } | Build the notification s view . |
20,910 | protected function buildMessage ( $ mailMessage , $ notifiable , $ notification , $ message ) { $ this -> addressMessage ( $ mailMessage , $ notifiable , $ notification , $ message ) ; $ mailMessage -> subject ( $ message -> subject ? : Str :: title ( Str :: snake ( class_basename ( $ notification ) , ' ' ) ) ) ; $ thi... | Build the mail message . |
20,911 | protected function addressMessage ( $ mailMessage , $ notifiable , $ notification , $ message ) { $ this -> addSender ( $ mailMessage , $ message ) ; $ mailMessage -> to ( $ this -> getRecipients ( $ notifiable , $ notification , $ message ) ) ; if ( ! empty ( $ message -> cc ) ) { foreach ( $ message -> cc as $ cc ) {... | Address the mail message . |
20,912 | protected function addSender ( $ mailMessage , $ message ) { if ( ! empty ( $ message -> from ) ) { $ mailMessage -> from ( $ message -> from [ 0 ] , Arr :: get ( $ message -> from , 1 ) ) ; } if ( ! empty ( $ message -> replyTo ) ) { foreach ( $ message -> replyTo as $ replyTo ) { $ mailMessage -> replyTo ( $ replyTo ... | Add the from and reply to addresses to the message . |
20,913 | protected function getRecipients ( $ notifiable , $ notification , $ message ) { if ( is_string ( $ recipients = $ notifiable -> routeNotificationFor ( 'mail' , $ notification ) ) ) { $ recipients = [ $ recipients ] ; } return collect ( $ recipients ) -> mapWithKeys ( function ( $ recipient , $ email ) { return is_nume... | Get the recipients of the given message . |
20,914 | protected function addAttachments ( $ mailMessage , $ message ) { foreach ( $ message -> attachments as $ attachment ) { $ mailMessage -> attach ( $ attachment [ 'file' ] , $ attachment [ 'options' ] ) ; } foreach ( $ message -> rawAttachments as $ attachment ) { $ mailMessage -> attachData ( $ attachment [ 'data' ] , ... | Add the attachments to the message . |
20,915 | protected function getOpenAndClosingPhpTokens ( $ contents ) { return collect ( token_get_all ( $ contents ) ) -> pluck ( $ tokenNumber = 0 ) -> filter ( function ( $ token ) { return in_array ( $ token , [ T_OPEN_TAG , T_OPEN_TAG_WITH_ECHO , T_CLOSE_TAG ] ) ; } ) ; } | Get the open and closing PHP tag tokens from the given string . |
20,916 | protected function addFooters ( $ result ) { return ltrim ( $ result , PHP_EOL ) . PHP_EOL . implode ( PHP_EOL , array_reverse ( $ this -> footer ) ) ; } | Add the stored footers onto the given content . |
20,917 | protected function compileExtensions ( $ value ) { foreach ( $ this -> extensions as $ compiler ) { $ value = call_user_func ( $ compiler , $ value , $ this ) ; } return $ value ; } | Execute the user defined extensions . |
20,918 | protected function callCustomDirective ( $ name , $ value ) { if ( Str :: startsWith ( $ value , '(' ) && Str :: endsWith ( $ value , ')' ) ) { $ value = Str :: substr ( $ value , 1 , - 1 ) ; } return call_user_func ( $ this -> customDirectives [ $ name ] , trim ( $ value ) ) ; } | Call the given directive with the given value . |
20,919 | public function if ( $ name , callable $ callback ) { $ this -> conditions [ $ name ] = $ callback ; $ this -> directive ( $ name , function ( $ expression ) use ( $ name ) { return $ expression !== '' ? "<?php if (\Illuminate\Support\Facades\Blade::check('{$name}', {$expression})): ?>" : "<?php if (\Illuminate\Support... | Register an if statement directive . |
20,920 | public function component ( $ path , $ alias = null ) { $ alias = $ alias ? : Arr :: last ( explode ( '.' , $ path ) ) ; $ this -> directive ( $ alias , function ( $ expression ) use ( $ path ) { return $ expression ? "<?php \$__env->startComponent('{$path}', {$expression}); ?>" : "<?php \$__env->startComponent('{$path... | Register a component alias directive . |
20,921 | protected function decodePusherResponse ( $ request , $ response ) { if ( ! $ request -> input ( 'callback' , false ) ) { return json_decode ( $ response , true ) ; } return response ( ) -> json ( json_decode ( $ response , true ) ) -> withCallback ( $ request -> callback ) ; } | Decode the given Pusher response . |
20,922 | protected function setBootstrapNamespaces ( ) { $ search = [ $ this -> currentRoot . '\\Http' , $ this -> currentRoot . '\\Console' , $ this -> currentRoot . '\\Exceptions' , ] ; $ replace = [ $ this -> argument ( 'name' ) . '\\Http' , $ this -> argument ( 'name' ) . '\\Console' , $ this -> argument ( 'name' ) . '\\Exc... | Set the bootstrap namespaces . |
20,923 | protected function setAppConfigNamespaces ( ) { $ search = [ $ this -> currentRoot . '\\Providers' , $ this -> currentRoot . '\\Http\\Controllers\\' , ] ; $ replace = [ $ this -> argument ( 'name' ) . '\\Providers' , $ this -> argument ( 'name' ) . '\\Http\\Controllers\\' , ] ; $ this -> replaceIn ( $ this -> getConfig... | Set the application provider namespaces . |
20,924 | protected function setDatabaseFactoryNamespaces ( ) { $ files = Finder :: create ( ) -> in ( database_path ( 'factories' ) ) -> contains ( $ this -> currentRoot ) -> name ( '*.php' ) ; foreach ( $ files as $ file ) { $ this -> replaceIn ( $ file -> getRealPath ( ) , $ this -> currentRoot , $ this -> argument ( 'name' )... | Set the namespace in database factory files . |
20,925 | public function connection ( $ name = null ) { $ name = $ name ? : 'default' ; if ( isset ( $ this -> connections [ $ name ] ) ) { return $ this -> connections [ $ name ] ; } return $ this -> connections [ $ name ] = $ this -> configure ( $ this -> resolve ( $ name ) , $ name ) ; } | Get a Redis connection by name . |
20,926 | protected function configure ( Connection $ connection , $ name ) { $ connection -> setName ( $ name ) ; if ( $ this -> events && $ this -> app -> bound ( 'events' ) ) { $ connection -> setEventDispatcher ( $ this -> app -> make ( 'events' ) ) ; } return $ connection ; } | Configure the given connection to prepare it for commands . |
20,927 | protected function getAllViews ( ) { return $ this -> connection -> select ( $ this -> grammar -> compileGetAllViews ( $ this -> connection -> getConfig ( 'schema' ) ) ) ; } | Get all of the view names for the database . |
20,928 | protected function parseSchemaAndTable ( $ table ) { $ table = explode ( '.' , $ table ) ; if ( is_array ( $ schema = $ this -> connection -> getConfig ( 'schema' ) ) ) { if ( in_array ( $ table [ 0 ] , $ schema ) ) { return [ array_shift ( $ table ) , implode ( '.' , $ table ) ] ; } $ schema = head ( $ schema ) ; } re... | Parse the table name and extract the schema and table . |
20,929 | protected function sortMiddleware ( $ priorityMap , $ middlewares ) { $ lastIndex = 0 ; foreach ( $ middlewares as $ index => $ middleware ) { if ( ! is_string ( $ middleware ) ) { continue ; } $ stripped = head ( explode ( ':' , $ middleware ) ) ; if ( in_array ( $ stripped , $ priorityMap ) ) { $ priorityIndex = arra... | Sort the middlewares by the given priority map . |
20,930 | protected function moveMiddleware ( $ middlewares , $ from , $ to ) { array_splice ( $ middlewares , $ to , 0 , $ middlewares [ $ from ] ) ; unset ( $ middlewares [ $ from + 1 ] ) ; return $ middlewares ; } | Splice a middleware into a new position and remove the old entry . |
20,931 | public function resolve ( $ type , $ id ) { $ instance = ( new $ type ) -> find ( $ id ) ; if ( $ instance ) { return $ instance ; } throw new EntityNotFoundException ( $ type , $ id ) ; } | Resolve the entity for the given ID . |
20,932 | public static function fromAction ( array $ action , $ subClass = null ) { $ parameters = is_string ( $ action [ 'uses' ] ) ? static :: fromClassMethodString ( $ action [ 'uses' ] ) : ( new ReflectionFunction ( $ action [ 'uses' ] ) ) -> getParameters ( ) ; return is_null ( $ subClass ) ? $ parameters : array_filter ( ... | Extract the route action s signature parameters . |
20,933 | public function validateBeforeOrEqual ( $ attribute , $ value , $ parameters ) { $ this -> requireParameterCount ( 1 , $ parameters , 'before_or_equal' ) ; return $ this -> compareDates ( $ attribute , $ value , $ parameters , '<=' ) ; } | Validate the date is before or equal a given date . |
20,934 | public function validateAfterOrEqual ( $ attribute , $ value , $ parameters ) { $ this -> requireParameterCount ( 1 , $ parameters , 'after_or_equal' ) ; return $ this -> compareDates ( $ attribute , $ value , $ parameters , '>=' ) ; } | Validate the date is equal or after a given date . |
20,935 | protected function compareDates ( $ attribute , $ value , $ parameters , $ operator ) { if ( ! is_string ( $ value ) && ! is_numeric ( $ value ) && ! $ value instanceof DateTimeInterface ) { return false ; } if ( $ format = $ this -> getDateFormat ( $ attribute ) ) { return $ this -> checkDateTimeOrder ( $ format , $ v... | Compare a given date against another using an operator . |
20,936 | protected function getDateTimestamp ( $ value ) { if ( $ value instanceof DateTimeInterface ) { return $ value -> getTimestamp ( ) ; } if ( $ this -> isTestingRelativeDateTime ( $ value ) ) { $ date = $ this -> getDateTime ( $ value ) ; if ( ! is_null ( $ date ) ) { return $ date -> getTimestamp ( ) ; } } return strtot... | Get the date timestamp . |
20,937 | protected function getDateTime ( $ value ) { try { if ( $ this -> isTestingRelativeDateTime ( $ value ) ) { return Date :: parse ( $ value ) ; } return new DateTime ( $ value ) ; } catch ( Exception $ e ) { } } | Get a DateTime instance from a string with no format . |
20,938 | public function validateDateEquals ( $ attribute , $ value , $ parameters ) { $ this -> requireParameterCount ( 1 , $ parameters , 'date_equals' ) ; return $ this -> compareDates ( $ attribute , $ value , $ parameters , '=' ) ; } | Validate that an attribute is equal to another date . |
20,939 | protected function failsBasicDimensionChecks ( $ parameters , $ width , $ height ) { return ( isset ( $ parameters [ 'width' ] ) && $ parameters [ 'width' ] != $ width ) || ( isset ( $ parameters [ 'min_width' ] ) && $ parameters [ 'min_width' ] > $ width ) || ( isset ( $ parameters [ 'max_width' ] ) && $ parameters [ ... | Test if the given width and height fail any conditions . |
20,940 | protected function failsRatioCheck ( $ parameters , $ width , $ height ) { if ( ! isset ( $ parameters [ 'ratio' ] ) ) { return false ; } [ $ numerator , $ denominator ] = array_replace ( [ 1 , 1 ] , array_filter ( sscanf ( $ parameters [ 'ratio' ] , '%f/%d' ) ) ) ; $ precision = 1 / max ( $ width , $ height ) ; return... | Determine if the given parameters fail a dimension ratio check . |
20,941 | protected function getDistinctValues ( $ attribute ) { $ attributeName = $ this -> getPrimaryAttribute ( $ attribute ) ; if ( ! property_exists ( $ this , 'distinctValues' ) ) { return $ this -> extractDistinctValues ( $ attributeName ) ; } if ( ! array_key_exists ( $ attributeName , $ this -> distinctValues ) ) { $ th... | Get the values to distinct between . |
20,942 | protected function extractDistinctValues ( $ attribute ) { $ attributeData = ValidationData :: extractDataFromPath ( ValidationData :: getLeadingExplicitAttributePath ( $ attribute ) , $ this -> data ) ; $ pattern = str_replace ( '\*' , '[^.]+' , preg_quote ( $ attribute , '#' ) ) ; return Arr :: where ( Arr :: dot ( $... | Extract the distinct values from the data . |
20,943 | public function validateEmail ( $ attribute , $ value ) { if ( ! is_string ( $ value ) && ! ( is_object ( $ value ) && method_exists ( $ value , '__toString' ) ) ) { return false ; } return ( new EmailValidator ) -> isValid ( $ value , new RFCValidation ) ; } | Validate that an attribute is a valid e - mail address . |
20,944 | protected function prepareUniqueId ( $ id ) { if ( preg_match ( '/\[(.*)\]/' , $ id , $ matches ) ) { $ id = $ this -> getValue ( $ matches [ 1 ] ) ; } if ( strtolower ( $ id ) === 'null' ) { $ id = null ; } if ( filter_var ( $ id , FILTER_VALIDATE_INT ) !== false ) { $ id = ( int ) $ id ; } return $ id ; } | Prepare the given ID for querying . |
20,945 | public function validateGt ( $ attribute , $ value , $ parameters ) { $ this -> requireParameterCount ( 1 , $ parameters , 'gt' ) ; $ comparedToValue = $ this -> getValue ( $ parameters [ 0 ] ) ; $ this -> shouldBeNumeric ( $ attribute , 'Gt' ) ; if ( is_null ( $ comparedToValue ) && ( is_numeric ( $ value ) && is_nume... | Validate that an attribute is greater than another attribute . |
20,946 | public function validateInArray ( $ attribute , $ value , $ parameters ) { $ this -> requireParameterCount ( 1 , $ parameters , 'in_array' ) ; $ explicitPath = ValidationData :: getLeadingExplicitAttributePath ( $ parameters [ 0 ] ) ; $ attributeData = ValidationData :: extractDataFromPath ( $ explicitPath , $ this -> ... | Validate that the values of an attribute is in another attribute . |
20,947 | public function validateMimes ( $ attribute , $ value , $ parameters ) { if ( ! $ this -> isValidFileInstance ( $ value ) ) { return false ; } if ( $ this -> shouldBlockPhpUpload ( $ value , $ parameters ) ) { return false ; } return $ value -> getPath ( ) !== '' && in_array ( $ value -> guessExtension ( ) , $ paramete... | Validate the guessed extension of a file upload is in a set of file extensions . |
20,948 | protected function shouldBlockPhpUpload ( $ value , $ parameters ) { if ( in_array ( 'php' , $ parameters ) ) { return false ; } $ phpExtensions = [ 'php' , 'php3' , 'php4' , 'php5' , 'phtml' , ] ; return ( $ value instanceof UploadedFile ) ? in_array ( trim ( strtolower ( $ value -> getClientOriginalExtension ( ) ) ) ... | Check if PHP uploads are explicitly allowed . |
20,949 | protected function allFailingRequired ( array $ attributes ) { foreach ( $ attributes as $ key ) { if ( $ this -> validateRequired ( $ key , $ this -> getValue ( $ key ) ) ) { return false ; } } return true ; } | Determine if all of the given attributes fail the required test . |
20,950 | public function validateUrl ( $ attribute , $ value ) { if ( ! is_string ( $ value ) ) { return false ; } $ pattern = '~^ ((aaa|aaas|about|acap|acct|acr|adiumxtra|afp|afs|aim|apt|attachment|aw|barion|beshare|bitcoin|blob|bolo|callto|cap|chrome|chrome-extension|cid|coap|coaps|com-eventbrite-attendee|content|c... | Validate that an attribute is a valid URL . |
20,951 | protected function compare ( $ first , $ second , $ operator ) { switch ( $ operator ) { case '<' : return $ first < $ second ; case '>' : return $ first > $ second ; case '<=' : return $ first <= $ second ; case '>=' : return $ first >= $ second ; case '=' : return $ first == $ second ; default : throw new InvalidArgu... | Determine if a comparison passes between the given values . |
20,952 | protected function shouldBeNumeric ( $ attribute , $ rule ) { if ( is_numeric ( $ this -> getValue ( $ attribute ) ) ) { $ this -> numericRules [ ] = $ rule ; } } | Adds the existing rule to the numericRules array if the attribute s value is numeric . |
20,953 | public function getFromJson ( $ key , array $ replace = [ ] , $ locale = null ) { $ locale = $ locale ? : $ this -> locale ; $ this -> load ( '*' , '*' , $ locale ) ; $ line = $ this -> loaded [ '*' ] [ '*' ] [ $ locale ] [ $ key ] ?? null ; if ( ! isset ( $ line ) ) { $ fallback = $ this -> get ( $ key , $ replace , $... | Get the translation for a given key from the JSON translation files . |
20,954 | public function load ( $ namespace , $ group , $ locale ) { if ( $ this -> isLoaded ( $ namespace , $ group , $ locale ) ) { return ; } $ lines = $ this -> loader -> load ( $ locale , $ group , $ namespace ) ; $ this -> loaded [ $ namespace ] [ $ group ] [ $ locale ] = $ lines ; } | Load the specified language group . |
20,955 | public function markdown ( $ view , array $ data = [ ] ) { $ this -> markdown = $ view ; $ this -> viewData = $ data ; $ this -> view = null ; return $ this ; } | Set the Markdown template for the notification . |
20,956 | public function replyTo ( $ address , $ name = null ) { if ( $ this -> arrayOfAddresses ( $ address ) ) { $ this -> replyTo += $ this -> parseAddresses ( $ address ) ; } else { $ this -> replyTo [ ] = [ $ address , $ name ] ; } return $ this ; } | Set the reply to address of the message . |
20,957 | public function cc ( $ address , $ name = null ) { if ( $ this -> arrayOfAddresses ( $ address ) ) { $ this -> cc += $ this -> parseAddresses ( $ address ) ; } else { $ this -> cc [ ] = [ $ address , $ name ] ; } return $ this ; } | Set the cc address for the mail message . |
20,958 | public function bcc ( $ address , $ name = null ) { if ( $ this -> arrayOfAddresses ( $ address ) ) { $ this -> bcc += $ this -> parseAddresses ( $ address ) ; } else { $ this -> bcc [ ] = [ $ address , $ name ] ; } return $ this ; } | Set the bcc address for the mail message . |
20,959 | protected function parseAddresses ( $ value ) { return collect ( $ value ) -> map ( function ( $ address , $ name ) { return [ $ address , is_numeric ( $ name ) ? null : $ name ] ; } ) -> values ( ) -> all ( ) ; } | Parse the multi - address array into the necessary format . |
20,960 | public function render ( ) { return Container :: getInstance ( ) -> make ( Markdown :: class ) -> render ( $ this -> markdown , $ this -> data ( ) ) ; } | Render the mail notification message into an HTML string . |
20,961 | public function has ( $ key ) { return ! collect ( is_array ( $ key ) ? $ key : func_get_args ( ) ) -> contains ( function ( $ key ) { return is_null ( $ this -> get ( $ key ) ) ; } ) ; } | Checks if a key is present and not null . |
20,962 | public function raw ( $ class , array $ attributes = [ ] , $ name = 'default' ) { return array_merge ( call_user_func ( $ this -> definitions [ $ class ] [ $ name ] , $ this -> faker ) , $ attributes ) ; } | Get the raw attribute array for a given model . |
20,963 | public function of ( $ class , $ name = 'default' ) { return new FactoryBuilder ( $ class , $ name , $ this -> definitions , $ this -> states , $ this -> afterMaking , $ this -> afterCreating , $ this -> faker ) ; } | Create a builder for the given model . |
20,964 | public function load ( $ path ) { $ factory = $ this ; if ( is_dir ( $ path ) ) { foreach ( Finder :: create ( ) -> files ( ) -> name ( '*.php' ) -> in ( $ path ) as $ file ) { require $ file -> getRealPath ( ) ; } } return $ factory ; } | Load factories from path . |
20,965 | public function selectRaw ( $ expression , array $ bindings = [ ] ) { $ this -> addSelect ( new Expression ( $ expression ) ) ; if ( $ bindings ) { $ this -> addBinding ( $ bindings , 'select' ) ; } return $ this ; } | Add a new raw select expression to the query . |
20,966 | public function fromRaw ( $ expression , $ bindings = [ ] ) { $ this -> from = new Expression ( $ expression ) ; $ this -> addBinding ( $ bindings , 'from' ) ; return $ this ; } | Add a raw from clause to the query . |
20,967 | protected function createSub ( $ query ) { if ( $ query instanceof Closure ) { $ callback = $ query ; $ callback ( $ query = $ this -> forSubQuery ( ) ) ; } return $ this -> parseSub ( $ query ) ; } | Creates a subquery and parse it . |
20,968 | protected function parseSub ( $ query ) { if ( $ query instanceof self || $ query instanceof EloquentBuilder ) { return [ $ query -> toSql ( ) , $ query -> getBindings ( ) ] ; } elseif ( is_string ( $ query ) ) { return [ $ query , [ ] ] ; } else { throw new InvalidArgumentException ; } } | Parse the subquery into SQL and bindings . |
20,969 | public function addSelect ( $ column ) { $ column = is_array ( $ column ) ? $ column : func_get_args ( ) ; $ this -> columns = array_merge ( ( array ) $ this -> columns , $ column ) ; return $ this ; } | Add a new select column to the query . |
20,970 | public function leftJoinSub ( $ query , $ as , $ first , $ operator = null , $ second = null ) { return $ this -> joinSub ( $ query , $ as , $ first , $ operator , $ second , 'left' ) ; } | Add a subquery left join to the query . |
20,971 | protected function addArrayOfWheres ( $ column , $ boolean , $ method = 'where' ) { return $ this -> whereNested ( function ( $ query ) use ( $ column , $ method , $ boolean ) { foreach ( $ column as $ key => $ value ) { if ( is_numeric ( $ key ) && is_array ( $ value ) ) { $ query -> { $ method } ( ... array_values ( ... | Add an array of where clauses to the query . |
20,972 | protected function invalidOperator ( $ operator ) { return ! in_array ( strtolower ( $ operator ) , $ this -> operators , true ) && ! in_array ( strtolower ( $ operator ) , $ this -> grammar -> getOperators ( ) , true ) ; } | Determine if the given operator is supported . |
20,973 | public function orWhereColumn ( $ first , $ operator = null , $ second = null ) { return $ this -> whereColumn ( $ first , $ operator , $ second , 'or' ) ; } | Add an or where clause comparing two columns to the query . |
20,974 | protected function whereInExistingQuery ( $ column , $ query , $ boolean , $ not ) { $ type = $ not ? 'NotInSub' : 'InSub' ; $ this -> wheres [ ] = compact ( 'type' , 'column' , 'query' , 'boolean' ) ; $ this -> addBinding ( $ query -> getBindings ( ) , 'where' ) ; return $ this ; } | Add an external sub - select to the query . |
20,975 | public function whereIntegerInRaw ( $ column , $ values , $ boolean = 'and' , $ not = false ) { $ type = $ not ? 'NotInRaw' : 'InRaw' ; if ( $ values instanceof Arrayable ) { $ values = $ values -> toArray ( ) ; } foreach ( $ values as & $ value ) { $ value = ( int ) $ value ; } $ this -> wheres [ ] = compact ( 'type' ... | Add a where in raw clause for integer values to the query . |
20,976 | public function whereIntegerNotInRaw ( $ column , $ values , $ boolean = 'and' ) { return $ this -> whereIntegerInRaw ( $ column , $ values , $ boolean , true ) ; } | Add a where not in raw clause for integer values to the query . |
20,977 | public function whereNotBetween ( $ column , array $ values , $ boolean = 'and' ) { return $ this -> whereBetween ( $ column , $ values , $ boolean , true ) ; } | Add a where not between statement to the query . |
20,978 | public function orWhereDate ( $ column , $ operator , $ value = null ) { [ $ value , $ operator ] = $ this -> prepareValueAndOperator ( $ value , $ operator , func_num_args ( ) === 2 ) ; return $ this -> whereDate ( $ column , $ operator , $ value , 'or' ) ; } | Add an or where date statement to the query . |
20,979 | public function orWhereTime ( $ column , $ operator , $ value = null ) { [ $ value , $ operator ] = $ this -> prepareValueAndOperator ( $ value , $ operator , func_num_args ( ) === 2 ) ; return $ this -> whereTime ( $ column , $ operator , $ value , 'or' ) ; } | Add an or where time statement to the query . |
20,980 | public function orWhereMonth ( $ column , $ operator , $ value = null ) { [ $ value , $ operator ] = $ this -> prepareValueAndOperator ( $ value , $ operator , func_num_args ( ) === 2 ) ; return $ this -> addDateBasedWhere ( 'Month' , $ column , $ operator , $ value , 'or' ) ; } | Add an or where month statement to the query . |
20,981 | public function whereRowValues ( $ columns , $ operator , $ values , $ boolean = 'and' ) { if ( count ( $ columns ) !== count ( $ values ) ) { throw new InvalidArgumentException ( 'The number of columns must match the number of values' ) ; } $ type = 'RowValues' ; $ this -> wheres [ ] = compact ( 'type' , 'columns' , '... | Adds a where condition using row values . |
20,982 | public function whereJsonContains ( $ column , $ value , $ boolean = 'and' , $ not = false ) { $ type = 'JsonContains' ; $ this -> wheres [ ] = compact ( 'type' , 'column' , 'value' , 'boolean' , 'not' ) ; if ( ! $ value instanceof Expression ) { $ this -> addBinding ( $ this -> grammar -> prepareBindingForJsonContains... | Add a where JSON contains clause to the query . |
20,983 | public function whereJsonDoesntContain ( $ column , $ value , $ boolean = 'and' ) { return $ this -> whereJsonContains ( $ column , $ value , $ boolean , true ) ; } | Add a where JSON not contains clause to the query . |
20,984 | public function whereJsonLength ( $ column , $ operator , $ value = null , $ boolean = 'and' ) { $ type = 'JsonLength' ; [ $ value , $ operator ] = $ this -> prepareValueAndOperator ( $ value , $ operator , func_num_args ( ) === 2 ) ; $ this -> wheres [ ] = compact ( 'type' , 'column' , 'operator' , 'value' , 'boolean'... | Add a where JSON length clause to the query . |
20,985 | public function orWhereJsonLength ( $ column , $ operator , $ value = null ) { [ $ value , $ operator ] = $ this -> prepareValueAndOperator ( $ value , $ operator , func_num_args ( ) === 2 ) ; return $ this -> whereJsonLength ( $ column , $ operator , $ value , 'or' ) ; } | Add a or where JSON length clause to the query . |
20,986 | public function havingBetween ( $ column , array $ values , $ boolean = 'and' , $ not = false ) { $ type = 'between' ; $ this -> havings [ ] = compact ( 'type' , 'column' , 'values' , 'boolean' , 'not' ) ; $ this -> addBinding ( $ this -> cleanBindings ( $ values ) , 'having' ) ; return $ this ; } | Add a having between clause to the query . |
20,987 | public function offset ( $ value ) { $ property = $ this -> unions ? 'unionOffset' : 'offset' ; $ this -> $ property = max ( 0 , $ value ) ; return $ this ; } | Set the offset value of the query . |
20,988 | public function forPageBeforeId ( $ perPage = 15 , $ lastId = 0 , $ column = 'id' ) { $ this -> orders = $ this -> removeExistingOrdersFor ( $ column ) ; if ( ! is_null ( $ lastId ) ) { $ this -> where ( $ column , '<' , $ lastId ) ; } return $ this -> orderBy ( $ column , 'desc' ) -> take ( $ perPage ) ; } | Constrain the query to the previous page of results before a given ID . |
20,989 | protected function pluckFromArrayColumn ( $ queryResult , $ column , $ key ) { $ results = [ ] ; if ( is_null ( $ key ) ) { foreach ( $ queryResult as $ row ) { $ results [ ] = $ row [ $ column ] ; } } else { foreach ( $ queryResult as $ row ) { $ results [ $ row [ $ key ] ] = $ row [ $ column ] ; } } return collect ( ... | Retrieve column values from rows represented as arrays . |
20,990 | public function numericAggregate ( $ function , $ columns = [ '*' ] ) { $ result = $ this -> aggregate ( $ function , $ columns ) ; if ( ! $ result ) { return 0 ; } if ( is_int ( $ result ) || is_float ( $ result ) ) { return $ result ; } return strpos ( ( string ) $ result , '.' ) === false ? ( int ) $ result : ( floa... | Execute a numeric aggregate function on the database . |
20,991 | protected function setAggregate ( $ function , $ columns ) { $ this -> aggregate = compact ( 'function' , 'columns' ) ; if ( empty ( $ this -> groups ) ) { $ this -> orders = null ; $ this -> bindings [ 'order' ] = [ ] ; } return $ this ; } | Set the aggregate property without running the query . |
20,992 | protected function onceWithColumns ( $ columns , $ callback ) { $ original = $ this -> columns ; if ( is_null ( $ original ) ) { $ this -> columns = $ columns ; } $ result = $ callback ( ) ; $ this -> columns = $ original ; return $ result ; } | Execute the given callback while selecting the given columns . |
20,993 | public function insertUsing ( array $ columns , $ query ) { [ $ sql , $ bindings ] = $ this -> createSub ( $ query ) ; return $ this -> connection -> insert ( $ this -> grammar -> compileInsertUsing ( $ this , $ columns , $ sql ) , $ this -> cleanBindings ( $ bindings ) ) ; } | Insert new records into the table using a subquery . |
20,994 | protected function registerPsrRequest ( ) { $ this -> app -> bind ( ServerRequestInterface :: class , function ( $ app ) { return ( new DiactorosFactory ) -> createRequest ( $ app -> make ( 'request' ) ) ; } ) ; } | Register a binding for the PSR - 7 request implementation . |
20,995 | protected function registerResponseFactory ( ) { $ this -> app -> singleton ( ResponseFactoryContract :: class , function ( $ app ) { return new ResponseFactory ( $ app [ ViewFactoryContract :: class ] , $ app [ 'redirect' ] ) ; } ) ; } | Register the response factory implementation . |
20,996 | protected function tryAgainIfCausedByLostConnection ( QueryException $ e , $ query , $ bindings , Closure $ callback ) { if ( $ this -> causedByLostConnection ( $ e -> getPrevious ( ) ) ) { $ this -> reconnect ( ) ; return $ this -> runQueryCallback ( $ query , $ bindings , $ callback ) ; } throw $ e ; } | Handle a query exception that occurred during query execution . |
20,997 | public function reconnect ( ) { if ( is_callable ( $ this -> reconnector ) ) { $ this -> doctrineConnection = null ; return call_user_func ( $ this -> reconnector , $ this ) ; } throw new LogicException ( 'Lost connection and no reconnector available.' ) ; } | Reconnect to the database . |
20,998 | public function listen ( Closure $ callback ) { if ( isset ( $ this -> events ) ) { $ this -> events -> listen ( Events \ QueryExecuted :: class , $ callback ) ; } } | Register a database query listener with the connection . |
20,999 | public function getDoctrineColumn ( $ table , $ column ) { $ schema = $ this -> getDoctrineSchemaManager ( ) ; return $ schema -> listTableDetails ( $ table ) -> getColumn ( $ column ) ; } | Get a Doctrine Schema Column instance . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.