idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
22,300
public function processFilter ( $ toArray = true ) { if ( $ this -> builder ) { call_user_func ( $ this -> builder , $ this ) ; } return $ this -> filter -> execute ( $ toArray ) ; }
Process the grid filter .
22,301
public function using ( array $ values , $ default = null ) { return $ this -> as ( function ( $ value ) use ( $ values , $ default ) { if ( is_null ( $ value ) ) { return $ default ; } return Arr :: get ( $ values , $ value , $ default ) ; } ) ; }
Display field using array value map .
22,302
public function image ( $ server = '' , $ width = 200 , $ height = 200 ) { return $ this -> unescape ( ) -> as ( function ( $ images ) use ( $ server , $ width , $ height ) { return collect ( $ images ) -> map ( function ( $ path ) use ( $ server , $ width , $ height ) { if ( empty ( $ path ) ) { return '' ; } if ( url...
Show field as a image .
22,303
public function file ( $ server = '' , $ download = true ) { $ field = $ this ; return $ this -> unescape ( ) -> as ( function ( $ path ) use ( $ server , $ download , $ field ) { $ name = basename ( $ path ) ; $ field -> border = false ; $ size = $ url = '' ; if ( url ( ) -> isValidUrl ( $ path ) ) { $ url = $ path ; ...
Show field as a file .
22,304
public function link ( $ href = '' , $ target = '_blank' ) { return $ this -> unescape ( ) -> as ( function ( $ link ) use ( $ href , $ target ) { $ href = $ href ? : $ link ; return "<a href='$href' target='{$target}'>{$link}</a>" ; } ) ; }
Show field as a link .
22,305
public function label ( $ style = 'success' ) { return $ this -> unescape ( ) -> as ( function ( $ value ) use ( $ style ) { if ( $ value instanceof Arrayable ) { $ value = $ value -> toArray ( ) ; } return collect ( ( array ) $ value ) -> map ( function ( $ name ) use ( $ style ) { return "<span class='label label-{$s...
Show field as labels .
22,306
public function json ( ) { $ field = $ this ; return $ this -> unescape ( ) -> as ( function ( $ value ) use ( $ field ) { $ content = json_decode ( $ value , true ) ; if ( json_last_error ( ) == 0 ) { $ field -> border = false ; return '<pre><code>' . json_encode ( $ content , JSON_PRETTY_PRINT ) . '</code></pre>' ; }...
Show field as json code .
22,307
public function getFileIcon ( $ file = '' ) { $ extension = File :: extension ( $ file ) ; foreach ( $ this -> fileTypes as $ type => $ regex ) { if ( preg_match ( "/^($regex)$/i" , $ extension ) !== 0 ) { return "fa-file-{$type}-o" ; } } return 'fa-file-o' ; }
Get file icon .
22,308
public function setValue ( Model $ model ) { if ( $ this -> relation ) { if ( ! $ relationValue = $ model -> { $ this -> relation } ) { return $ this ; } $ this -> value = $ relationValue ; } else { $ this -> value = $ model -> getAttribute ( $ this -> name ) ; } return $ this ; }
Set value for this field .
22,309
protected function callExtendedField ( $ abstract , $ arguments = [ ] ) { if ( $ abstract instanceof \ Closure ) { return $ this -> as ( $ abstract ) ; } if ( is_string ( $ abstract ) && class_exists ( $ abstract ) ) { $ extend = new $ abstract ( ) ; } if ( $ abstract instanceof AbstractField ) { $ extend = $ abstract ...
Call extended field .
22,310
protected function variables ( ) { return [ 'content' => $ this -> value , 'escape' => $ this -> escape , 'label' => $ this -> getLabel ( ) , 'wrapped' => $ this -> border , 'width' => $ this -> width , ] ; }
Get all variables passed to field view .
22,311
public function method ( $ method = 'POST' ) { if ( strtolower ( $ method ) == 'put' ) { $ this -> hidden ( '_method' ) -> default ( $ method ) ; return $ this ; } return $ this -> attribute ( 'method' , strtoupper ( $ method ) ) ; }
Method of the form .
22,312
public function attribute ( $ attr , $ value = '' ) { if ( is_array ( $ attr ) ) { foreach ( $ attr as $ key => $ value ) { $ this -> attribute ( $ key , $ value ) ; } } else { $ this -> attributes [ $ attr ] = $ value ; } return $ this ; }
Add form attributes .
22,313
public function formatAttribute ( $ attributes = [ ] ) { $ attributes = $ attributes ? : $ this -> attributes ; if ( $ this -> hasFile ( ) ) { $ attributes [ 'enctype' ] = 'multipart/form-data' ; } $ html = [ ] ; foreach ( $ attributes as $ key => $ val ) { $ html [ ] = "$key=\"$val\"" ; } return implode ( ' ' , $ html...
Format form attributes form array to html .
22,314
protected function makeFiles ( ) { $ this -> namespace = $ this -> getRootNameSpace ( ) ; $ this -> className = $ this -> getClassName ( ) ; $ this -> copy ( [ __DIR__ . '/stubs/extension/view.stub' => 'resources/views/index.blade.php' , __DIR__ . '/stubs/extension/.gitignore.stub' => '.gitignore' , __DIR__ . '/stubs/e...
Make extension files .
22,315
protected function getRootNameSpace ( ) { if ( ! $ namespace = $ this -> option ( 'namespace' ) ) { list ( $ vendor , $ name ) = explode ( '/' , $ this -> package ) ; $ default = str_replace ( [ '-' , '-' ] , '' , Str :: title ( $ vendor ) . '\\' . Str :: title ( $ name ) ) ; $ namespace = $ this -> ask ( 'Root namespa...
Get root namespace for this package .
22,316
protected function makeDirs ( ) { $ this -> basePath = rtrim ( $ this -> extensionDir , '/' ) . '/' . ltrim ( $ this -> package , '/' ) ; $ this -> makeDir ( $ this -> dirs ) ; }
Create package dirs .
22,317
protected function extensionPath ( $ path = '' ) { $ path = rtrim ( $ path , '/' ) ; if ( empty ( $ path ) ) { return rtrim ( $ this -> basePath , '/' ) ; } return rtrim ( $ this -> basePath , '/' ) . '/' . ltrim ( $ path , '/' ) ; }
Extension path .
22,318
protected function putFile ( $ to , $ content ) { $ to = $ this -> extensionPath ( $ to ) ; $ this -> filesystem -> put ( $ to , $ content ) ; }
Put contents to file .
22,319
protected function copy ( $ from , $ to = null ) { if ( is_array ( $ from ) && is_null ( $ to ) ) { foreach ( $ from as $ key => $ value ) { $ this -> copy ( $ key , $ value ) ; } return ; } if ( ! file_exists ( $ from ) ) { return ; } $ to = $ this -> extensionPath ( $ to ) ; $ this -> filesystem -> copy ( $ from , $ ...
Copy files to extension path .
22,320
protected function makeDir ( $ paths = '' ) { foreach ( ( array ) $ paths as $ path ) { $ path = $ this -> extensionPath ( $ path ) ; $ this -> filesystem -> makeDirectory ( $ path , 0755 , true , true ) ; } }
Make new directory .
22,321
protected function registerRouteMiddleware ( ) { foreach ( $ this -> routeMiddleware as $ key => $ middleware ) { app ( 'router' ) -> aliasMiddleware ( $ key , $ middleware ) ; } foreach ( $ this -> middlewareGroups as $ key => $ middleware ) { app ( 'router' ) -> middlewareGroup ( $ key , $ middleware ) ; } }
Register the route middleware .
22,322
public function build ( ) { $ this -> startRow ( ) ; foreach ( $ this -> columns as $ column ) { $ column -> build ( ) ; } $ this -> endRow ( ) ; }
Build row column .
22,323
public function row ( $ content ) { if ( $ content instanceof Closure ) { $ row = new Row ( ) ; call_user_func ( $ content , $ row ) ; $ this -> addRow ( $ row ) ; } else { $ this -> addRow ( new Row ( $ content ) ) ; } return $ this ; }
Add one row for content body .
22,324
public function build ( ) { ob_start ( ) ; foreach ( $ this -> rows as $ row ) { $ row -> build ( ) ; } $ contents = ob_get_contents ( ) ; ob_end_clean ( ) ; return $ contents ; }
Build html of content .
22,325
private function formatHtmlAttribute ( $ attributes = [ ] ) { $ attrArr = [ ] ; foreach ( $ attributes as $ name => $ val ) { $ attrArr [ ] = "$name=\"$val\"" ; } return implode ( ' ' , $ attrArr ) ; }
Format attributes to html .
22,326
public function style ( $ style ) { if ( is_array ( $ style ) ) { $ style = implode ( '' , array_map ( function ( $ key , $ val ) { return "$key:$val" ; } , array_keys ( $ style ) , array_values ( $ style ) ) ) ; } if ( is_string ( $ style ) ) { $ this -> attributes [ 'style' ] = $ style ; } }
Set style of the row .
22,327
protected function output ( $ value ) { if ( $ value instanceof Renderable ) { $ value = $ value -> render ( ) ; } if ( $ value instanceof Htmlable ) { $ value = $ value -> toHtml ( ) ; } if ( $ value instanceof Jsonable ) { $ value = $ value -> toJson ( ) ; } if ( ! is_null ( $ value ) && ! is_scalar ( $ value ) ) { r...
Output column value .
22,328
protected function removeFilterByID ( $ id ) { $ this -> filters = array_filter ( $ this -> filters , function ( AbstractFilter $ filter ) use ( $ id ) { return $ filter -> getId ( ) != $ id ; } ) ; }
Remove filter by filter id .
22,329
protected function addFilter ( AbstractFilter $ filter ) { $ this -> layout -> addFilter ( $ filter ) ; $ filter -> setParent ( $ this ) ; if ( $ this -> thisFilterLayoutOnly ) { $ this -> thisFilterLayoutOnly = false ; $ this -> layoutOnlyFilterColumns [ ] = $ filter -> getColumn ( ) ; } return $ this -> filters [ ] =...
Add a filter to grid .
22,330
public function getCurrentScope ( ) { $ key = request ( Scope :: QUERY_NAME ) ; return $ this -> scopes -> first ( function ( $ scope ) use ( $ key ) { return $ scope -> key == $ key ; } ) ; }
Get current scope .
22,331
public function column ( $ width , \ Closure $ closure ) { $ width = $ width < 1 ? round ( 12 * $ width ) : $ width ; $ this -> layout -> column ( $ width , $ closure ) ; return $ this ; }
Add a new layout column .
22,332
public function execute ( $ toArray = true ) { $ conditions = array_merge ( $ this -> conditions ( ) , $ this -> scopeConditions ( ) ) ; return $ this -> model -> addConditions ( $ conditions ) -> buildData ( $ toArray ) ; }
Execute the filter with conditions .
22,333
protected function fullUrlWithoutQuery ( $ keys ) { if ( $ keys instanceof Arrayable ) { $ keys = $ keys -> toArray ( ) ; } $ keys = ( array ) $ keys ; $ request = request ( ) ; $ query = $ request -> query ( ) ; Arr :: forget ( $ query , $ keys ) ; $ question = $ request -> getBaseUrl ( ) . $ request -> getPathInfo ( ...
Get full url without query strings .
22,334
public static function registerFilters ( ) { $ filters = [ 'equal' => Equal :: class , 'notEqual' => NotEqual :: class , 'ilike' => Ilike :: class , 'like' => Like :: class , 'gt' => Gt :: class , 'lt' => Lt :: class , 'between' => Between :: class , 'group' => Group :: class , 'where' => Where :: class , 'in' => In ::...
Register builtin filters .
22,335
public function disableFilterButton ( bool $ disable = true ) { $ this -> tools = $ this -> tools -> map ( function ( $ tool ) use ( $ disable ) { if ( $ tool instanceof FilterButton ) { return $ tool -> disable ( $ disable ) ; } return $ tool ; } ) ; }
Disable filter button .
22,336
public function disableRefreshButton ( bool $ disable = true ) { $ this -> tools = $ this -> tools -> map ( function ( AbstractTool $ tool ) use ( $ disable ) { if ( $ tool instanceof RefreshButton ) { return $ tool -> disable ( $ disable ) ; } return $ tool ; } ) ; }
Disable refresh button .
22,337
public function disableBatchActions ( bool $ disable = true ) { $ this -> tools = $ this -> tools -> map ( function ( $ tool ) use ( $ disable ) { if ( $ tool instanceof BatchActions ) { return $ tool -> disable ( $ disable ) ; } return $ tool ; } ) ; }
Disable batch actions .
22,338
public function append ( $ title , \ Closure $ content , $ active = false ) { $ fields = $ this -> collectFields ( $ content ) ; $ id = 'form-' . ( $ this -> tabs -> count ( ) + 1 ) ; $ this -> tabs -> push ( compact ( 'id' , 'title' , 'fields' , 'active' ) ) ; return $ this ; }
Append a tab section .
22,339
public function getTabs ( ) { if ( $ this -> tabs -> filter ( function ( $ tab ) { return $ tab [ 'active' ] ; } ) -> isEmpty ( ) ) { $ first = $ this -> tabs -> first ( ) ; $ first [ 'active' ] = true ; $ this -> tabs -> offsetSet ( 0 , $ first ) ; } return $ this -> tabs ; }
Get all tabs .
22,340
public function disableView ( bool $ disable = true ) { if ( $ disable ) { array_delete ( $ this -> tools , 'view' ) ; } elseif ( ! in_array ( 'view' , $ this -> tools ) ) { array_push ( $ this -> tools , 'view' ) ; } return $ this ; }
Disable edit tool .
22,341
protected static function getInstance ( ) { $ class = get_called_class ( ) ; if ( ! isset ( self :: $ instance [ $ class ] ) || ! self :: $ instance [ $ class ] instanceof $ class ) { self :: $ instance [ $ class ] = new static ( ) ; } return static :: $ instance [ $ class ] ; }
Returns the singleton instance .
22,342
public static function boot ( ) { $ extension = static :: getInstance ( ) ; Admin :: extend ( $ extension -> name , get_called_class ( ) ) ; if ( $ extension -> disabled ( ) ) { return false ; } if ( ! empty ( $ css = $ extension -> css ( ) ) ) { Admin :: css ( $ css ) ; } if ( ! empty ( $ js = $ extension -> js ( ) ) ...
Bootstrap this extension .
22,343
public static function import ( ) { $ extension = static :: getInstance ( ) ; if ( $ menu = $ extension -> menu ( ) ) { if ( $ extension -> validateMenu ( $ menu ) ) { extract ( $ menu ) ; static :: createMenu ( $ title , $ path , $ icon ) ; } } if ( $ permission = $ extension -> permission ( ) ) { if ( $ extension -> ...
Import menu item and permission to laravel - admin .
22,344
public function validateMenu ( array $ menu ) { $ validator = Validator :: make ( $ menu , $ this -> menuValidationRules ) ; if ( $ validator -> passes ( ) ) { return true ; } $ message = "Invalid menu:\r\n" . implode ( "\r\n" , Arr :: flatten ( $ validator -> errors ( ) -> messages ( ) ) ) ; throw new \ Exception ( $ ...
Validate menu fields .
22,345
public function validatePermission ( array $ permission ) { $ validator = Validator :: make ( $ permission , $ this -> permissionValidationRules ) ; if ( $ validator -> passes ( ) ) { return true ; } $ message = "Invalid permission:\r\n" . implode ( "\r\n" , Arr :: flatten ( $ validator -> errors ( ) -> messages ( ) ) ...
Validate permission fields .
22,346
protected static function createMenu ( $ title , $ uri , $ icon = 'fa-bars' , $ parentId = 0 ) { $ menuModel = config ( 'admin.database.menu_model' ) ; $ lastOrder = $ menuModel :: max ( 'order' ) ; $ menuModel :: create ( [ 'parent_id' => $ parentId , 'order' => $ lastOrder + 1 , 'title' => $ title , 'icon' => $ icon ...
Create a item in laravel - admin left side menu .
22,347
protected static function createPermission ( $ name , $ slug , $ path ) { $ permissionModel = config ( 'admin.database.permissions_model' ) ; $ permissionModel :: create ( [ 'name' => $ name , 'slug' => $ slug , 'http_path' => '/' . trim ( $ path , '/' ) , ] ) ; }
Create a permission for this extension .
22,348
public static function routes ( $ callback ) { $ attributes = array_merge ( [ 'prefix' => config ( 'admin.route.prefix' ) , 'middleware' => config ( 'admin.route.middleware' ) , ] , static :: config ( 'route' , [ ] ) ) ; Route :: group ( $ attributes , $ callback ) ; }
Set routes for this extension .
22,349
protected function getTableColumns ( ) { if ( ! $ this -> model -> getConnection ( ) -> isDoctrineAvailable ( ) ) { throw new \ Exception ( 'You need to require doctrine/dbal: ~2.3 in your own composer.json to get database columns. ' ) ; } $ table = $ this -> model -> getConnection ( ) -> getTablePrefix ( ) . $ this ->...
Get columns of a giving model .
22,350
protected function formatLabel ( $ arguments = [ ] ) { $ column = is_array ( $ this -> column ) ? current ( $ this -> column ) : $ this -> column ; $ label = isset ( $ arguments [ 0 ] ) ? $ arguments [ 0 ] : ucfirst ( $ column ) ; return str_replace ( [ '.' , '_' ] , ' ' , $ label ) ; }
Format the label value .
22,351
public function checked ( $ checked = [ ] ) { if ( $ checked instanceof Arrayable ) { $ checked = $ checked -> toArray ( ) ; } $ this -> checked = array_merge ( $ this -> checked , $ checked ) ; return $ this ; }
Set the field option checked .
22,352
protected function addRequiredAttribute ( $ rules ) { if ( ! in_array ( 'required' , $ rules ) ) { return ; } if ( $ this instanceof Form \ Field \ MultipleFile || $ this instanceof Form \ Field \ File ) { return ; } $ this -> required ( ) ; }
Add required attribute to current field if has required rule except file and image fields .
22,353
protected function getRules ( ) { if ( $ this -> rules instanceof \ Closure ) { return $ this -> rules -> call ( $ this , $ this -> form ) ; } return $ this -> rules ; }
Get field validation rules .
22,354
protected function removeRule ( $ rule ) { if ( ! is_string ( $ this -> rules ) ) { return ; } $ pattern = "/{$rule}[^\|]?(\||$)/" ; $ this -> rules = preg_replace ( $ pattern , '' , $ this -> rules , - 1 ) ; }
Remove a specific rule by keyword .
22,355
public function data ( array $ data = null ) { if ( is_null ( $ data ) ) { return $ this -> data ; } $ this -> data = $ data ; return $ this ; }
Set or get data .
22,356
public function attribute ( $ attribute , $ value = null ) { if ( is_array ( $ attribute ) ) { $ this -> attributes = array_merge ( $ this -> attributes , $ attribute ) ; } else { $ this -> attributes [ $ attribute ] = ( string ) $ value ; } return $ this ; }
Add html attributes to elements .
22,357
protected function formatAttributes ( ) { $ html = [ ] ; foreach ( $ this -> attributes as $ name => $ value ) { $ html [ ] = $ name . '="' . e ( $ value ) . '"' ; } return implode ( ' ' , $ html ) ; }
Format the field attributes .
22,358
protected function getElementClass ( ) { if ( ! $ this -> elementClass ) { $ name = $ this -> elementName ? : $ this -> formatName ( $ this -> column ) ; $ this -> elementClass = ( array ) str_replace ( [ '[' , ']' ] , '_' , $ name ) ; } return $ this -> elementClass ; }
Get element class .
22,359
protected function getElementClassString ( ) { $ elementClass = $ this -> getElementClass ( ) ; if ( Arr :: isAssoc ( $ elementClass ) ) { $ classes = [ ] ; foreach ( $ elementClass as $ index => $ class ) { $ classes [ $ index ] = is_array ( $ class ) ? implode ( ' ' , $ class ) : $ class ; } return $ classes ; } retu...
Get element class string .
22,360
public function addElementClass ( $ class ) { if ( is_array ( $ class ) || is_string ( $ class ) ) { $ this -> elementClass = array_merge ( $ this -> elementClass , ( array ) $ class ) ; $ this -> elementClass = array_unique ( $ this -> elementClass ) ; } return $ this ; }
Add the element class .
22,361
public function resetElementClassName ( string $ className , string $ resetClassName ) { if ( ( $ key = array_search ( $ className , $ this -> getElementClass ( ) ) ) !== false ) { $ this -> elementClass [ $ key ] = $ resetClassName ; } return $ this ; }
reset field className .
22,362
public function variables ( ) { return array_merge ( $ this -> variables , [ 'id' => $ this -> id , 'name' => $ this -> elementName ? : $ this -> formatName ( $ this -> column ) , 'help' => $ this -> help , 'class' => $ this -> getElementClassString ( ) , 'value' => $ this -> value ( ) , 'label' => $ this -> label , 'v...
Get the view variables of this field .
22,363
public function checked ( $ checked = [ ] ) { if ( $ checked instanceof Arrayable ) { $ checked = $ checked -> toArray ( ) ; } $ this -> checked = is_array ( $ checked ) ? ( array ) end ( $ checked ) : ( array ) $ checked ; return $ this ; }
Set checked .
22,364
protected function json_encode_options ( $ options ) { $ data = $ this -> prepare_options ( $ options ) ; $ json = json_encode ( $ data [ 'options' ] ) ; $ json = str_replace ( $ data [ 'toReplace' ] , $ data [ 'original' ] , $ json ) ; return $ json ; }
Encode options to Json .
22,365
public function datalist ( $ entries = [ ] ) { $ this -> defaultAttribute ( 'list' , "list-{$this->id}" ) ; $ datalist = "<datalist id=\"list-{$this->id}\">" ; foreach ( $ entries as $ k => $ v ) { $ datalist .= "<option value=\"{$k}\">{$v}</option>" ; } $ datalist .= '</datalist>' ; return $ this -> append ( $ datalis...
Add datalist element to Text input .
22,366
protected function initialize ( ) { $ this -> id = $ this -> formatId ( $ this -> column ) ; $ this -> group = new Collection ( ) ; $ this -> name = "{$this->id}-filter-group" ; $ this -> setupDefaultPresenter ( ) ; }
Initialize a group filter .
22,367
public function equal ( $ label = '' , $ operator = '=' ) { $ label = $ label ? : $ operator ; $ condition = [ $ this -> column , $ operator , $ this -> value ] ; return $ this -> joinGroup ( $ label , $ condition ) ; }
Filter out equal records .
22,368
public function where ( $ label , \ Closure $ builder ) { $ this -> input = $ this -> value ; $ condition = [ $ builder -> bindTo ( $ this ) ] ; return $ this -> joinGroup ( $ label , $ condition ) ; }
Specify a where query .
22,369
public function like ( $ label = '' , $ operator = 'like' ) { $ label = $ label ? : $ operator ; $ condition = [ $ this -> column , $ operator , "%{$this->value}%" ] ; return $ this -> joinGroup ( $ label , $ condition ) ; }
Specify a where like query .
22,370
public function startWith ( $ label = '' ) { $ label = $ label ? : 'Start with' ; $ condition = [ $ this -> column , 'like' , "{$this->value}%" ] ; return $ this -> joinGroup ( $ label , $ condition ) ; }
Filter out records which starts with input query .
22,371
public function endWith ( $ label = '' ) { $ label = $ label ? : 'End with' ; $ condition = [ $ this -> column , 'like' , "%{$this->value}" ] ; return $ this -> joinGroup ( $ label , $ condition ) ; }
Filter out records which ends with input query .
22,372
protected function hydrateFiles ( array $ value ) { if ( empty ( $ value ) ) { return [ [ $ this -> column => $ this -> getRules ( ) ] , [ ] ] ; } $ rules = $ input = [ ] ; foreach ( $ value as $ key => $ file ) { $ rules [ $ this -> column . $ key ] = $ this -> getRules ( ) ; $ input [ $ this -> column . $ key ] = $ f...
Hydrate the files array .
22,373
public function disableView ( bool $ disable = true ) { if ( $ disable ) { array_delete ( $ this -> actions , 'view' ) ; } elseif ( ! in_array ( 'view' , $ this -> actions ) ) { array_push ( $ this -> actions , 'view' ) ; } return $ this ; }
Disable view action .
22,374
public function footer ( Closure $ closure = null ) { if ( ! $ closure ) { return $ this -> footer ; } $ this -> footer = $ closure ; return $ this ; }
Set grid footer .
22,375
public function edit ( $ id ) { $ this -> builder -> setMode ( Builder :: MODE_EDIT ) ; $ this -> builder -> setResourceId ( $ id ) ; $ this -> setFieldValue ( $ id ) ; return $ this ; }
Generate a edit form .
22,376
public function tab ( $ title , Closure $ content , $ active = false ) { $ this -> getTab ( ) -> append ( $ title , $ content , $ active ) ; return $ this ; }
Use tab to split form .
22,377
public function getTab ( ) { if ( is_null ( $ this -> tab ) ) { $ this -> tab = new Tab ( $ this ) ; } return $ this -> tab ; }
Get Tab instance .
22,378
protected function deleteFiles ( Model $ model , $ forceDelete = false ) { if ( ! $ forceDelete && $ this -> isSoftDeletes ) { return ; } $ data = $ model -> toArray ( ) ; $ this -> builder -> fields ( ) -> filter ( function ( $ field ) { return $ field instanceof Field \ File ; } ) -> each ( function ( Field \ File $ ...
Remove files in record .
22,379
protected function ajaxResponse ( $ message ) { $ request = Request :: capture ( ) ; if ( $ request -> ajax ( ) && ! $ request -> pjax ( ) ) { return response ( ) -> json ( [ 'status' => true , 'message' => $ message , ] ) ; } return false ; }
Get ajax response .
22,380
protected function redirectAfterStore ( ) { $ resourcesPath = $ this -> resource ( 0 ) ; $ key = $ this -> model -> getKey ( ) ; return $ this -> redirectAfterSaving ( $ resourcesPath , $ key ) ; }
Get RedirectResponse after store .
22,381
protected function redirectAfterSaving ( $ resourcesPath , $ key ) { if ( request ( 'after-save' ) == 1 ) { $ url = rtrim ( $ resourcesPath , '/' ) . "/{$key}/edit" ; } elseif ( request ( 'after-save' ) == 2 ) { $ url = rtrim ( $ resourcesPath , '/' ) . '/create' ; } elseif ( request ( 'after-save' ) == 3 ) { $ url = r...
Get RedirectResponse after data saving .
22,382
protected function handleColumnUpdates ( $ id , $ data ) { $ data = $ this -> handleEditable ( $ data ) ; $ data = $ this -> handleFileDelete ( $ data ) ; $ data = $ this -> handleFileSort ( $ data ) ; if ( $ this -> handleOrderable ( $ id , $ data ) ) { return response ( [ 'status' => true , 'message' => trans ( 'admi...
Handle updates for single column .
22,383
protected function isHasOneRelation ( $ inserts ) { $ first = current ( $ inserts ) ; if ( ! is_array ( $ first ) ) { return false ; } if ( is_array ( current ( $ first ) ) ) { return false ; } return Arr :: isAssoc ( $ first ) ; }
Is input data is has - one relation .
22,384
public function validationMessages ( $ input ) { $ failedValidators = [ ] ; foreach ( $ this -> builder -> fields ( ) as $ field ) { if ( ! $ validator = $ field -> getValidator ( $ input ) ) { continue ; } if ( ( $ validator instanceof Validator ) && ! $ validator -> passes ( ) ) { $ failedValidators [ ] = $ validator...
Get validation messages .
22,385
protected function mergeValidationMessages ( $ validators ) { $ messageBag = new MessageBag ( ) ; foreach ( $ validators as $ validator ) { $ messageBag = $ messageBag -> merge ( $ validator -> messages ( ) ) ; } return $ messageBag ; }
Merge validation messages from input validators .
22,386
public function disableSubmit ( bool $ disable = true ) { $ this -> builder ( ) -> getFooter ( ) -> disableSubmit ( $ disable ) ; return $ this ; }
Disable form submit .
22,387
public function disableReset ( bool $ disable = true ) { $ this -> builder ( ) -> getFooter ( ) -> disableReset ( $ disable ) ; return $ this ; }
Disable form reset .
22,388
public function disableViewCheck ( bool $ disable = true ) { $ this -> builder ( ) -> getFooter ( ) -> disableViewCheck ( $ disable ) ; return $ this ; }
Disable View Checkbox on footer .
22,389
public function disableEditingCheck ( bool $ disable = true ) { $ this -> builder ( ) -> getFooter ( ) -> disableEditingCheck ( $ disable ) ; return $ this ; }
Disable Editing Checkbox on footer .
22,390
public function disableCreatingCheck ( bool $ disable = true ) { $ this -> builder ( ) -> getFooter ( ) -> disableCreatingCheck ( $ disable ) ; return $ this ; }
Disable Creating Checkbox on footer .
22,391
public function resource ( $ slice = - 2 ) { $ segments = explode ( '/' , trim ( app ( 'request' ) -> getUri ( ) , '/' ) ) ; if ( $ slice != 0 ) { $ segments = array_slice ( $ segments , 0 , $ slice ) ; } return implode ( '/' , $ segments ) ; }
Get current resource route url .
22,392
public static function findFieldClass ( $ method ) { if ( isset ( static :: $ fieldAlias [ $ method ] ) ) { $ method = static :: $ fieldAlias [ $ method ] ; } $ class = Arr :: get ( static :: $ availableFields , $ method ) ; if ( class_exists ( $ class ) ) { return $ class ; } return false ; }
Find field class .
22,393
protected function createRoutesFile ( ) { $ file = $ this -> directory . '/routes.php' ; $ contents = $ this -> getStub ( 'routes' ) ; $ this -> laravel [ 'files' ] -> put ( $ file , str_replace ( 'DummyNamespace' , config ( 'admin.route.namespace' ) , $ contents ) ) ; $ this -> line ( '<info>Routes file was created:</...
Create routes file .
22,394
protected function initialize ( ) { $ this -> perPageName = $ this -> grid -> model ( ) -> getPerPageName ( ) ; $ this -> perPage = ( int ) app ( 'request' ) -> input ( $ this -> perPageName , $ this -> grid -> perPage ) ; }
Do initialize work .
22,395
public function getOptions ( ) { return collect ( $ this -> grid -> perPages ) -> push ( $ this -> grid -> perPage ) -> push ( $ this -> perPage ) -> unique ( ) -> sort ( ) ; }
Get options for selector .
22,396
protected function modelExists ( ) { $ model = $ this -> option ( 'model' ) ; if ( empty ( $ model ) ) { return true ; } return class_exists ( $ model ) && is_subclass_of ( $ model , Model :: class ) ; }
Determine if the model is exists .
22,397
protected function __offset ( $ vtable_offset ) { $ vtable = $ this -> bb_pos - $ this -> bb -> getInt ( $ this -> bb_pos ) ; return $ vtable_offset < $ this -> bb -> getShort ( $ vtable ) ? $ this -> bb -> getShort ( $ vtable + $ vtable_offset ) : 0 ; }
returns actual vtable offset
22,398
protected function __string ( $ offset ) { $ offset += $ this -> bb -> getInt ( $ offset ) ; $ len = $ this -> bb -> getInt ( $ offset ) ; $ startPos = $ offset + Constants :: SIZEOF_INT ; return substr ( $ this -> bb -> _buffer , $ startPos , $ len ) ; }
fetch utf8 encoded string .
22,399
public function addOffset ( $ off ) { $ this -> prep ( Constants :: SIZEOF_INT , 0 ) ; if ( $ off > $ this -> offset ( ) ) { throw new \ Exception ( "" ) ; } $ this -> putOffset ( $ off ) ; }
Adds on offset relative to where it will be written .