idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
11,000
public function listAlbums ( $ userID = 'default' ) { if ( $ this -> isAuthenticated ( ) ) { $ url = 'https://picasaweb.google.com/data/feed/api/user/' . urlencode ( $ userID ) ; $ jdata = $ this -> query ( $ url , null , array ( 'GData-Version' => 2 ) ) ; $ xml = $ this -> safeXml ( $ jdata -> body ) ; if ( isset ( $ ...
Method to retrieve a list of Picasa Albums
11,001
public function createAlbum ( $ userID = 'default' , $ title = '' , $ access = 'private' , $ summary = '' , $ location = '' , $ time = false , $ keywords = array ( ) ) { if ( $ this -> isAuthenticated ( ) ) { $ time = $ time ? $ time : time ( ) ; $ title = $ title != '' ? $ title : date ( 'F j, Y' ) ; $ xml = new \ Sim...
Method to create a Picasa Album
11,002
protected function getDriverName ( $ driverName ) { if ( false === strpos ( $ driverName , '.' ) ) { $ driverName = "{$driverName}.default" ; } list ( $ driver , $ name ) = explode ( '.' , $ driverName , 2 ) ; $ this -> checkNameIsNotBlacklisted ( $ name ) ; return [ $ driver , $ name ] ; }
Get driver name .
11,003
protected function getFiles ( $ specified ) { $ specified = ( array ) $ specified ; if ( php_sapi_name ( ) === 'cli' ) { return [ ] ; } if ( $ this -> extension === null ) { return [ ] ; } $ path = $ this -> extensionsManager -> getExtensionPathByName ( $ this -> extension ) ; if ( ! $ path ) { return [ ] ; } $ public ...
get files to publish
11,004
public function publishAndPropagate ( array $ files = array ( ) , $ extension = null , $ before = [ ] ) { $ container = $ this -> assetFactory -> container ( $ this -> position ) ; $ applicationContainer = $ this -> assetFactory -> container ( 'antares/foundation::application' ) ; if ( empty ( $ files ) ) { return $ co...
creates symlink as publish and attaches to asset container
11,005
public function publish ( $ extension , $ options = null , $ before = [ ] ) { $ files = $ this -> files ( $ extension , $ options , $ before ) ; return $ this -> publishAndPropagate ( $ files , null , $ before ) ; }
publish assets depends on extension name
11,006
protected function parsePackage ( $ attribute , UploadedFile $ value , $ parameters ) { $ name = $ value -> getClientOriginalName ( ) ; $ this -> directory = $ directory = $ value -> directory ; $ this -> filename = $ filename = $ value -> filename ; $ this -> extension = $ extension = File :: extension ( $ filename ) ...
parse uploaded package
11,007
private function deleteTemporaries ( $ directory ) { if ( is_dir ( $ directory ) ) { $ fileSystem = new Filesystem ( ) ; $ fileSystem -> deleteDirectory ( $ directory , false ) ; } $ this -> manifest = null ; return true ; }
deletes temporary uploaded files
11,008
protected function failure ( $ attribute , $ message = null ) { $ this -> deleteTemporaries ( $ this -> directory ) ; $ this -> setCustomMessages ( [ $ attribute => trans ( $ message ) ] ) ; $ this -> addFailure ( $ attribute , $ attribute , [ ] ) ; return false ; }
failure validation add custom messages
11,009
public function setChecked ( bool $ checked ) { $ this -> value = $ checked ? $ this -> getCheckedValue ( ) : $ this -> getUncheckedValue ( ) ; return $ this ; }
Checks or unchecks the checkbox
11,010
public function applyVariables ( ModuleVariables $ moduleVariables ) : void { $ moduleVariables -> modelDefinition ( 'user' , User :: class , self :: defaultUser ( ) ) -> setAttributes ( [ 'id' => 'ID' , 'email' => 'Email' , 'firstname' => 'First Name' , 'lastname' => 'Last Name' , 'fullname' => 'Full Name' , 'status' ...
Applies the variables to the module container .
11,011
protected function registerAntaresFormBuilder ( ) { $ this -> app -> singleton ( 'Antares\Contracts\Html\Form\Control' , 'Antares\Html\Form\Control' ) ; $ this -> app -> singleton ( 'Antares\Contracts\Html\Form\Template' , function ( $ app ) { $ class = $ app -> make ( 'config' ) -> get ( 'antares/html::form.presenter'...
Register the Antares \ Form builder instance .
11,012
public function customfield ( $ grid , $ name ) { if ( ! extension_active ( 'customfields' ) ) { return ; } $ category = strtolower ( last ( explode ( '\\' , get_class ( $ grid -> row ) ) ) ) ; $ customfields = app ( 'customfields' ) -> get ( ) ; foreach ( $ customfields as $ classname => $ fields ) { if ( get_class ( ...
Add customfield to form
11,013
protected function addCustomfield ( $ grid , $ field ) { if ( ! $ field instanceof \ Antares \ Customfield \ CustomField ) { $ customfield = with ( new \ Antares \ Customfield \ CustomField ( ) ) -> attributes ( $ field ) ; } else { $ customfield = $ field ; } $ customfield -> setModel ( $ grid -> row ) ; $ this -> add...
Add single customfield
11,014
public function customfieldsByFieldset ( $ grid , $ name ) { if ( ! extension_active ( 'customfields' ) ) { return ; } $ customfields = app ( 'customfields' ) -> get ( ) ; $ items = [ ] ; $ reserved = [ ] ; foreach ( $ customfields as $ classname => $ fields ) { if ( get_class ( $ grid -> row ) !== $ classname ) { cont...
Adds customfields by fieldset name
11,015
public function add ( Field $ control ) { $ renderable = $ control instanceof \ Illuminate \ Contracts \ Support \ Renderable ; $ control -> setField ( function ( $ row , $ cont , $ templates ) use ( $ control , $ renderable ) { $ control = app ( Control :: class ) -> setTemplates ( $ this -> control -> getTemplates ( ...
Add control to controls collection
11,016
public function detachControl ( FieldContract $ control ) { $ name = $ control -> name ; $ value = $ control -> value ; foreach ( $ this -> controls as $ index => $ field ) { if ( $ field -> name == $ name && $ field -> value == $ value ) { unset ( $ this -> controls [ $ index ] ) ; unset ( $ this -> keyMap [ $ name ] ...
Detaches control from controls collection
11,017
public function field ( $ name ) { if ( ! isset ( $ this -> keyMap [ $ name ] ) ) { throw new Exception ( sprintf ( 'Unable to find %s named field.' , $ name ) ) ; } return $ this -> controls [ $ this -> keyMap [ $ name ] ] ; }
gets field by name
11,018
public function types ( $ name ) { $ return = [ ] ; foreach ( $ this -> controls as $ control ) { if ( ( method_exists ( $ control , 'getType' ) ? $ control -> getType ( ) : $ control -> type ) == $ name ) { array_push ( $ return , $ control ) ; } } return $ return ; }
get control list by type
11,019
public function layout ( $ layout , $ params = [ ] ) { $ this -> layout = $ layout ; $ this -> params = $ params ; return $ this ; }
fieldset layout setter
11,020
public function render ( $ row = null ) { if ( is_null ( $ this -> layout ) ) { throw new Exception ( 'Unable to render fieldset layout. Layout is empty.' ) ; } $ attributes = array_merge ( [ 'controls' => $ this -> controls , 'name' => $ this -> name , 'attributes' => $ this -> attributes , 'row' => $ row , 'legend' =...
renders custom fieldset view
11,021
public function controls ( ) { $ return = [ ] ; foreach ( $ this -> controls as $ control ) { if ( in_array ( ( method_exists ( $ control , 'getType' ) ? $ control -> getType ( ) : $ control -> type ) , [ 'button' , 'submit' ] ) ) { continue ; } array_push ( $ return , $ control ) ; } return $ return ; }
retrives all controls from fieldsets
11,022
public function createInstallationProgressTable ( ) { Schema :: create ( 'tbl_antares_installation' , function ( Blueprint $ table ) { $ table -> increments ( 'id' ) ; $ table -> string ( 'name' ) -> unique ( ) ; $ table -> text ( 'content' ) -> nullable ( ) ; } ) ; }
CREATE SCHEMAS FOR INSTALLATION PROGRESS
11,023
public function addItem ( string $ id , string $ label , string $ uri = null , string $ icon = null , array $ attributes = [ ] ) : Menu { $ attributes = Arr :: except ( $ attributes , [ 'label' , 'uri' ] ) ; $ this -> dispatcher -> dispatch ( new ItemAdding ( $ id , $ this -> generateMenuItem ( $ this -> menuItem ) ) )...
Add a new item to the menu .
11,024
public function getChild ( string $ id ) { $ menuItem = $ this -> menuItem -> getChild ( $ id ) ; return $ menuItem ? $ this -> generateMenuItem ( $ menuItem ) : null ; }
Returns submenu by the given item ID .
11,025
protected function generateMenuItem ( ItemInterface $ menuItem ) : Menu { return new Menu ( $ menuItem , $ this -> dispatcher , $ this -> renderer ) ; }
Returns menu item wrapped by menu object .
11,026
public function loadEnvironmentConfigurations ( $ app , RepositoryContract $ repository ) { $ configPath = realpath ( $ app -> environmentPath ( ) ) ; $ files = $ this -> getConfigurationFilesInPath ( $ configPath ) ; foreach ( $ files as $ scope => $ path ) { $ items = require $ path ; foreach ( $ items as $ key => $ ...
Load the environment configuration items .
11,027
protected function getConfigurationFilesInPath ( $ configPath ) { $ files = [ ] ; if ( ! is_dir ( $ configPath ) ) { return $ files ; } foreach ( Finder :: create ( ) -> files ( ) -> name ( '*.php' ) -> depth ( 0 ) -> in ( $ configPath ) as $ file ) { $ files [ $ file -> getBasename ( '.php' ) ] = $ file -> getRealPath...
Get all of the configuration files in the given directory .
11,028
public function put ( $ key , $ value = '' ) { Arr :: set ( $ this -> attributes , $ key , $ value ) ; return $ this ; }
Set a value from a key .
11,029
protected function getLowerRoles ( array $ elements , $ parentId = 0 , & $ return = [ ] ) { foreach ( $ elements as $ element ) { if ( $ element [ 'parent_id' ] != $ parentId ) { continue ; } $ children = $ this -> getLowerRoles ( $ elements , $ element [ 'id' ] , $ return ) ; if ( $ children ) { foreach ( $ children a...
builds recursive widgets stack
11,030
public function getChilds ( $ withOwnRole = false ) { $ id = $ this -> id ; $ roles = $ this -> withTrashed ( ) -> orderby ( 'parent_id' ) -> get ( ) -> toArray ( ) ; $ lowerRoles = $ this -> getLowerRoles ( $ roles , $ id ) ; return ( $ withOwnRole ) ? array_merge ( [ $ this -> id ] , $ lowerRoles ) : $ lowerRoles ; }
Gets child roles
11,031
public function getNormalizedIdentifier ( $ model ) { $ identifier = $ this -> baseModelManager -> getNormalizedIdentifier ( $ model ) ; if ( $ identifier === null ) { $ identifierName = is_array ( $ this -> getModelIdentifier ( get_class ( $ model ) ) ) ? current ( $ this -> getModelIdentifier ( get_class ( $ model ) ...
Get the identifiers for this model class as a string .
11,032
public function getSortParameters ( FieldDescriptionInterface $ fieldDescription , DatagridInterface $ datagrid ) { return $ this -> baseModelManager -> getSortParameters ( $ fieldDescription , $ datagrid ) ; }
Returns the parameters used in the columns header
11,033
public static function of ( $ builder , $ classname = null ) { $ datatables = app ( Datatables :: class ) ; $ datatables -> builder = $ builder ; $ engine = ( $ builder instanceof QueryBuilder ) ? $ datatables -> usingQueryBuilder ( $ builder ) : ( $ builder instanceof Collection ? $ datatables -> usingCollection ( $ b...
Gets query and returns instance of class .
11,034
public function getIsActiveAttribute ( ) { try { $ activity = $ this -> activity ; $ lastActivity = ( $ activity instanceof UserActivity ) ? $ activity -> last_activity : null ; $ laDate = Carbon :: createFromFormat ( 'Y-m-d H:i:s' , $ lastActivity ) ; return ! ( Carbon :: now ( ) -> diffInSeconds ( $ laDate ) >= confi...
Check wheter this user is currently active
11,035
public function getLastActivityAttribute ( ) { $ activity = $ this -> activity ; return ( $ activity instanceof UserActivity ) ? Carbon :: createFromFormat ( 'Y-m-d H:i:s' , $ activity -> last_activity ) : null ; }
Get last dateTime of last activity of this user
11,036
public function getFullnameAttribute ( $ value ) { if ( ! strlen ( $ this -> firstname ) and ! strlen ( $ this -> lastname ) ) { return '---' ; } return $ this -> firstname . ' ' . $ this -> lastname ; }
Get the user s fullname
11,037
public function getLastLoggedAtAttribute ( ) { $ lastLogin = Logs :: where ( 'user_id' , $ this -> id ) -> where ( 'name' , 'like' , 'USERAUTHLISTENER_ONUSERLOGIN' ) -> orderBy ( 'created_at' , 'desc' ) -> get ( [ 'created_at' ] ) -> first ( ) ; return ( $ lastLogin ) ? $ lastLogin -> created_at -> diffForHumans ( ) : ...
Getting last logged attribute
11,038
public function getChildAreas ( ) { return $ this -> roles ( ) -> getModel ( ) -> newQuery ( ) -> select ( [ 'area' ] ) -> whereIn ( 'id' , $ this -> roles -> first ( ) -> getChilds ( ) ) -> groupBy ( 'area' ) -> whereNotNull ( 'area' ) -> pluck ( 'area' ) -> toArray ( ) ; }
Gets user child areas
11,039
function payload ( ) { if ( $ this -> IsFault ) { return json_encode ( array ( 'result' => null , 'error' => array ( 'faultCode' => $ this -> FaultCode , 'faultString' => $ this -> FaultString ) , 'id' => $ this -> Id ) ) ; } else { return json_encode ( array ( 'result' => $ this -> Value , 'error' => null , 'id' => $ ...
Returns the json payload for the response .
11,040
function decodeStream ( $ request , $ stream , $ headers = false , $ cookies = array ( ) , $ statuscode = "200" ) { $ this -> decodeStreamCommon ( $ request , $ stream , $ headers , $ cookies , $ statuscode ) ; $ results = json_decode ( $ stream , true ) ; if ( ! is_array ( $ results ) || ! array_key_exists ( 'result' ...
Decodes the JSONRPC response stream . Request is used for matching id .
11,041
public function onSave ( ArrayAccess $ parameters , $ namespace = null ) { $ exception = false ; if ( is_null ( $ namespace ) ) { return true ; } try { $ fieldsCollection = $ this -> field -> query ( ) -> where ( 'namespace' , $ namespace ) -> get ( ) ; if ( $ fieldsCollection -> isEmpty ( ) ) { return true ; } $ colle...
saves data values from customfields
11,042
protected function save ( array $ parameters , $ foreignId , $ namespace = null ) { if ( empty ( $ parameters ) ) { return true ; } $ where = [ 'user_id' => $ this -> userId , 'foreign_id' => $ foreignId , 'namespace' => $ namespace ] ; foreach ( $ parameters as $ fieldId => $ fieldValue ) { array_set ( $ where , 'fiel...
saves collection of data from customfields inputs
11,043
protected function resolveModel ( array $ where ) { $ model = $ this -> fieldData -> query ( ) -> where ( $ where ) -> first ( ) ; return ( is_null ( $ model ) ) ? $ this -> fieldData -> newInstance ( $ where ) : $ model ; }
resolve model instance
11,044
private function getScriptsContainers ( ) { $ container = null ; $ config = null ; foreach ( [ 'container' , 'app' , 'foundation' ] as $ name ) { if ( isset ( $ this -> { $ name } ) && is_null ( $ container ) ) { $ container = $ this -> { $ name } -> make ( 'antares.asset' ) ; $ config = $ this -> { $ name } -> make ( ...
scripts containers resolver
11,045
protected function scripts ( $ key = null , $ position = 'antares/foundation::scripts' ) { if ( ! $ key ) { return false ; } $ containers = $ this -> getScriptsContainers ( ) ; $ config = $ containers [ 'config' ] -> get ( $ key ) ; $ container = $ containers [ 'container' ] -> container ( isset ( $ config [ 'position'...
create presenter additional scripts
11,046
public function updateConfigurationValidationFailed ( array $ messages ) { if ( request ( ) -> ajax ( ) ) { return response ( ) -> json ( $ messages ) ; } $ url = URL :: previous ( ) ; return $ this -> redirectWithErrors ( $ url , $ messages ) ; }
Handles the failed validation for edited configuration .
11,047
public function updateConfigurationSuccess ( ) { $ url = route ( area ( ) . '.modules.index' ) ; $ message = trans ( 'antares/foundation::response.extensions.configuration-success' ) ; return $ this -> redirectWithMessage ( $ url , $ message ) ; }
Handles the successfully updated configuration .
11,048
public function updateConfigurationFailed ( array $ errors ) { $ url = URL :: previous ( ) ; $ message = trans ( 'antares/foundation::response.extensions.configuration-failed' ) ; return $ this -> redirectWithMessage ( $ url , $ message , 'error' ) ; }
Handles the failed update configuration .
11,049
public function server ( ) { if ( $ this -> server != null ) { return $ this -> server ; } return $ this -> server = $ this -> createServer ( ) ; }
Get the server instance .
11,050
protected function getAssetSandboxSourceUrl ( & $ source , $ group = null ) { if ( is_null ( self :: $ sandboxPath ) ) { if ( ! Foundation :: bound ( 'antares.version' ) ) { self :: $ sandboxPath = '' ; } $ sandboxMode = app ( 'request' ) -> get ( 'sandbox' ) ; if ( $ sandboxMode and $ group !== 'inline' ) { $ publicPa...
create asset sandbox source url
11,051
public function decorate ( $ content = null ) { $ current = realpath ( __DIR__ . '/../' ) . '/' ; $ dotted = 'templates.default' ; $ params = array_merge ( $ this -> shared , [ 'content' => $ content ] ) ; if ( ! is_null ( $ this -> template ) ) { $ viewPath = str_replace ( [ $ current , '/resources/views/' , '..' ] , ...
resolve template path
11,052
public function retrieveAll ( $ userId ) { if ( ! isset ( $ this -> userMeta [ $ userId ] ) ) { $ data = $ this -> getModel ( ) -> where ( 'user_id' , '=' , $ userId ) -> get ( ) ; $ this -> userMeta [ $ userId ] = $ this -> processRetrievedData ( $ userId , $ data ) ; } return Arr :: get ( $ this -> userMeta , $ userI...
Get user metas from database
11,053
private function mapExpressions ( array $ arr_fields , Document $ obj_doc ) { foreach ( $ arr_fields as $ obj_field ) { $ str_field_name = $ obj_field -> getName ( ) ; $ obj_value = $ obj_field -> getValue ( ) ; if ( ContentType :: GEO === $ obj_value -> getType ( ) ) { $ obj_geo = $ obj_value -> getGeo ( ) ; $ obj_doc...
Map expressions into a document
11,054
public function onCustomFieldCreateOrEdit ( Model $ model ) { $ this -> onList ( ) ; Breadcrumbs :: register ( 'customfields-create-update' , function ( $ breadcrumbs ) use ( $ model ) { $ breadcrumbs -> parent ( 'customfields' ) ; $ name = $ model -> exists ? 'Update custom field ' . $ model -> name : 'Create custom f...
when shows edit or create custom field form
11,055
public function create ( $ params = array ( ) ) { $ arr = array ( "bank_name" => $ params [ "bank_name" ] , "branch_name" => $ params [ "branch_name" ] , "bank_account_type" => $ params [ "bank_account_type" ] , "number" => $ params [ "number" ] , "name" => $ params [ "name" ] ) ; $ rawResponse = $ this -> client -> re...
Create a new BankAccount .
11,056
public function delete ( $ params = array ( ) ) { $ arr = array ( "id" => $ params [ "id" ] ) ; $ rawResponse = $ this -> client -> request ( 'delete' , 'api/bank_accounts/' . $ arr [ "id" ] , $ arr ) ; return $ rawResponse ; }
Delete a BankAccount .
11,057
public function repay ( $ params = array ( ) ) { $ arr = array ( "id" => $ params [ "id" ] ) ; $ rawResponse = $ this -> client -> request ( 'post' , 'api/lending/borrows/' . $ arr [ 'id' ] . '/repay' , $ arr ) ; return $ rawResponse ; }
Based on this id you can repay .
11,058
protected function addDateHeaderIfNecessary ( $ statusCode , $ headerBag ) { if ( $ statusCode >= 200 && $ statusCode < 500 && ! $ headerBag -> has ( 'Date' ) ) { $ date = DateTime :: createFromFormat ( 'U' , time ( ) , new DateTimeZone ( 'UTC' ) ) ; $ headerBag -> set ( 'Date' , $ date -> format ( 'D, d M Y H:i:s' ) ....
Add the Date header if it s missing .
11,059
protected function setCookieInResponse ( Cookie $ cookie ) { $ method = $ cookie -> isRaw ( ) ? 'rawcookie' : 'cookie' ; $ this -> response -> $ method ( $ cookie -> getName ( ) , $ cookie -> getValue ( ) , $ cookie -> getExpiresTime ( ) , $ cookie -> getPath ( ) , $ cookie -> getDomain ( ) , $ cookie -> isSecure ( ) ,...
Set a cookie in response header .
11,060
public function sendChunk ( $ data , $ lastChunk = false ) { $ this -> chunked = true ; if ( $ lastChunk ) { $ this -> response -> end ( $ data ) ; } elseif ( strlen ( $ data ) > 0 ) { $ this -> response -> write ( $ data ) ; } }
Send response body in chunked .
11,061
public function registerExtensionProviders ( ExtensionContract $ extension ) { $ filePath = $ extension -> getPath ( ) . '/providers.php' ; if ( $ this -> files -> exists ( $ filePath ) ) { $ providers = ( array ) $ this -> files -> getRequire ( $ filePath ) ; $ this -> provides ( $ providers ) ; } }
Registers extension providers .
11,062
public function provides ( array $ provides ) { $ services = [ ] ; foreach ( $ provides as $ provider ) { try { if ( ! isset ( $ this -> manifest [ $ provider ] ) ) { $ services [ $ provider ] = $ this -> recompileProvider ( $ provider ) ; } else { $ services [ $ provider ] = $ this -> manifest [ $ provider ] ; } } cat...
Load available service providers .
11,063
protected function recompileProvider ( string $ provider ) : array { $ instance = $ this -> app -> resolveProvider ( $ provider ) ; $ type = $ instance -> isDeferred ( ) ? 'Deferred' : 'Eager' ; return $ this -> { "register{$type}ServiceProvider" } ( $ provider , $ instance ) ; }
Recompile provider by reviewing the class configuration .
11,064
protected function dispatch ( array $ services ) { foreach ( $ services as $ provider => $ options ) { $ this -> loadDeferredServiceProvider ( $ provider , $ options ) ; $ this -> loadEagerServiceProvider ( $ provider , $ options ) ; $ this -> loadQueuedServiceProvider ( $ provider , $ options ) ; unset ( $ options [ '...
Register all deferred service providers .
11,065
protected function registerDeferredServiceProvider ( $ provider , ServiceProvider $ instance ) : array { $ deferred = [ ] ; foreach ( $ instance -> provides ( ) as $ provide ) { $ deferred [ $ provide ] = $ provider ; } return [ 'instance' => $ instance , 'eager' => false , 'when' => $ instance -> when ( ) , 'deferred'...
Register deferred service provider .
11,066
protected function loadEagerServiceProvider ( $ provider , array $ options ) { if ( ! $ options [ 'eager' ] ) { return ; } $ instance = Arr :: get ( $ options , 'instance' , $ provider ) ; $ this -> app -> register ( $ instance ) ; }
Load eager service provider .
11,067
protected function loadQueuedServiceProvider ( $ provider , array $ options ) { $ listeners = ( array ) Arr :: get ( $ options , 'when' , [ ] ) ; foreach ( $ listeners as $ listen ) { $ this -> events -> listen ( $ listen , function ( ) use ( $ provider , $ options ) { $ instance = Arr :: get ( $ options , 'instance' ,...
Load queued service provider .
11,068
public function findByVendorAndName ( string $ vendor , string $ name ) { $ fullName = $ vendor . '/' . $ name ; return $ this -> first ( function ( ExtensionContract $ extension ) use ( $ fullName ) { return $ extension -> getPackage ( ) -> getName ( ) === $ fullName ; } ) ; }
Returns the first extension by the given vendor and name .
11,069
public function findByPath ( string $ path ) { return $ this -> first ( function ( ExtensionContract $ extension ) use ( $ path ) { return $ extension -> getPath ( ) === $ path ; } ) ; }
Returns the first extension by the file path .
11,070
public function onSecurity ( ) { Breadcrumbs :: register ( 'general-config' , function ( $ breadcrumbs ) { $ breadcrumbs -> push ( 'General configuration' ) ; } ) ; Breadcrumbs :: register ( 'security' , function ( $ breadcrumbs ) { $ breadcrumbs -> parent ( 'general-config' ) ; $ breadcrumbs -> push ( 'Security' , han...
When shows security section
11,071
public function onComponentsList ( ) { if ( ! Breadcrumbs :: exists ( 'modules' ) ) { Breadcrumbs :: register ( 'modules' , function ( $ breadcrumbs ) { $ breadcrumbs -> push ( 'Modules' , handles ( 'antares::modules' ) ) ; } ) ; } view ( ) -> share ( 'breadcrumbs' , Breadcrumbs :: render ( 'modules' ) ) ; }
when shows components list
11,072
public function onComponentConfigure ( $ component ) { $ this -> onComponentsList ( ) ; Breadcrumbs :: register ( 'component-configure' , function ( $ breadcrumbs ) use ( $ component ) { $ breadcrumbs -> parent ( 'components' ) ; $ breadcrumbs -> push ( 'Configuration: ' . $ component -> getFullName ( ) ) ; } ) ; view ...
when shows component configuration form
11,073
private static function buildMap ( array $ files , array & $ destination ) : void { foreach ( $ files as $ structure ) { foreach ( $ structure as $ key => $ value ) { $ subFiles = [ ] ; foreach ( $ files as $ uploadKey => $ data ) { $ subFiles [ $ uploadKey ] = $ data [ $ key ] ; } if ( is_array ( $ value ) ) { $ desti...
Recursively builds the map of UploadedFile instances .
11,074
protected function getParams ( $ name = null ) { $ queues = ! is_null ( $ name ) ? [ $ name ] : $ this -> getQueues ( ) ; $ params = [ config ( 'queue.default' ) , ] ; if ( empty ( $ queues ) ) { return $ params ; } $ queue = implode ( ',' , $ queues ) ; if ( $ this -> isCli ( ) ) { array_push ( $ params , '--queue ' ....
get params depends on queues and execution source
11,075
function serialize ( $ charset_encoding = '' ) { if ( $ charset_encoding != '' ) $ this -> content_type = $ this -> content_type . '; charset=' . $ charset_encoding ; else $ this -> content_type = $ this -> content_type ; $ this -> payload = serialize_ezjscoreresp ( $ this , $ charset_encoding , $ this -> content_type ...
Returns textual representation of the response .
11,076
protected function resolveCsvHeader ( ) { $ header = [ ] ; if ( ! $ this -> isEmpty ( ) ) { $ single = $ this -> first ( ) ; $ header = array_keys ( Arr :: dot ( $ single ) ) ; } return $ header ; }
Resolve CSV header .
11,077
public function except_by_key ( $ field , $ keys ) { return $ this -> filter ( function ( $ fieldset ) use ( $ field , $ keys ) { if ( isset ( $ fieldset -> { $ field } ) and in_array ( $ fieldset -> { $ field } , $ keys ) ) { return false ; } } ) ; }
find elements except elements which has field founded in keys
11,078
public function by ( $ field , $ value ) { $ filtered = $ this -> filter ( function ( $ fieldset ) use ( $ field , $ value ) { if ( isset ( $ fieldset -> { $ field } ) and $ fieldset -> { $ field } == $ value ) { return true ; } return false ; } ) ; return $ filtered -> isEmpty ( ) ? null : ( $ filtered -> count ( ) > ...
finds element in collection by element fieldname and field value
11,079
public function getAvailableExtensions ( ) : Extensions { if ( $ this -> availableExtensions instanceof Extensions ) { return $ this -> availableExtensions ; } $ foundExtensions = $ this -> filesystemFinder -> findExtensions ( ) ; $ storedExtensions = app ( 'antares.installed' ) ? $ this -> extensionsRepository -> all ...
Returns the collection of available extensions .
11,080
public function isInstalled ( string $ name ) : bool { $ extension = $ this -> getAvailableExtensions ( ) -> findByName ( $ this -> getNormalizedName ( $ name ) ) ; if ( $ extension instanceof ExtensionContract ) { return $ extension -> isInstalled ( ) ; } return false ; }
Verify whether the extension is installed by the given name .
11,081
public function isActive ( string $ name ) : bool { $ extension = $ this -> getAvailableExtensions ( ) -> quessByName ( $ name ) ; if ( $ extension instanceof ExtensionContract ) { return $ extension -> isActivated ( ) ; } return false ; }
Verify whether the extension is active by the given name .
11,082
public function getActiveExtensionByPath ( string $ path ) { $ activated = $ this -> getAvailableExtensions ( ) -> filterByActivated ( ) ; foreach ( $ activated as $ extension ) { if ( starts_with ( $ path , $ extension -> getPath ( ) ) ) { return $ extension ; } } return false ; }
Gets active extension by path name
11,083
public function getActualExtension ( ) { $ route = Route :: getCurrentRoute ( ) ; if ( $ route instanceof \ Illuminate \ Routing \ Route ) { $ action = $ route -> getActionName ( ) ; if ( $ action === 'Closure' ) { return false ; } preg_match ( "/.+?(?=\\\)(.*)\Http/" , $ action , $ matches ) ; return empty ( $ matches...
get actual extension name based on route
11,084
public function getPatterned ( $ value ) { if ( ! is_array ( $ value ) ) { return str_replace ( '%value' , ucfirst ( $ value ) , $ this -> pattern ) ; } else { $ return = $ this -> pattern ; foreach ( $ value as $ field ) { if ( ! isset ( $ field [ 'name' ] ) and ! isset ( $ field [ 'value' ] ) ) { continue ; } if ( is...
creates patterned sidebar title
11,085
protected function getParams ( $ key = null ) { $ params = $ this -> session -> get ( uri ( ) ) ; return ! is_null ( $ key ) ? array_get ( $ params , $ key ) : $ params ; }
gets filter params from session
11,086
protected function getGroup ( $ classname ) { $ category = FieldCategory :: query ( ) -> firstOrCreate ( [ 'name' => strtolower ( last ( explode ( '\\' , $ classname ) ) ) ] ) ; return FieldGroup :: query ( ) -> firstOrCreate ( [ 'category_id' => $ category -> id , 'name' => $ category -> name , ] ) ; }
Gets field group instance
11,087
protected function getFieldType ( CustomField $ field ) { $ type = explode ( ':' , $ field -> type ) ; $ where = [ 'name' => head ( $ type ) ] ; if ( count ( $ type ) > 1 ) { $ where [ 'type' ] = last ( $ type ) ; } return FieldType :: query ( ) -> where ( $ where ) -> firstOrFail ( [ 'id' ] ) ; }
Gets field type
11,088
protected function saveField ( Brands $ brand , CustomField $ field , array $ insert = [ ] ) { if ( Field :: query ( ) -> where ( array_merge ( $ insert , [ 'brand_id' => $ brand -> id , 'name' => $ field -> name , ] ) ) -> first ( ) !== null ) { return ; } $ customfield = Field :: query ( ) -> firstOrCreate ( array_me...
Saves single field
11,089
protected function saveRules ( CustomField $ field , Field $ customfield ) { $ rules = array_get ( $ field -> getRules ( ) , $ field -> name , [ ] ) ; foreach ( $ rules as $ rule ) { $ validator = FieldValidator :: query ( ) -> where ( [ 'name' => $ rule ] ) -> first ( ) ; $ config = [ 'field_id' => $ customfield -> id...
Saves custom field rules
11,090
protected function saveOptions ( CustomField $ field , Field $ customfield ) { if ( is_null ( $ field -> options ) ) { return false ; } $ options = ( $ field -> options instanceof Closure ) ? call_user_func ( $ field -> options ) : $ field -> options ; foreach ( $ options as $ value => $ label ) { FieldTypeOption :: qu...
Saves customfield options
11,091
public function inlineScript ( $ name , $ source = null , $ dependencies = [ ] , $ attributes = [ ] , $ replaces = [ ] ) { $ this -> register ( 'inline' , $ name , $ source , $ dependencies , $ attributes , $ replaces ) ; }
Add a JavaScript code to the registered assets .
11,092
public function requireJs ( ) { $ scripts = $ this -> dispatcher -> scripts ( 'script' , $ this -> assets , $ this -> path ) ; $ required = [ ] ; $ string = '' ; if ( isset ( $ this -> assets [ 'script' ] ) ) { foreach ( $ this -> assets [ 'script' ] as $ js ) { if ( ! is_null ( $ require = array_get ( $ js , 'attribut...
applying RequireJs for scripts
11,093
protected function requireInline ( $ scripts , $ afterLoad = null ) { $ config = config ( 'require_js' ) ; $ main = array_get ( $ config , 'main' , "" ) ; $ default = array_get ( $ config , 'default' , [ ] ) ; $ child = array_get ( $ default , 'childs' , [ ] ) ; if ( isset ( $ default [ 'childs' ] ) ) { unset ( $ defau...
generate gridstack inline scripts
11,094
public function addPath ( $ path ) { $ trimmed = rtrim ( $ path , '/' ) ; if ( ! in_array ( $ trimmed , $ this -> paths ) ) { $ this -> paths [ ] = $ trimmed ; } return $ this ; }
Add a new path to finder .
11,095
protected function detectUiComponents ( ) { $ extensionsManager = app ( ) -> make ( Manager :: class ) ; $ components = [ ] ; $ directories = [ ] ; foreach ( $ this -> paths as $ path ) { try { $ directories [ ] = $ this -> files -> directories ( $ path ) ; } catch ( Exception $ ex ) { continue ; } } $ directories = co...
Detects app ui components paths
11,096
public function detect ( ) { $ components = [ ] ; $ files = $ this -> detectUiComponents ( ) ; foreach ( $ files as $ file ) { $ name = $ this -> files -> name ( $ file ) ; $ params = $ this -> resolveUIComponentParams ( $ name , $ file ) ; if ( ! $ params ) { continue ; } $ components [ snake_case ( $ name ) ] = $ par...
Detect available ui components .
11,097
public function detectRoutes ( ) { $ components = $ this -> detectUiComponents ( ) ; $ return = [ ] ; foreach ( $ components as $ component ) { $ name = $ this -> files -> name ( $ component ) ; $ namespace = $ this -> resolveUIComponentNamespace ( $ this -> files -> get ( $ component ) ) ; $ return [ ] = $ namespace ....
Detects ui component routes
11,098
protected function resolveUIComponentParams ( $ name , $ file ) { $ namespace = $ this -> resolveUIComponentNamespace ( $ this -> files -> get ( $ file ) ) ; if ( ! class_exists ( $ namespace . '\\' . $ name ) ) { return false ; } $ instance = app ( $ namespace . '\\' . $ name ) ; $ hasWidgets = Registry :: isRegistere...
Resolves ui component params
11,099
protected function resolveDisabledUIComponent ( AbstractTemplate $ component , $ keyname = 'ui-components.disabled' ) { $ disabled = $ component -> getDisabled ( ) ; if ( empty ( $ disabled ) ) { return false ; } $ classname = get_class ( $ component ) ; view ( ) -> composer ( $ disabled , function ( ) use ( $ keyname ...
Resolves which ui components should be disabled on which view