idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
11,400
public function load ( ) { if ( auth ( ) -> guest ( ) ) { return new Collection ( ) ; } return ComponentParams :: withoutGlobalScopes ( ) -> select ( [ 'tbl_widgets_params.id' , 'tbl_widgets_params.wid' , 'tbl_widgets_params.resource' , 'tbl_widgets_params.name' , 'tbl_widgets_params.data' ] ) -> where ( 'brand_id' , b...
Loads all ui components
11,401
public function addViewComponent ( $ package , $ namespace , $ path ) { $ files = $ this -> app -> make ( 'files' ) ; $ view = $ this -> app -> make ( 'view' ) ; foreach ( $ this -> getAppViewPaths ( $ package ) as $ appView ) { if ( $ files -> isDirectory ( $ appView ) ) { $ view -> addNamespace ( $ namespace , $ appV...
Register the package s view component namespaces .
11,402
public function onMessage ( $ server , $ serverSocket , $ frame ) { $ id = $ frame -> fd ; if ( isset ( $ this -> connections [ $ id ] ) ) { $ this -> fireMessageEvent ( $ this -> connections [ $ id ] [ 'handler' ] , $ this -> connections [ $ id ] [ 'connection' ] , $ frame ) ; } }
Called when the server receive a WebSocket message frame .
11,403
public function onClose ( $ server , $ serverSocket , $ id ) { if ( isset ( $ this -> connections [ $ id ] ) ) { $ this -> fireCloseEvent ( $ this -> connections [ $ id ] [ 'handler' ] , $ this -> connections [ $ id ] [ 'connection' ] ) ; unset ( $ this -> connections [ $ id ] ) ; } }
Called when a connection has been closed .
11,404
protected function acceptConnection ( $ server , $ request , $ httpRequest , $ handler ) { $ id = $ request -> fd ; $ connection = $ this -> createWebSocketConnection ( $ server , $ id ) ; $ this -> fireOpenEvent ( $ handler , $ connection , $ httpRequest ) ; $ this -> connections [ $ id ] = compact ( 'connection' , 'h...
Accept the web socket connection .
11,405
protected function fireMessageEvent ( $ handler , $ connection , $ frame ) { $ isBinary = $ frame -> opcode == WEBSOCKET_OPCODE_BINARY ; $ this -> fireWebSocketHandler ( $ handler , 'onMessage' , $ connection , $ isBinary , $ frame -> data ) ; }
Fire the message received event .
11,406
protected function fireWebSocketHandler ( $ handler , $ method , ... $ arguments ) { if ( $ handler == null ) { return ; } try { call_user_func ( [ $ handler , $ method ] , ... $ arguments ) ; } catch ( Exception $ e ) { $ this -> reportException ( $ e ) ; } catch ( Throwable $ e ) { $ this -> reportException ( new Fat...
Send the event to the handler .
11,407
public function file ( FieldContract $ field ) { $ attributes = $ this -> html -> decorate ( $ field -> get ( 'attributes' ) , [ 'class' => 'form-control' ] ) ; return $ this -> form -> file ( $ field -> get ( 'name' ) , $ attributes ) ; }
File template .
11,408
public function input ( FieldContract $ field ) { $ attributes = $ field -> get ( 'attributes' ) ; if ( isset ( $ attributes [ 'field' ] ) ) { unset ( $ attributes [ 'field' ] ) ; } $ decoratedAttributes = $ this -> html -> decorate ( $ attributes ) ; return $ this -> form -> input ( $ field -> get ( 'type' ) , $ field...
Input template .
11,409
protected function getValidationRules ( $ inputName , $ validator ) { $ validator -> onUpload ( ) ; $ rules = $ validator -> getValidationRules ( ) ; $ attributes = [ ] ; foreach ( $ rules [ $ inputName ] as $ rule ) { if ( strpos ( $ rule , ':' ) !== FALSE ) { list ( $ rulename , $ value ) = explode ( ':' , $ rule ) ;...
getting dropzone validation rules from validator
11,410
protected function getDefaultQueryGrammar ( ) { $ driver = $ this -> ci -> db -> dbdriver ; switch ( $ driver ) { case 'mysql' : case 'mysqli' : if ( class_exists ( '\Illuminate\Database\Query\Grammars\MySqlGrammar' ) ) { return $ this -> withTablePrefix ( new \ Illuminate \ Database \ Query \ Grammars \ MySqlGrammar )...
Get the default query grammar instance .
11,411
protected function getDefaultSchemaGrammar ( ) { $ driver = $ this -> ci -> db -> dbdriver ; switch ( $ driver ) { case 'mysql' : case 'mysqli' : return $ this -> withTablePrefix ( new \ Illuminate \ Database \ Schema \ Grammars \ MySqlGrammar ) ; } throw new \ InvalidArgumentException ( "Unsupported CodeIgniter databa...
Get the default schema grammar instance .
11,412
public function fetchResult ( $ result ) { $ fetchMode = $ this -> fetchMode ; switch ( $ fetchMode ) { case PDO :: FETCH_ASSOC : return $ result -> result_array ( ) ; case PDO :: FETCH_OBJ : return $ result -> result ( ) ; } throw new \ BadMethodCallException ( "Unsupported fetch mode '$fetchMode'." ) ; }
Fetch a CodeIgniter result set as an array or object emulating current PDO fetch mode
11,413
public static function make ( string $ type , string $ message , string $ url = null ) : ResponseHelper { return new static ( $ type , $ message , $ url ) ; }
Creates a response .
11,414
public function notify ( ) : ResponseHelper { $ this -> notified = true ; app ( 'antares.messages' ) -> add ( $ this -> type , $ this -> message ) ; return $ this ; }
Send the message to the session flash .
11,415
public function redirect ( ) : RedirectResponse { if ( ! $ this -> notified ) { $ this -> notify ( ) ; } $ url = $ this -> url ? : app ( UrlGenerator :: class ) -> previous ( ) ; return response ( ) -> redirectTo ( $ url ) ; }
Returns redirect response with notification .
11,416
public function resolve ( Request $ request ) : Response { if ( $ request -> expectsJson ( ) ) { return $ this -> json ( ) ; } return $ this -> redirect ( ) ; }
Returns dedicated response based on the given request .
11,417
public function hasAreaInUri ( ) : bool { $ segment = $ this -> request -> segment ( 1 ) ; $ area = $ segment ? $ this -> getById ( $ segment ) : null ; return ! ! $ area ; }
Checks if the route has area .
11,418
public function getCurrentArea ( ) : AreaContract { $ segment = $ this -> request -> segment ( 1 ) ; $ area = $ segment ? $ this -> getById ( $ segment ) : null ; if ( ! $ area && $ this -> auth -> check ( ) ) { $ user = $ this -> auth -> user ( ) ; $ areas = $ user -> getArea ( ) ; if ( is_array ( $ areas ) ) { $ area...
Gets an area object based on the current authentication and URI .
11,419
public function getFrontendAreas ( ) : AreasCollection { $ areas = ( array ) Arr :: get ( $ this -> config , 'routes.frontend' , self :: $ fallbackFrontendRoutes ) ; $ collection = new AreasCollection ( ) ; foreach ( $ areas as $ areaId ) { $ area = $ this -> areas -> getById ( $ areaId ) ; if ( $ area ) { $ collection...
Returns collection of frontend areas .
11,420
public function getBackendAreas ( ) : AreasCollection { $ areas = ( array ) Arr :: get ( $ this -> config , 'routes.backend' , self :: $ fallbackBackendRoutes ) ; $ collection = new AreasCollection ( ) ; foreach ( $ areas as $ areaId ) { $ area = $ this -> areas -> getById ( $ areaId ) ; if ( $ area ) { $ collection ->...
Returns collection of backend areas .
11,421
public function getByIdOrDefault ( string $ id ) : AreaContract { $ area = $ this -> getById ( $ id ) ; return $ area ? : $ this -> getDefault ( ) ; }
Returns an area object based on ID . Default area returns if not found the desired one .
11,422
protected function decodeStreamCommon ( $ request , $ stream , $ headers = false , $ cookies = array ( ) , $ statuscode = "200" ) { $ this -> Cookies = $ cookies ; $ this -> Headers = $ headers ; $ this -> StatusCode = $ statuscode ; $ this -> ContentType = '' ; $ this -> Charset = '' ; if ( isset ( $ headers [ 'conten...
Sets internal members from http data resets response to be not faulty . We make this code available here instead of in decodeStream to force child classes them to write their own handlers
11,423
public function exist ( $ id ) { is_string ( $ id ) && $ id = $ this -> getSlugFromName ( $ id ) ; return isset ( $ this -> items [ $ id ] ) ; }
Check if an id is set in the collection .
11,424
public function remove ( $ key ) { if ( is_null ( $ key ) ) { throw new InvalidArgumentException ( "Can't add NULL {$this->name}." ) ; } if ( ! is_null ( $ id = $ this -> search ( $ key ) ) ) { unset ( $ this -> items [ $ id ] ) ; return true ; } return false ; }
Remove a key from collection .
11,425
protected function getSlugFromName ( $ name ) { if ( array_key_exists ( $ name , self :: $ sluggedNames ) ) { return self :: $ sluggedNames [ $ name ] ; } return self :: $ sluggedNames [ $ name ] = trim ( Str :: slug ( $ name , '-' ) ) ; }
Get slug name .
11,426
public function save ( array $ options = array ( ) ) { try { DB :: transaction ( function ( ) use ( $ options ) { $ this -> fill ( $ options ) ; parent :: save ( ) ; } ) ; return true ; } catch ( Exception $ e ) { Log :: emergency ( $ e ) ; return false ; } }
try to save widget
11,427
public static function abbreviate ( $ inputString , $ lowerLimit , $ upperLimit = - 1 , $ append = StringUtils :: EMPTY_STR ) { if ( true === StringUtils :: isEmpty ( $ inputString ) ) { return $ inputString ; } $ length = StringUtils :: length ( $ inputString ) ; if ( $ lowerLimit > $ length ) { $ lowerLimit = $ lengt...
Abbreviates a string nicely .
11,428
public static function capitalizeFully ( $ inputString ) { $ inputStringLower = StringUtils :: lowerCase ( $ inputString ) ; $ result = self :: capitalize ( $ inputStringLower ) ; return $ result ; }
Converts all the whitespace separated words in a string into capitalized words that is each word is made up of a titlecase character and then a series of lowercase characters .
11,429
public static function uncapitalize ( $ inputString ) { $ func = function ( array $ matches ) { return StringUtils :: lowerCase ( $ matches [ 0 ] ) ; } ; return \ preg_replace_callback ( '~\b\w~' , $ func , $ inputString ) ; }
Uncapitalizes all the whitespace separated words in a string .
11,430
public static function initials ( $ inputString , array $ delimiters = null ) { if ( true === StringUtils :: isEmpty ( $ inputString ) ) { return $ inputString ; } if ( ( null !== $ delimiters ) && ( 0 === \ count ( $ delimiters ) ) ) { return StringUtils :: EMPTY_STR ; } $ inputStringLen = StringUtils :: length ( $ in...
Extracts the initial letters from each word in the string .
11,431
private static function isDelimiter ( $ char , array $ delimiters = null ) { if ( null === $ delimiters ) { return \ ctype_space ( $ char ) ; } foreach ( $ delimiters as $ delimiter ) { if ( $ char === $ delimiter ) { return true ; } } return false ; }
Checks whether the specified string is a delimiter .
11,432
public static function swapCase ( $ inputString ) { if ( true === StringUtils :: isEmpty ( $ inputString ) ) { return $ inputString ; } $ buffer = \ str_split ( $ inputString ) ; $ length = \ count ( $ buffer ) ; for ( $ i = 0 ; $ i < $ length ; ++ $ i ) { $ char = $ buffer [ $ i ] ; if ( true === \ ctype_upper ( $ cha...
Swaps the case of a string using a word based algorithm .
11,433
public static function wrap ( $ inputString , $ wrapLength , $ newLineInsertion = null , $ wrapLongWords = false ) { if ( null === $ inputString ) { return null ; } if ( null === $ newLineInsertion ) { $ newLineInsertion = \ PHP_EOL ; } if ( 1 > $ wrapLength ) { $ wrapLength = 1 ; } $ wordWrap = \ wordwrap ( StringUtil...
Wraps a single line of text identifying words by .
11,434
public function all ( $ params = array ( ) ) { $ arr = array ( "currency" => $ params [ "currency" ] ) ; $ rawResponse = $ this -> client -> request ( 'get' , 'api/deposit_money' , $ arr ) ; return $ rawResponse ; }
You Get Deposit history
11,435
public function fast ( $ params = array ( ) ) { $ arr = array ( "id" => $ params [ "id" ] ) ; $ rawResponse = $ this -> client -> request ( 'post' , 'api/deposit_money/' . $ arr [ "id" ] . "/fast" , $ arr ) ; return $ rawResponse ; }
Deposit Bitcoin Faster
11,436
public function deleteCall ( $ index = null ) { $ calls = $ this -> listCalls ( ) ; if ( $ index === null ) { $ index = \ count ( $ calls ) - 1 ; } $ call = $ calls [ $ index ] ; unset ( $ calls [ $ index ] ) ; $ calls = array_values ( $ calls ) ; $ this -> setOption ( 'calls' , $ calls ) ; return $ call ; }
Delete a call from the stack
11,437
public function attach ( Provider $ memory = null ) { if ( $ this -> attached ( ) && $ memory !== $ this -> memory ) { } if ( ! is_null ( $ memory ) ) { $ this -> setMemoryProvider ( $ memory ) ; $ this -> initiate ( ) ; } }
Bind current ACL instance with a Memory instance .
11,438
protected function initiate ( ) { $ name = $ this -> name ; $ data = [ 'acl' => [ ] , 'actions' => [ ] , 'roles' => [ ] ] ; $ data = array_merge ( $ data , $ this -> memory -> get ( "acl_{$name}" , [ ] ) ) ; if ( empty ( $ data [ 'roles' ] ) ) { $ roles = $ this -> memory -> get ( 'acl_antares.roles' ) ; $ data [ 'role...
Initiate acl data from memory .
11,439
public function save ( $ descriptions = null , $ categories = null ) { if ( $ this -> attached ( ) ) { $ name = $ this -> name ; $ this -> memory -> put ( "acl_{$name}" , [ 'acl' => $ this -> acl , 'actions' => $ this -> actions -> get ( ) , 'roles' => $ this -> roles -> get ( ) , 'descriptions' => $ descriptions , 'ca...
Saves authorization changes
11,440
public function apply ( Builder $ builder , Model $ model ) { $ column = $ this -> getPolicyColumn ( $ model ) ; if ( is_null ( $ column ) && get_class ( $ model ) !== \ Antares \ Model \ User :: class ) { return ; } if ( ! auth ( ) -> user ( ) ) { return ; } $ id = auth ( ) -> user ( ) -> roles -> first ( ) -> id ; $ ...
apply active logs global scope
11,441
protected function getPolicyColumn ( Model $ model ) { $ connection = $ model -> getConnection ( ) ; $ table = $ connection -> getTablePrefix ( ) . $ model -> getTable ( ) ; $ schema = $ connection -> getDoctrineSchemaManager ( $ table ) ; $ columns = Cache :: remember ( 'keys_' . $ table , 30 , function ( ) use ( $ mo...
get column name which can be used as user connector
11,442
public function foundation ( ) { $ path = rtrim ( $ this -> app -> make ( 'path.base' ) , '/' ) . '/src/core/foundation/resources/public' ; if ( ! $ this -> app -> make ( 'files' ) -> isDirectory ( $ path ) ) { return false ; } try { return $ this -> publish ( 'antares/foundation' , $ path ) ; } catch ( Exception $ e )...
Migrate Antares .
11,443
public function delete ( $ name ) { $ path = public_path ( ) . DIRECTORY_SEPARATOR . 'packages' . DIRECTORY_SEPARATOR . $ name ; if ( ! $ this -> app -> make ( 'files' ) -> isDirectory ( $ path ) ) { return false ; } try { return $ this -> publisher -> delete ( $ path ) ; } catch ( Exception $ ex ) { Log :: emergency (...
deletes published extension asset
11,444
public function getMetaAttribute ( $ value ) { $ meta = [ ] ; if ( ! is_null ( $ value ) ) { $ meta = json_decode ( $ value , true ) ; } return new Meta ( $ meta ) ; }
meta field accessor .
11,445
protected function createAdminMenu ( ) { $ config = config ( 'menu' ) ; $ events = $ this -> app -> make ( 'events' ) ; foreach ( $ config as $ event => $ ordered ) { foreach ( $ ordered as $ name => $ value ) { if ( is_numeric ( $ name ) ) { $ events -> listen ( $ event , $ value ) ; } else { $ events -> listen ( $ ev...
Create Administration Menu for Antares .
11,446
public function tryGetSettingsForm ( ExtensionContract $ extension ) : SettingsFormContract { $ className = $ extension -> getRootNamespace ( ) . self :: $ formClassName ; if ( ! class_exists ( $ className ) ) { throw new InvalidArgumentException ( 'The provided class name [' . $ className . '] does not exist.' ) ; } $...
Returns the instance of settings form by the given extension .
11,447
protected function parseThemeNameFromPath ( $ path ) { $ path = str_replace ( [ '\\' , '/' ] , DIRECTORY_SEPARATOR , $ path ) ; $ path = explode ( DIRECTORY_SEPARATOR , $ path ) ; return array_pop ( $ path ) ; }
Gets folder name from full path .
11,448
protected function createSessionDriver ( $ name ) { $ config = Arr :: get ( $ this -> config , "session.{$name}" , [ ] ) ; return $ this -> createProvider ( new Session ( $ name , $ config ) ) ; }
Create Session driver .
11,449
protected function createRegistryDriver ( $ name ) { $ config = Arr :: get ( $ this -> config , "registry.{$name}" , [ ] ) ; $ cache = $ this -> getCacheRepository ( $ config ) ; return $ this -> createProvider ( Registry :: getInstance ( $ name , $ config , $ this -> app , $ cache ) ) ; }
Create Registry driver .
11,450
protected function createComponentDriver ( $ name ) { $ config = Arr :: get ( $ this -> config , "component.{$name}" , [ ] ) ; $ cache = $ this -> getCacheRepository ( $ config ) ; return $ this -> createProvider ( new Component ( $ name , $ config , $ this -> app , $ cache ) ) ; }
Create Component driver .
11,451
protected function createPrimaryDriver ( $ name ) { $ config = Arr :: get ( $ this -> config , "primary" , [ ] ) ; $ cache = $ this -> getCacheRepository ( $ config ) ; return $ this -> createProvider ( new Handlers \ Primary ( $ name , $ config , $ this -> app , $ cache ) ) ; }
Create Primary driver .
11,452
public static function allowedLanguages ( ) { if ( config ( 'localizer.allowed_langs' ) ) { return self :: addNames ( array_merge ( config ( 'localizer.allowed_langs' ) , [ config ( 'localizer.default_lang' ) ] ) ) ; } else { return self :: addNames ( [ config ( 'localizer.default_lang' ) ] ) ; } }
Get all allowed languages .
11,453
public static function getCode ( $ name = 'default' ) { if ( $ name == 'default' ) { $ name = self :: getLanguage ( ) ; } return self :: addCodes ( [ $ name ] ) [ $ name ] ; }
Returns the current language code .
11,454
public static function getLanguage ( $ code = 'default' ) { if ( $ code == 'default' ) { $ code = App :: getLocale ( ) ; } return self :: addNames ( [ $ code ] ) [ $ code ] ; }
Returns the language name .
11,455
protected function clientSubmit ( $ buttons ) { if ( empty ( $ buttons ) ) { return false ; } $ scripts = false ; foreach ( $ buttons as $ button ) { if ( array_get ( $ button instanceof AbstractType ? $ button -> getAttributes ( ) : $ button -> attributes , 'type' ) !== 'submit' or array_get ( $ button instanceof Abst...
Whether form can be submited by Ctrl + Enter
11,456
protected function addHiddenKey ( GridContract $ grid ) { $ fieldsets = $ grid -> fieldsets ( ) ; if ( $ fieldsets -> isEmpty ( ) ) { return false ; } $ name = $ fieldsets -> first ( ) -> name ; $ name instanceof Closure and $ name = sprintf ( 'fieldset-%d' , $ fieldsets -> count ( ) ) ; $ slugged = str_slug ( $ name )...
append hidden key with resource info
11,457
public function setCustomFieldsValidator ( $ on , $ event , array $ attributes = array ( ) ) { $ this -> customFieldsValidator [ $ on ] = [ $ event => $ attributes ] ; return $ this ; }
custom fields validator setter
11,458
public function isValid ( $ sendHeaders = true ) { app ( \ Antares \ Html \ Adapter \ CustomfieldAdapter :: class ) -> adapt ( $ this -> grid ) ; $ decryptedKey = is_null ( $ key = Input :: get ( 'key' ) ) ? null : Crypt :: decrypt ( $ key ) ; if ( $ this -> grid -> ajaxable !== false && ! $ this -> container -> make (...
does the form is valid
11,459
protected function rules ( Collection $ fieldsets ) { $ grid = $ this -> grid ; if ( ! empty ( $ grid -> rules ) ) { $ controls = [ ] ; foreach ( $ fieldsets as $ fieldset ) { foreach ( $ fieldset -> controls ( ) as $ control ) { array_push ( $ controls , method_exists ( $ control , 'getName' ) ? $ control -> getName (...
verify rules settings depends on controls visibility
11,460
public function getData ( ) { $ fieldsets = $ this -> grid -> fieldsets ; $ controls = [ ] ; foreach ( $ fieldsets as $ fieldset ) { foreach ( $ fieldset -> controls ( ) as $ control ) { array_push ( $ controls , $ control -> name ) ; } } $ keys = $ this -> resolveWithMultiples ( $ controls ) ; return array_only ( inpu...
gets data from post by form controls
11,461
protected function resolveWithMultiples ( array $ controlKeys = array ( ) ) { $ return = [ ] ; foreach ( $ controlKeys as $ key ) { preg_match_all ( "/\[[^\]]*\]/" , $ key , $ matches ) ; if ( isset ( $ matches [ 0 ] ) ) { $ key = str_replace ( is_array ( $ matches [ 0 ] ) ? implode ( '' , $ matches [ 0 ] ) : $ matches...
resolve form keys with multiple fields
11,462
protected function validate ( ) { $ result = $ this -> request ( $ action = 'CheckCredits' ) ; if ( ( int ) $ result <= 0 ) { throw new Exception ( $ this -> config [ 'codes' ] [ '-100' ] ) ; } return $ result ; }
Validates whether connection to gateway is established
11,463
protected function request ( $ action = '' , array $ params = [ ] ) { $ params [ 'Token' ] = $ this -> config [ 'api' ] [ 'token' ] ; if ( $ action !== '' ) { $ params [ 'Action' ] = $ action ; } $ query = http_build_query ( $ params ) ; $ url = $ this -> config [ 'api' ] [ 'url' ] ; $ ch = curl_init ( ) ; curl_setopt ...
Creates request to sms gateway
11,464
public function setSearch ( bool $ search ) : self { if ( ! $ this instanceof Attributable ) { return $ this ; } $ searchOption = 'data-selectAR--search' ; $ search ? $ this -> setAttribute ( $ searchOption , true ) : $ this -> removeAttribute ( $ searchOption ) ; if ( $ this -> hasAttribute ( 'data-selectAR' ) ) { $ t...
Turn on or off search feature for this select
11,465
protected function getActions ( $ row ) { $ classname = get_class ( $ row ) ; return ( array_key_exists ( $ classname , $ this -> actions ) ) ? array_get ( $ this -> actions , $ classname , [ ] ) : [ ] ; }
Gets datatable actions
11,466
public function refer ( ) { if ( $ this -> context == null ) { throw new LogicException ( 'Context must be set before refer to the service.' ) ; } if ( $ this -> proxyFactory == null ) { throw new LogicException ( 'Proxy factory must be set before refer to the service.' ) ; } if ( $ this -> clientFactory == null ) { th...
Reference the interface .
11,467
public function getProxy ( ) { if ( $ this -> proxy !== null ) { return $ this -> proxy ; } return $ this -> proxy = $ this -> createProxy ( ) ; }
Get the calling proxy of interface .
11,468
protected function createProxy ( ) { $ config = $ this -> config ; $ interface = Arr :: pull ( $ config , 'interface' ) ; $ client = $ this -> clientFactory -> client ( Arr :: pull ( $ config , 'client' ) ) ; $ invoker = new RemoteInvoker ( $ this -> context , $ client , $ interface , $ config ) ; $ invoker = $ this ->...
Create the calling proxy .
11,469
public function get ( DataTable $ datatable ) { if ( php_sapi_name ( ) === 'cli' ) { return 10 ; } if ( ! $ this -> request -> hasSession ( ) ) { return ; } $ key = $ this -> getSessionKey ( get_class ( $ datatable ) ) ; $ perPage = $ this -> getFromSession ( $ key , ( int ) request ( 'length' , $ datatable -> perPage ...
Session perpage getter
11,470
public function edit ( Listener $ listener , $ id ) { $ eloquent = with ( new Eloquent ( ) ) -> findOrNew ( $ id ) ; $ name = $ eloquent -> name ; $ raw = app ( 'antares.memory' ) -> make ( 'ui-components' ) -> raw ( ) ; $ data = isset ( $ raw [ $ name ] [ 'data' ] ) ? $ raw [ $ name ] [ 'data' ] : [ ] ; if ( ! empty (...
Shows create form
11,471
public function update ( Listener $ listener , $ id , array $ input ) { $ model = with ( new Eloquent ( ) ) -> findOrNew ( $ id ) ; $ memory = app ( 'antares.memory' ) -> make ( 'ui-components' ) ; $ className = $ memory -> get ( $ model -> name . '.name' ) ; $ component = with ( new $ className ( $ model -> id ) ) ; $...
Updates ui component attributes
11,472
public function ids ( ) { $ keyMap = $ this -> getHandler ( ) -> getKeyMap ( ) ; $ return = [ ] ; foreach ( $ keyMap as $ name => $ values ) { $ return = array_add ( $ return , $ name , $ values [ 'id' ] ) ; } return $ return ; }
get ids based on key map
11,473
public function id ( $ key = null , $ default = null ) { $ element = $ this -> getHandler ( ) -> getKeyMapElement ( $ key , $ default ) ; return is_array ( $ element ) && array_key_exists ( 'id' , $ element ) ? ( int ) $ element [ 'id' ] : $ default ; }
get single key instance
11,474
public function getNameById ( $ id , $ default = null ) { $ keyMap = $ this -> getHandler ( ) -> getKeyMap ( ) ; if ( empty ( $ keyMap ) ) { return $ default ; } foreach ( $ keyMap as $ name => $ value ) { if ( isset ( $ value [ 'id' ] ) && $ value [ 'id' ] == $ id ) { return $ name ; } } return $ default ; }
gets name by id
11,475
public function setupKeyword ( $ value ) { if ( $ this -> isSmartSearch ( ) ) { $ keyword = '%' . $ value . '%' ; if ( $ this -> isWildcard ( ) ) { $ keyword = $ this -> wildcardLikeString ( $ value ) ; } $ keyword = str_replace ( '\\' , '%' , $ keyword ) ; return $ keyword ; } return $ value ; }
Setup search keyword .
11,476
public function wildcardLikeString ( $ str , $ lowercase = true ) { $ wild = '%' ; $ length = Str :: length ( $ str ) ; if ( $ length ) { for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ wild .= $ str [ $ i ] . '%' ; } } if ( $ lowercase ) { $ wild = Str :: lower ( $ wild ) ; } return $ wild ; }
Adds % wildcards to the given string .
11,477
public function prefixColumn ( $ column ) { $ table_names = $ this -> tableNames ( ) ; if ( count ( array_filter ( $ table_names , function ( $ value ) use ( & $ column ) { return strpos ( $ column , $ value . '.' ) === 0 ; } ) ) ) { $ column = $ this -> prefix . $ column ; } return $ column ; }
Will prefix column if needed .
11,478
public function tableNames ( ) { $ names = [ ] ; $ query = $ this -> getQueryBuilder ( ) ; $ names [ ] = $ query -> from ; $ joins = $ query -> joins ? : [ ] ; $ databasePrefix = $ this -> prefix ; foreach ( $ joins as $ join ) { $ table = preg_split ( '/ as /i' , $ join -> table ) ; $ names [ ] = $ table [ 0 ] ; if ( ...
Will look through the query and all it s joins to determine the table names .
11,479
public function getQueryBuilder ( $ instance = null ) { if ( ! $ instance ) { $ instance = $ this -> query ; } if ( $ this -> isQueryBuilder ( ) ) { return $ instance ; } return $ instance -> getQuery ( ) ; }
Get Query Builder object .
11,480
public function removeColumn ( ) { $ names = func_get_args ( ) ; $ this -> columnDef [ 'excess' ] = array_merge ( $ this -> columnDef [ 'excess' ] , $ names ) ; return $ this ; }
Remove column from collection .
11,481
public function filterColumn ( $ column , $ method ) { $ params = func_get_args ( ) ; $ this -> columnDef [ 'filter' ] [ $ column ] = [ 'method' => $ method , 'parameters' => array_splice ( $ params , 2 ) ] ; return $ this ; }
Override default column filter search .
11,482
public function orderColumn ( $ column , $ sql , $ bindings = [ ] ) { $ this -> columnDef [ 'order' ] [ $ column ] = [ 'method' => 'orderByRaw' , 'parameters' => [ $ sql , $ bindings ] ] ; return $ this ; }
Override default column ordering .
11,483
private function getProcessedData ( $ object = false ) { $ processor = new DataProcessor ( $ this -> results ( ) , $ this -> columnDef , $ this -> templates ) ; return $ processor -> process ( $ object ) ; }
Get processed data
11,484
public function overrideGlobalSearch ( \ Closure $ callback , $ parameters ) { $ this -> autoFilter = false ; $ this -> isFilterApplied = true ; $ this -> filterCallback = $ callback ; $ this -> filterCallbackParameters = $ parameters ; }
Update flags to disable global search
11,485
public function getColumnName ( $ index , $ wantsAlias = false ) { $ column = $ this -> request -> columnName ( $ index ) ; if ( is_numeric ( $ column ) ) { $ column = $ this -> getColumnNameByIndex ( $ index ) ; } if ( Str :: contains ( Str :: upper ( $ column ) , ' AS ' ) ) { $ column = $ this -> extractColumnName ( ...
Get column name to be use for filtering and sorting .
11,486
public function dependableActions ( ) { $ actions = config ( 'dependable_actions.' . get_called_class ( ) , [ ] ) ; $ return = [ ] ; foreach ( $ actions as $ action ) { if ( ! $ action instanceof Closure ) { continue ; } $ return [ ] = call_user_func ( $ action , $ this ) ; } return $ return ; }
Get dependable actions
11,487
protected function generateManifestConfig ( array $ jsonable ) { $ manifest = [ ] ; foreach ( $ this -> manifestOptions as $ key => $ default ) { $ manifest [ "{$key}" ] = Arr :: get ( $ jsonable , $ key , $ default ) ; } return $ manifest ; }
Generate a proper manifest configuration for the template .
11,488
public function findFieldsetOrCreateNew ( $ name , Closure $ callback = null ) { foreach ( $ this -> fieldsets as $ fieldset ) { if ( $ fieldset -> getName ( ) === $ name ) { $ fieldset -> update ( $ callback ) ; return $ this -> fieldsets ; } } return $ this -> fieldset ( $ name , $ callback ) ; }
Find the existing Fieldset . It not exists then create a new instance .
11,489
public function find ( $ name ) { if ( Str :: contains ( $ name , '.' ) ) { list ( $ fieldset , $ control ) = explode ( '.' , $ name , 2 ) ; } else { $ fieldset = 'fieldset-0' ; $ control = $ name ; } if ( ! array_key_exists ( $ fieldset , $ this -> keyMap ) ) { throw new InvalidArgumentException ( "Name [{$name}] is n...
Find control that match the given id .
11,490
public function resourced ( $ url , Model $ model , array $ attributes = [ ] ) { $ method = 'POST' ; if ( $ model -> exists ) { $ url = "{$url}/{$model->getKey()}" ; $ method = 'PUT' ; } array_set ( $ attributes , 'method' , $ method ) ; $ this -> with ( $ model ) ; $ this -> attributes ( array_merge ( $ attributes , [...
form params builder without listener
11,491
public function simple ( $ url , array $ attributes = [ ] , $ model = null ) { $ method = Arr :: get ( $ attributes , 'method' , 'POST' ) ; $ this -> attributes ( array_merge ( $ attributes , [ 'url' => $ url , 'method' => $ method , ] ) ) ; $ this -> with ( $ model ) ; return $ this ; }
attach simple form configuration
11,492
public function addResource ( ResourceInterface $ resource ) { $ resourceStr = ( string ) $ resource ; $ this -> container -> register ( RouteAutowiringExtension :: EXTENSION_ALIAS . '.resources.' . sha1 ( $ resourceStr ) , get_class ( $ resource ) ) -> setPublic ( false ) -> setArguments ( [ $ resourceStr ] ) -> addTa...
Add resource to track for changes .
11,493
public function import ( $ resource , $ slot = null , $ type = null ) { if ( null === $ slot ) { $ slot = $ this -> defaultSlot ; } if ( null === $ slot ) { throw new \ InvalidArgumentException ( sprintf ( 'No slot provided for resource "%s".' , $ resource ) ) ; } $ hash = sha1 ( $ slot . '~' . $ resource . ( $ type ? ...
Import a routing file into to the routing - slot .
11,494
public function getFlattenValidators ( ) { if ( ! $ this -> exists ) { return [ ] ; } $ validators = $ this -> validators ; $ return = [ ] ; if ( ! empty ( $ validators ) ) { foreach ( $ validators as $ validator ) { $ return [ $ validator -> validator_id ] = $ validator -> value ; } } return $ return ; }
get flatten validators attached to field
11,495
public function show ( GridStackAdapter $ gridStackAdapter ) { $ gridStackAdapter -> scripts ( ) ; view ( ) -> share ( 'content_class' , 'app-content--gridstack page-dashboard page-dashboard-html widgets-html-page' ) ; return $ this -> processor -> show ( $ this ) ; }
Show User Dashboard .
11,496
public function showDashboard ( ) { set_meta ( 'title' , trans ( 'antares/foundation::title.home' ) ) ; $ this -> app -> make ( 'events' ) -> fire ( 'version.check' ) ; $ this -> app -> make ( 'events' ) -> fire ( new VersionCheck ( ) ) ; if ( ! auth ( ) -> guest ( ) && auth ( ) -> user ( ) -> hasRoles ( 'member' ) ) {...
Response to show dashboard .
11,497
protected static function prepareBinding ( array $ replacements = [ ] , $ prefix = '{' , $ suffix = '}' ) { $ replacements = Arr :: dot ( $ replacements ) ; $ bindings = [ ] ; foreach ( $ replacements as $ key => $ value ) { $ bindings [ "{$prefix}{$key}{$suffix}" ] = $ value ; } return $ bindings ; }
Prepare bindings for text replacement .
11,498
public static function searchable ( $ text , $ wildcard = '*' , $ replacement = '%' ) { if ( ! static :: contains ( $ text , $ wildcard ) ) { return [ "{$text}" , "{$text}{$replacement}" , "{$replacement}{$text}" , "{$replacement}{$text}{$replacement}" , ] ; } return [ str_replace ( $ wildcard , $ replacement , $ text ...
Convert basic string to searchable result .
11,499
public function retrieveAll ( ) { if ( empty ( $ this -> forms ) ) { $ data = $ this -> getModel ( ) -> get ( ) ; $ this -> forms = $ this -> processRetrievedData ( $ data ) ; } return $ this -> forms ; }
Get forms configuration from database