id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
207,300 | z-song/laravel-admin | src/Tree.php | Tree.variables | public function variables()
{
return [
'id' => $this->elementId,
'tools' => $this->tools->render(),
'items' => $this->getItems(),
'useCreate' => $this->useCreate,
'useSave' => $this->useSave,
'useRefresh' => $this-... | php | public function variables()
{
return [
'id' => $this->elementId,
'tools' => $this->tools->render(),
'items' => $this->getItems(),
'useCreate' => $this->useCreate,
'useSave' => $this->useSave,
'useRefresh' => $this-... | [
"public",
"function",
"variables",
"(",
")",
"{",
"return",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"elementId",
",",
"'tools'",
"=>",
"$",
"this",
"->",
"tools",
"->",
"render",
"(",
")",
",",
"'items'",
"=>",
"$",
"this",
"->",
"getItems",
"(",
")",
... | Variables in tree template.
@return array | [
"Variables",
"in",
"tree",
"template",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Tree.php#L333-L343 |
207,301 | z-song/laravel-admin | src/Form/Field/Select.php | Select.loads | public function loads($fields = [], $sourceUrls = [], $idField = 'id', $textField = 'text')
{
$fieldsStr = implode('.', $fields);
$urlsStr = implode('^', $sourceUrls);
$script = <<<EOT
var fields = '$fieldsStr'.split('.');
var urls = '$urlsStr'.split('^');
var refreshOptions = function(url,... | php | public function loads($fields = [], $sourceUrls = [], $idField = 'id', $textField = 'text')
{
$fieldsStr = implode('.', $fields);
$urlsStr = implode('^', $sourceUrls);
$script = <<<EOT
var fields = '$fieldsStr'.split('.');
var urls = '$urlsStr'.split('^');
var refreshOptions = function(url,... | [
"public",
"function",
"loads",
"(",
"$",
"fields",
"=",
"[",
"]",
",",
"$",
"sourceUrls",
"=",
"[",
"]",
",",
"$",
"idField",
"=",
"'id'",
",",
"$",
"textField",
"=",
"'text'",
")",
"{",
"$",
"fieldsStr",
"=",
"implode",
"(",
"'.'",
",",
"$",
"fi... | Load options for other selects on change.
@param array $fields
@param array $sourceUrls
@param string $idField
@param string $textField
@return $this | [
"Load",
"options",
"for",
"other",
"selects",
"on",
"change",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Select.php#L150-L190 |
207,302 | z-song/laravel-admin | src/Form/Field/Select.php | Select.ajax | public function ajax($url, $idField = 'id', $textField = 'text')
{
$configs = array_merge([
'allowClear' => true,
'placeholder' => $this->label,
'minimumInputLength' => 1,
], $this->config);
$configs = json_encode($configs);
$config... | php | public function ajax($url, $idField = 'id', $textField = 'text')
{
$configs = array_merge([
'allowClear' => true,
'placeholder' => $this->label,
'minimumInputLength' => 1,
], $this->config);
$configs = json_encode($configs);
$config... | [
"public",
"function",
"ajax",
"(",
"$",
"url",
",",
"$",
"idField",
"=",
"'id'",
",",
"$",
"textField",
"=",
"'text'",
")",
"{",
"$",
"configs",
"=",
"array_merge",
"(",
"[",
"'allowClear'",
"=>",
"true",
",",
"'placeholder'",
"=>",
"$",
"this",
"->",
... | Load options from ajax results.
@param string $url
@param $idField
@param $textField
@return $this | [
"Load",
"options",
"from",
"ajax",
"results",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/Select.php#L293-L342 |
207,303 | z-song/laravel-admin | src/Widgets/Table.php | Table.setRows | public function setRows($rows = [])
{
if (Arr::isAssoc($rows)) {
foreach ($rows as $key => $item) {
$this->rows[] = [$key, $item];
}
return $this;
}
$this->rows = $rows;
return $this;
} | php | public function setRows($rows = [])
{
if (Arr::isAssoc($rows)) {
foreach ($rows as $key => $item) {
$this->rows[] = [$key, $item];
}
return $this;
}
$this->rows = $rows;
return $this;
} | [
"public",
"function",
"setRows",
"(",
"$",
"rows",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"Arr",
"::",
"isAssoc",
"(",
"$",
"rows",
")",
")",
"{",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"ro... | Set table rows.
@param array $rows
@return $this | [
"Set",
"table",
"rows",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Table.php#L67-L80 |
207,304 | z-song/laravel-admin | src/Auth/Database/HasPermissions.php | HasPermissions.allPermissions | public function allPermissions() : Collection
{
return $this->roles()->with('permissions')->get()->pluck('permissions')->flatten()->merge($this->permissions);
} | php | public function allPermissions() : Collection
{
return $this->roles()->with('permissions')->get()->pluck('permissions')->flatten()->merge($this->permissions);
} | [
"public",
"function",
"allPermissions",
"(",
")",
":",
"Collection",
"{",
"return",
"$",
"this",
"->",
"roles",
"(",
")",
"->",
"with",
"(",
"'permissions'",
")",
"->",
"get",
"(",
")",
"->",
"pluck",
"(",
"'permissions'",
")",
"->",
"flatten",
"(",
")... | Get all permissions of user.
@return mixed | [
"Get",
"all",
"permissions",
"of",
"user",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Auth/Database/HasPermissions.php#L14-L17 |
207,305 | z-song/laravel-admin | src/Auth/Database/HasPermissions.php | HasPermissions.visible | public function visible(array $roles = []) : bool
{
if (empty($roles)) {
return true;
}
$roles = array_column($roles, 'slug');
return $this->inRoles($roles) || $this->isAdministrator();
} | php | public function visible(array $roles = []) : bool
{
if (empty($roles)) {
return true;
}
$roles = array_column($roles, 'slug');
return $this->inRoles($roles) || $this->isAdministrator();
} | [
"public",
"function",
"visible",
"(",
"array",
"$",
"roles",
"=",
"[",
"]",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"roles",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"roles",
"=",
"array_column",
"(",
"$",
"roles",
",",
"'slug... | If visible for roles.
@param $roles
@return bool | [
"If",
"visible",
"for",
"roles",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Auth/Database/HasPermissions.php#L93-L102 |
207,306 | z-song/laravel-admin | src/Form/Builder.php | Builder.getAction | public function getAction()
{
if ($this->action) {
return $this->action;
}
if ($this->isMode(static::MODE_EDIT)) {
return $this->form->resource().'/'.$this->id;
}
if ($this->isMode(static::MODE_CREATE)) {
return $this->form->resource(-1);... | php | public function getAction()
{
if ($this->action) {
return $this->action;
}
if ($this->isMode(static::MODE_EDIT)) {
return $this->form->resource().'/'.$this->id;
}
if ($this->isMode(static::MODE_CREATE)) {
return $this->form->resource(-1);... | [
"public",
"function",
"getAction",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"action",
")",
"{",
"return",
"$",
"this",
"->",
"action",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isMode",
"(",
"static",
"::",
"MODE_EDIT",
")",
")",
"{",
"return",
... | Get Form action.
@return string | [
"Get",
"Form",
"action",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Builder.php#L273-L288 |
207,307 | z-song/laravel-admin | src/Form/Builder.php | Builder.field | public function field($name)
{
return $this->fields()->first(function (Field $field) use ($name) {
return $field->column() == $name;
});
} | php | public function field($name)
{
return $this->fields()->first(function (Field $field) use ($name) {
return $field->column() == $name;
});
} | [
"public",
"function",
"field",
"(",
"$",
"name",
")",
"{",
"return",
"$",
"this",
"->",
"fields",
"(",
")",
"->",
"first",
"(",
"function",
"(",
"Field",
"$",
"field",
")",
"use",
"(",
"$",
"name",
")",
"{",
"return",
"$",
"field",
"->",
"column",
... | Get specify field.
@param string $name
@return mixed | [
"Get",
"specify",
"field",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Builder.php#L335-L340 |
207,308 | z-song/laravel-admin | src/Form/Builder.php | Builder.options | public function options($options = [])
{
if (empty($options)) {
return $this->options;
}
$this->options = array_merge($this->options, $options);
} | php | public function options($options = [])
{
if (empty($options)) {
return $this->options;
}
$this->options = array_merge($this->options, $options);
} | [
"public",
"function",
"options",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"options",
")",
")",
"{",
"return",
"$",
"this",
"->",
"options",
";",
"}",
"$",
"this",
"->",
"options",
"=",
"array_merge",
"(",
"$",
"... | Add or get options.
@param array $options
@return array|null | [
"Add",
"or",
"get",
"options",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Builder.php#L387-L394 |
207,309 | z-song/laravel-admin | src/Form/Builder.php | Builder.hasFile | public function hasFile()
{
foreach ($this->fields() as $field) {
if ($field instanceof Field\File) {
return true;
}
}
return false;
} | php | public function hasFile()
{
foreach ($this->fields() as $field) {
if ($field instanceof Field\File) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasFile",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"(",
")",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"instanceof",
"Field",
"\\",
"File",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
... | Determine if form fields has files.
@return bool | [
"Determine",
"if",
"form",
"fields",
"has",
"files",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Builder.php#L440-L449 |
207,310 | z-song/laravel-admin | src/Form/Builder.php | Builder.render | public function render()
{
$this->removeReservedFields();
$tabObj = $this->form->getTab();
if (!$tabObj->isEmpty()) {
$script = <<<'SCRIPT'
var hash = document.location.hash;
if (hash) {
$('.nav-tabs a[href="' + hash + '"]').tab('show');
}
// Change hash for page-reload
$... | php | public function render()
{
$this->removeReservedFields();
$tabObj = $this->form->getTab();
if (!$tabObj->isEmpty()) {
$script = <<<'SCRIPT'
var hash = document.location.hash;
if (hash) {
$('.nav-tabs a[href="' + hash + '"]').tab('show');
}
// Change hash for page-reload
$... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"this",
"->",
"removeReservedFields",
"(",
")",
";",
"$",
"tabObj",
"=",
"$",
"this",
"->",
"form",
"->",
"getTab",
"(",
")",
";",
"if",
"(",
"!",
"$",
"tabObj",
"->",
"isEmpty",
"(",
")",
")",
... | Render form.
@return string | [
"Render",
"form",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Builder.php#L564-L604 |
207,311 | z-song/laravel-admin | src/Form/EmbeddedForm.php | EmbeddedForm.formatField | protected function formatField(Field $field)
{
$jsonKey = $field->column();
$elementName = $elementClass = $errorKey = [];
if (is_array($jsonKey)) {
foreach ($jsonKey as $index => $name) {
$elementName[$index] = "{$this->column}[$name]";
$errorKe... | php | protected function formatField(Field $field)
{
$jsonKey = $field->column();
$elementName = $elementClass = $errorKey = [];
if (is_array($jsonKey)) {
foreach ($jsonKey as $index => $name) {
$elementName[$index] = "{$this->column}[$name]";
$errorKe... | [
"protected",
"function",
"formatField",
"(",
"Field",
"$",
"field",
")",
"{",
"$",
"jsonKey",
"=",
"$",
"field",
"->",
"column",
"(",
")",
";",
"$",
"elementName",
"=",
"$",
"elementClass",
"=",
"$",
"errorKey",
"=",
"[",
"]",
";",
"if",
"(",
"is_arr... | Format form, set `element name` `error key` and `element class`.
@param Field $field
@return Field | [
"Format",
"form",
"set",
"element",
"name",
"error",
"key",
"and",
"element",
"class",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/EmbeddedForm.php#L217-L240 |
207,312 | z-song/laravel-admin | src/Form/EmbeddedForm.php | EmbeddedForm.pushField | public function pushField(Field $field)
{
$field = $this->formatField($field);
$this->fields->push($field);
return $this;
} | php | public function pushField(Field $field)
{
$field = $this->formatField($field);
$this->fields->push($field);
return $this;
} | [
"public",
"function",
"pushField",
"(",
"Field",
"$",
"field",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"formatField",
"(",
"$",
"field",
")",
";",
"$",
"this",
"->",
"fields",
"->",
"push",
"(",
"$",
"field",
")",
";",
"return",
"$",
"this"... | Add a field to form.
@param Field $field
@return $this | [
"Add",
"a",
"field",
"to",
"form",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/EmbeddedForm.php#L249-L256 |
207,313 | z-song/laravel-admin | src/Grid/Model.php | Model.getConstraints | public function getConstraints()
{
if ($this->relation instanceof HasMany) {
return [
$this->relation->getForeignKeyName() => $this->relation->getParentKey(),
];
}
return false;
} | php | public function getConstraints()
{
if ($this->relation instanceof HasMany) {
return [
$this->relation->getForeignKeyName() => $this->relation->getParentKey(),
];
}
return false;
} | [
"public",
"function",
"getConstraints",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"relation",
"instanceof",
"HasMany",
")",
"{",
"return",
"[",
"$",
"this",
"->",
"relation",
"->",
"getForeignKeyName",
"(",
")",
"=>",
"$",
"this",
"->",
"relation",
"-... | Get constraints.
@return array|bool | [
"Get",
"constraints",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Model.php#L259-L268 |
207,314 | z-song/laravel-admin | src/Grid/Model.php | Model.addConditions | public function addConditions(array $conditions)
{
foreach ($conditions as $condition) {
call_user_func_array([$this, key($condition)], current($condition));
}
return $this;
} | php | public function addConditions(array $conditions)
{
foreach ($conditions as $condition) {
call_user_func_array([$this, key($condition)], current($condition));
}
return $this;
} | [
"public",
"function",
"addConditions",
"(",
"array",
"$",
"conditions",
")",
"{",
"foreach",
"(",
"$",
"conditions",
"as",
"$",
"condition",
")",
"{",
"call_user_func_array",
"(",
"[",
"$",
"this",
",",
"key",
"(",
"$",
"condition",
")",
"]",
",",
"curre... | Add conditions to grid model.
@param array $conditions
@return $this | [
"Add",
"conditions",
"to",
"grid",
"model",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Model.php#L340-L347 |
207,315 | z-song/laravel-admin | src/Grid/Model.php | Model.handleInvalidPage | protected function handleInvalidPage(LengthAwarePaginator $paginator)
{
if ($paginator->lastPage() && $paginator->currentPage() > $paginator->lastPage()) {
$lastPageUrl = Request::fullUrlWithQuery([
$paginator->getPageName() => $paginator->lastPage(),
]);
... | php | protected function handleInvalidPage(LengthAwarePaginator $paginator)
{
if ($paginator->lastPage() && $paginator->currentPage() > $paginator->lastPage()) {
$lastPageUrl = Request::fullUrlWithQuery([
$paginator->getPageName() => $paginator->lastPage(),
]);
... | [
"protected",
"function",
"handleInvalidPage",
"(",
"LengthAwarePaginator",
"$",
"paginator",
")",
"{",
"if",
"(",
"$",
"paginator",
"->",
"lastPage",
"(",
")",
"&&",
"$",
"paginator",
"->",
"currentPage",
"(",
")",
">",
"$",
"paginator",
"->",
"lastPage",
"(... | If current page is greater than last page, then redirect to last page.
@param LengthAwarePaginator $paginator
@return void | [
"If",
"current",
"page",
"is",
"greater",
"than",
"last",
"page",
"then",
"redirect",
"to",
"last",
"page",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Model.php#L423-L432 |
207,316 | z-song/laravel-admin | src/Grid/Model.php | Model.setPaginate | protected function setPaginate()
{
$paginate = $this->findQueryByMethod('paginate');
$this->queries = $this->queries->reject(function ($query) {
return $query['method'] == 'paginate';
});
if (!$this->usePaginate) {
$query = [
'method' => '... | php | protected function setPaginate()
{
$paginate = $this->findQueryByMethod('paginate');
$this->queries = $this->queries->reject(function ($query) {
return $query['method'] == 'paginate';
});
if (!$this->usePaginate) {
$query = [
'method' => '... | [
"protected",
"function",
"setPaginate",
"(",
")",
"{",
"$",
"paginate",
"=",
"$",
"this",
"->",
"findQueryByMethod",
"(",
"'paginate'",
")",
";",
"$",
"this",
"->",
"queries",
"=",
"$",
"this",
"->",
"queries",
"->",
"reject",
"(",
"function",
"(",
"$",
... | Set the grid paginate.
@return void | [
"Set",
"the",
"grid",
"paginate",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Model.php#L439-L460 |
207,317 | z-song/laravel-admin | src/Grid/Model.php | Model.with | public function with($relations)
{
if (is_array($relations)) {
if (Arr::isAssoc($relations)) {
$relations = array_keys($relations);
}
$this->eagerLoads = array_merge($this->eagerLoads, $relations);
}
if (is_string($relations)) {
... | php | public function with($relations)
{
if (is_array($relations)) {
if (Arr::isAssoc($relations)) {
$relations = array_keys($relations);
}
$this->eagerLoads = array_merge($this->eagerLoads, $relations);
}
if (is_string($relations)) {
... | [
"public",
"function",
"with",
"(",
"$",
"relations",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"relations",
")",
")",
"{",
"if",
"(",
"Arr",
"::",
"isAssoc",
"(",
"$",
"relations",
")",
")",
"{",
"$",
"relations",
"=",
"array_keys",
"(",
"$",
"rel... | Set the relationships that should be eager loaded.
@param mixed $relations
@return $this|Model | [
"Set",
"the",
"relationships",
"that",
"should",
"be",
"eager",
"loaded",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Model.php#L656-L683 |
207,318 | z-song/laravel-admin | src/Form/Footer.php | Footer.disableReset | public function disableReset(bool $disable = true)
{
if ($disable) {
array_delete($this->buttons, 'reset');
} elseif (!in_array('reset', $this->buttons)) {
array_push($this->buttons, 'reset');
}
return $this;
} | php | public function disableReset(bool $disable = true)
{
if ($disable) {
array_delete($this->buttons, 'reset');
} elseif (!in_array('reset', $this->buttons)) {
array_push($this->buttons, 'reset');
}
return $this;
} | [
"public",
"function",
"disableReset",
"(",
"bool",
"$",
"disable",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"disable",
")",
"{",
"array_delete",
"(",
"$",
"this",
"->",
"buttons",
",",
"'reset'",
")",
";",
"}",
"elseif",
"(",
"!",
"in_array",
"(",
"'re... | Disable reset button.
@return $this | [
"Disable",
"reset",
"button",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Footer.php#L53-L62 |
207,319 | z-song/laravel-admin | src/Form/Footer.php | Footer.disableViewCheck | public function disableViewCheck(bool $disable = true)
{
if ($disable) {
array_delete($this->checkboxes, 'view');
} elseif (!in_array('view', $this->checkboxes)) {
array_push($this->checkboxes, 'view');
}
return $this;
} | php | public function disableViewCheck(bool $disable = true)
{
if ($disable) {
array_delete($this->checkboxes, 'view');
} elseif (!in_array('view', $this->checkboxes)) {
array_push($this->checkboxes, 'view');
}
return $this;
} | [
"public",
"function",
"disableViewCheck",
"(",
"bool",
"$",
"disable",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"disable",
")",
"{",
"array_delete",
"(",
"$",
"this",
"->",
"checkboxes",
",",
"'view'",
")",
";",
"}",
"elseif",
"(",
"!",
"in_array",
"(",
... | Disable View Checkbox.
@return $this | [
"Disable",
"View",
"Checkbox",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Footer.php#L85-L94 |
207,320 | z-song/laravel-admin | src/Form/Footer.php | Footer.render | public function render()
{
$this->setupScript();
$data = [
'buttons' => $this->buttons,
'checkboxes' => $this->checkboxes,
'width' => $this->builder->getWidth(),
];
return view($this->view, $data)->render();
} | php | public function render()
{
$this->setupScript();
$data = [
'buttons' => $this->buttons,
'checkboxes' => $this->checkboxes,
'width' => $this->builder->getWidth(),
];
return view($this->view, $data)->render();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"this",
"->",
"setupScript",
"(",
")",
";",
"$",
"data",
"=",
"[",
"'buttons'",
"=>",
"$",
"this",
"->",
"buttons",
",",
"'checkboxes'",
"=>",
"$",
"this",
"->",
"checkboxes",
",",
"'width'",
"=>",
... | Render footer.
@return string | [
"Render",
"footer",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Footer.php#L147-L158 |
207,321 | z-song/laravel-admin | src/Grid/Filter/Presenter/Select.php | Select.ajax | public function ajax($resourceUrl, $idField = 'id', $textField = 'text')
{
$configs = array_merge([
'allowClear' => true,
'placeholder' => trans('admin.choose'),
'minimumInputLength' => 1,
], $this->config);
$configs = json_encode($configs)... | php | public function ajax($resourceUrl, $idField = 'id', $textField = 'text')
{
$configs = array_merge([
'allowClear' => true,
'placeholder' => trans('admin.choose'),
'minimumInputLength' => 1,
], $this->config);
$configs = json_encode($configs)... | [
"public",
"function",
"ajax",
"(",
"$",
"resourceUrl",
",",
"$",
"idField",
"=",
"'id'",
",",
"$",
"textField",
"=",
"'text'",
")",
"{",
"$",
"configs",
"=",
"array_merge",
"(",
"[",
"'allowClear'",
"=>",
"true",
",",
"'placeholder'",
"=>",
"trans",
"(",... | Load options from ajax.
@param string $resourceUrl
@param $idField
@param $textField | [
"Load",
"options",
"from",
"ajax",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/Presenter/Select.php#L193-L240 |
207,322 | z-song/laravel-admin | src/Grid/Filter/Presenter/Select.php | Select.load | public function load($target, $resourceUrl, $idField = 'id', $textField = 'text') : self
{
$column = $this->filter->getColumn();
$script = <<<EOT
$(document).off('change', ".{$this->getClass($column)}");
$(document).on('change', ".{$this->getClass($column)}", function () {
var target = $(this).... | php | public function load($target, $resourceUrl, $idField = 'id', $textField = 'text') : self
{
$column = $this->filter->getColumn();
$script = <<<EOT
$(document).off('change', ".{$this->getClass($column)}");
$(document).on('change', ".{$this->getClass($column)}", function () {
var target = $(this).... | [
"public",
"function",
"load",
"(",
"$",
"target",
",",
"$",
"resourceUrl",
",",
"$",
"idField",
"=",
"'id'",
",",
"$",
"textField",
"=",
"'text'",
")",
":",
"self",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"filter",
"->",
"getColumn",
"(",
")",
... | Load options for other select when change.
@param string $target
@param string $resourceUrl
@param string $idField
@param string $textField
@return $this | [
"Load",
"options",
"for",
"other",
"select",
"when",
"change",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/Presenter/Select.php#L271-L296 |
207,323 | z-song/laravel-admin | src/Widgets/Tab.php | Tab.add | public function add($title, $content, $active = false)
{
$this->data['tabs'][] = [
'id' => mt_rand(),
'title' => $title,
'content' => $content,
'type' => static::TYPE_CONTENT,
];
if ($active) {
$this->data['active'] = cou... | php | public function add($title, $content, $active = false)
{
$this->data['tabs'][] = [
'id' => mt_rand(),
'title' => $title,
'content' => $content,
'type' => static::TYPE_CONTENT,
];
if ($active) {
$this->data['active'] = cou... | [
"public",
"function",
"add",
"(",
"$",
"title",
",",
"$",
"content",
",",
"$",
"active",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'tabs'",
"]",
"[",
"]",
"=",
"[",
"'id'",
"=>",
"mt_rand",
"(",
")",
",",
"'title'",
"=>",
"$",
"t... | Add a tab and its contents.
@param string $title
@param string|Renderable $content
@param bool $active
@return $this | [
"Add",
"a",
"tab",
"and",
"its",
"contents",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Tab.php#L42-L56 |
207,324 | z-song/laravel-admin | src/Widgets/Tab.php | Tab.addLink | public function addLink($title, $href, $active = false)
{
$this->data['tabs'][] = [
'id' => mt_rand(),
'title' => $title,
'href' => $href,
'type' => static::TYPE_LINK,
];
if ($active) {
$this->data['active'] = count($t... | php | public function addLink($title, $href, $active = false)
{
$this->data['tabs'][] = [
'id' => mt_rand(),
'title' => $title,
'href' => $href,
'type' => static::TYPE_LINK,
];
if ($active) {
$this->data['active'] = count($t... | [
"public",
"function",
"addLink",
"(",
"$",
"title",
",",
"$",
"href",
",",
"$",
"active",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'tabs'",
"]",
"[",
"]",
"=",
"[",
"'id'",
"=>",
"mt_rand",
"(",
")",
",",
"'title'",
"=>",
"$",
"... | Add a link on tab.
@param string $title
@param string $href
@param bool $active
@return $this | [
"Add",
"a",
"link",
"on",
"tab",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Tab.php#L67-L81 |
207,325 | z-song/laravel-admin | src/Widgets/Tab.php | Tab.dropDown | public function dropDown(array $links)
{
if (is_array($links[0])) {
foreach ($links as $link) {
call_user_func([$this, 'dropDown'], $link);
}
return $this;
}
$this->data['dropDown'][] = [
'name' => $links[0],
'href... | php | public function dropDown(array $links)
{
if (is_array($links[0])) {
foreach ($links as $link) {
call_user_func([$this, 'dropDown'], $link);
}
return $this;
}
$this->data['dropDown'][] = [
'name' => $links[0],
'href... | [
"public",
"function",
"dropDown",
"(",
"array",
"$",
"links",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"links",
"[",
"0",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"links",
"as",
"$",
"link",
")",
"{",
"call_user_func",
"(",
"[",
"$",
"this",
",... | Set drop-down items.
@param array $links
@return $this | [
"Set",
"drop",
"-",
"down",
"items",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Tab.php#L100-L116 |
207,326 | z-song/laravel-admin | src/Widgets/Tab.php | Tab.render | public function render()
{
$data = array_merge(
$this->data,
['attributes' => $this->formatAttributes()]
);
return view($this->view, $data)->render();
} | php | public function render()
{
$data = array_merge(
$this->data,
['attributes' => $this->formatAttributes()]
);
return view($this->view, $data)->render();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"data",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"data",
",",
"[",
"'attributes'",
"=>",
"$",
"this",
"->",
"formatAttributes",
"(",
")",
"]",
")",
";",
"return",
"view",
"(",
"$",
"this",
"->",
... | Render Tab.
@return string | [
"Render",
"Tab",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Widgets/Tab.php#L123-L131 |
207,327 | z-song/laravel-admin | src/Middleware/LogOperation.php | LogOperation.inAllowedMethods | protected function inAllowedMethods($method)
{
$allowedMethods = collect(config('admin.operation_log.allowed_methods'))->filter();
if ($allowedMethods->isEmpty()) {
return true;
}
return $allowedMethods->map(function ($method) {
return strtoupper($method);
... | php | protected function inAllowedMethods($method)
{
$allowedMethods = collect(config('admin.operation_log.allowed_methods'))->filter();
if ($allowedMethods->isEmpty()) {
return true;
}
return $allowedMethods->map(function ($method) {
return strtoupper($method);
... | [
"protected",
"function",
"inAllowedMethods",
"(",
"$",
"method",
")",
"{",
"$",
"allowedMethods",
"=",
"collect",
"(",
"config",
"(",
"'admin.operation_log.allowed_methods'",
")",
")",
"->",
"filter",
"(",
")",
";",
"if",
"(",
"$",
"allowedMethods",
"->",
"isE... | Whether requests using this method are allowed to be logged.
@param string $method
@return bool | [
"Whether",
"requests",
"using",
"this",
"method",
"are",
"allowed",
"to",
"be",
"logged",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Middleware/LogOperation.php#L61-L72 |
207,328 | z-song/laravel-admin | src/Grid/Exporter.php | Exporter.resolve | public function resolve($driver)
{
if ($driver instanceof Grid\Exporters\AbstractExporter) {
return $driver->setGrid($this->grid);
}
return $this->getExporter($driver);
} | php | public function resolve($driver)
{
if ($driver instanceof Grid\Exporters\AbstractExporter) {
return $driver->setGrid($this->grid);
}
return $this->getExporter($driver);
} | [
"public",
"function",
"resolve",
"(",
"$",
"driver",
")",
"{",
"if",
"(",
"$",
"driver",
"instanceof",
"Grid",
"\\",
"Exporters",
"\\",
"AbstractExporter",
")",
"{",
"return",
"$",
"driver",
"->",
"setGrid",
"(",
"$",
"this",
"->",
"grid",
")",
";",
"}... | Resolve export driver.
@param string $driver
@return CsvExporter | [
"Resolve",
"export",
"driver",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Exporter.php#L76-L83 |
207,329 | z-song/laravel-admin | src/Grid/Exporter.php | Exporter.getExporter | protected function getExporter($driver)
{
if (!array_key_exists($driver, static::$drivers)) {
return $this->getDefaultExporter();
}
return new static::$drivers[$driver]($this->grid);
} | php | protected function getExporter($driver)
{
if (!array_key_exists($driver, static::$drivers)) {
return $this->getDefaultExporter();
}
return new static::$drivers[$driver]($this->grid);
} | [
"protected",
"function",
"getExporter",
"(",
"$",
"driver",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"driver",
",",
"static",
"::",
"$",
"drivers",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getDefaultExporter",
"(",
")",
";",
"}",
"re... | Get export driver.
@param string $driver
@return CsvExporter | [
"Get",
"export",
"driver",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Exporter.php#L92-L99 |
207,330 | z-song/laravel-admin | src/Console/AdminCommand.php | AdminCommand.listAdminCommands | protected function listAdminCommands()
{
$commands = collect(Artisan::all())->mapWithKeys(function ($command, $key) {
if (Str::startsWith($key, 'admin:')) {
return [$key => $command];
}
return [];
})->toArray();
$width = $this->getColumnW... | php | protected function listAdminCommands()
{
$commands = collect(Artisan::all())->mapWithKeys(function ($command, $key) {
if (Str::startsWith($key, 'admin:')) {
return [$key => $command];
}
return [];
})->toArray();
$width = $this->getColumnW... | [
"protected",
"function",
"listAdminCommands",
"(",
")",
"{",
"$",
"commands",
"=",
"collect",
"(",
"Artisan",
"::",
"all",
"(",
")",
")",
"->",
"mapWithKeys",
"(",
"function",
"(",
"$",
"command",
",",
"$",
"key",
")",
"{",
"if",
"(",
"Str",
"::",
"s... | List all admin commands.
@return void | [
"List",
"all",
"admin",
"commands",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/AdminCommand.php#L57-L73 |
207,331 | z-song/laravel-admin | src/Console/ExportSeedCommand.php | ExportSeedCommand.getTableDataArrayAsString | protected function getTableDataArrayAsString($table, $exceptFields = [])
{
$fields = \DB::getSchemaBuilder()->getColumnListing($table);
$fields = array_diff($fields, $exceptFields);
$array = \DB::table($table)->get($fields)->map(function ($item) {
return (array) $item;
}... | php | protected function getTableDataArrayAsString($table, $exceptFields = [])
{
$fields = \DB::getSchemaBuilder()->getColumnListing($table);
$fields = array_diff($fields, $exceptFields);
$array = \DB::table($table)->get($fields)->map(function ($item) {
return (array) $item;
}... | [
"protected",
"function",
"getTableDataArrayAsString",
"(",
"$",
"table",
",",
"$",
"exceptFields",
"=",
"[",
"]",
")",
"{",
"$",
"fields",
"=",
"\\",
"DB",
"::",
"getSchemaBuilder",
"(",
")",
"->",
"getColumnListing",
"(",
"$",
"table",
")",
";",
"$",
"f... | Get data array from table as string result var_export.
@param string $table
@param array $exceptFields
@return string | [
"Get",
"data",
"array",
"from",
"table",
"as",
"string",
"result",
"var_export",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/ExportSeedCommand.php#L87-L97 |
207,332 | z-song/laravel-admin | src/Console/ExportSeedCommand.php | ExportSeedCommand.varExport | protected function varExport($var, $indent = '')
{
switch (gettype($var)) {
case 'string':
return '"'.addcslashes($var, "\\\$\"\r\n\t\v\f").'"';
case 'array':
$indexed = array_keys($var) === range(0, count($var) - 1);
$r = [];
... | php | protected function varExport($var, $indent = '')
{
switch (gettype($var)) {
case 'string':
return '"'.addcslashes($var, "\\\$\"\r\n\t\v\f").'"';
case 'array':
$indexed = array_keys($var) === range(0, count($var) - 1);
$r = [];
... | [
"protected",
"function",
"varExport",
"(",
"$",
"var",
",",
"$",
"indent",
"=",
"''",
")",
"{",
"switch",
"(",
"gettype",
"(",
"$",
"var",
")",
")",
"{",
"case",
"'string'",
":",
"return",
"'\"'",
".",
"addcslashes",
"(",
"$",
"var",
",",
"\"\\\\\\$\... | Custom var_export for correct work with \r\n.
@param $var
@param string $indent
@return string | [
"Custom",
"var_export",
"for",
"correct",
"work",
"with",
"\\",
"r",
"\\",
"n",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Console/ExportSeedCommand.php#L119-L149 |
207,333 | z-song/laravel-admin | src/Show/Relation.php | Relation.render | public function render()
{
$relation = $this->model->{$this->name}();
$renderable = $this->getNullRenderable();
if ($relation instanceof HasOne
|| $relation instanceof BelongsTo
|| $relation instanceof MorphOne
) {
$model = $this->model->{$thi... | php | public function render()
{
$relation = $this->model->{$this->name}();
$renderable = $this->getNullRenderable();
if ($relation instanceof HasOne
|| $relation instanceof BelongsTo
|| $relation instanceof MorphOne
) {
$model = $this->model->{$thi... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"relation",
"=",
"$",
"this",
"->",
"model",
"->",
"{",
"$",
"this",
"->",
"name",
"}",
"(",
")",
";",
"$",
"renderable",
"=",
"$",
"this",
"->",
"getNullRenderable",
"(",
")",
";",
"if",
"(",
"... | Render this relation panel.
@return string | [
"Render",
"this",
"relation",
"panel",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Relation.php#L94-L128 |
207,334 | z-song/laravel-admin | src/Grid/Column.php | Column.setGrid | public function setGrid(Grid $grid)
{
$this->grid = $grid;
$this->setModel($grid->model()->eloquent());
} | php | public function setGrid(Grid $grid)
{
$this->grid = $grid;
$this->setModel($grid->model()->eloquent());
} | [
"public",
"function",
"setGrid",
"(",
"Grid",
"$",
"grid",
")",
"{",
"$",
"this",
"->",
"grid",
"=",
"$",
"grid",
";",
"$",
"this",
"->",
"setModel",
"(",
"$",
"grid",
"->",
"model",
"(",
")",
"->",
"eloquent",
"(",
")",
")",
";",
"}"
] | Set grid instance for column.
@param Grid $grid | [
"Set",
"grid",
"instance",
"for",
"column",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L160-L165 |
207,335 | z-song/laravel-admin | src/Grid/Column.php | Column.setRelation | public function setRelation($relation, $relationColumn = null)
{
$this->relation = $relation;
$this->relationColumn = $relationColumn;
return $this;
} | php | public function setRelation($relation, $relationColumn = null)
{
$this->relation = $relation;
$this->relationColumn = $relationColumn;
return $this;
} | [
"public",
"function",
"setRelation",
"(",
"$",
"relation",
",",
"$",
"relationColumn",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"relation",
"=",
"$",
"relation",
";",
"$",
"this",
"->",
"relationColumn",
"=",
"$",
"relationColumn",
";",
"return",
"$",
"... | Set relation.
@param string $relation
@param string $relationColumn
@return $this | [
"Set",
"relation",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L269-L275 |
207,336 | z-song/laravel-admin | src/Grid/Column.php | Column.displayUsing | public function displayUsing($abstract, $arguments = [])
{
$grid = $this->grid;
$column = $this;
return $this->display(function ($value) use ($grid, $column, $abstract, $arguments) {
/** @var AbstractDisplayer $displayer */
$displayer = new $abstract($value, $grid, ... | php | public function displayUsing($abstract, $arguments = [])
{
$grid = $this->grid;
$column = $this;
return $this->display(function ($value) use ($grid, $column, $abstract, $arguments) {
/** @var AbstractDisplayer $displayer */
$displayer = new $abstract($value, $grid, ... | [
"public",
"function",
"displayUsing",
"(",
"$",
"abstract",
",",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"grid",
"=",
"$",
"this",
"->",
"grid",
";",
"$",
"column",
"=",
"$",
"this",
";",
"return",
"$",
"this",
"->",
"display",
"(",
"functi... | Display using display abstract.
@param string $abstract
@param array $arguments
@return Column | [
"Display",
"using",
"display",
"abstract",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L345-L357 |
207,337 | z-song/laravel-admin | src/Grid/Column.php | Column.view | public function view($view)
{
return $this->display(function ($value) use ($view) {
$model = $this;
return view($view, compact('model', 'value'))->render();
});
} | php | public function view($view)
{
return $this->display(function ($value) use ($view) {
$model = $this;
return view($view, compact('model', 'value'))->render();
});
} | [
"public",
"function",
"view",
"(",
"$",
"view",
")",
"{",
"return",
"$",
"this",
"->",
"display",
"(",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"$",
"view",
")",
"{",
"$",
"model",
"=",
"$",
"this",
";",
"return",
"view",
"(",
"$",
"view",... | Render this column with the given view.
@param string $view
@return $this | [
"Render",
"this",
"column",
"with",
"the",
"given",
"view",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L385-L392 |
207,338 | z-song/laravel-admin | src/Grid/Column.php | Column.totalRow | public function totalRow($display = null)
{
$this->grid->addTotalRow($this->name, $display);
return $this;
} | php | public function totalRow($display = null)
{
$this->grid->addTotalRow($this->name, $display);
return $this;
} | [
"public",
"function",
"totalRow",
"(",
"$",
"display",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"grid",
"->",
"addTotalRow",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"display",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add column to total-row.
@param null $display
@return $this | [
"Add",
"column",
"to",
"total",
"-",
"row",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L401-L406 |
207,339 | z-song/laravel-admin | src/Grid/Column.php | Column.htmlEntityEncode | protected function htmlEntityEncode($item)
{
if (is_array($item)) {
array_walk_recursive($item, function (&$value) {
$value = htmlentities($value);
});
} else {
$item = htmlentities($item);
}
return $item;
} | php | protected function htmlEntityEncode($item)
{
if (is_array($item)) {
array_walk_recursive($item, function (&$value) {
$value = htmlentities($value);
});
} else {
$item = htmlentities($item);
}
return $item;
} | [
"protected",
"function",
"htmlEntityEncode",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"item",
")",
")",
"{",
"array_walk_recursive",
"(",
"$",
"item",
",",
"function",
"(",
"&",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"htmlentiti... | Convert characters to HTML entities recursively.
@param array|string $item
@return mixed | [
"Convert",
"characters",
"to",
"HTML",
"entities",
"recursively",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L539-L550 |
207,340 | z-song/laravel-admin | src/Grid/Column.php | Column.sorter | public function sorter()
{
if (!$this->sortable) {
return '';
}
$icon = 'fa-sort';
$type = 'desc';
if ($this->isSorted()) {
$type = $this->sort['type'] == 'desc' ? 'asc' : 'desc';
$icon .= "-amount-{$this->sort['type']}";
}
... | php | public function sorter()
{
if (!$this->sortable) {
return '';
}
$icon = 'fa-sort';
$type = 'desc';
if ($this->isSorted()) {
$type = $this->sort['type'] == 'desc' ? 'asc' : 'desc';
$icon .= "-amount-{$this->sort['type']}";
}
... | [
"public",
"function",
"sorter",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"sortable",
")",
"{",
"return",
"''",
";",
"}",
"$",
"icon",
"=",
"'fa-sort'",
";",
"$",
"type",
"=",
"'desc'",
";",
"if",
"(",
"$",
"this",
"->",
"isSorted",
"(",
... | Create the column sorter.
@return string | [
"Create",
"the",
"column",
"sorter",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L557-L583 |
207,341 | z-song/laravel-admin | src/Grid/Column.php | Column.isSorted | protected function isSorted()
{
$this->sort = app('request')->get($this->grid->model()->getSortName());
if (empty($this->sort)) {
return false;
}
return isset($this->sort['column']) && $this->sort['column'] == $this->name;
} | php | protected function isSorted()
{
$this->sort = app('request')->get($this->grid->model()->getSortName());
if (empty($this->sort)) {
return false;
}
return isset($this->sort['column']) && $this->sort['column'] == $this->name;
} | [
"protected",
"function",
"isSorted",
"(",
")",
"{",
"$",
"this",
"->",
"sort",
"=",
"app",
"(",
"'request'",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"grid",
"->",
"model",
"(",
")",
"->",
"getSortName",
"(",
")",
")",
";",
"if",
"(",
"empty",
"... | Determine if this column is currently sorted.
@return bool | [
"Determine",
"if",
"this",
"column",
"is",
"currently",
"sorted",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L590-L599 |
207,342 | z-song/laravel-admin | src/Grid/Column.php | Column.resolveDisplayer | protected function resolveDisplayer($abstract, $arguments)
{
if (array_key_exists($abstract, static::$displayers)) {
return $this->callBuiltinDisplayer(static::$displayers[$abstract], $arguments);
}
return $this->callSupportDisplayer($abstract, $arguments);
} | php | protected function resolveDisplayer($abstract, $arguments)
{
if (array_key_exists($abstract, static::$displayers)) {
return $this->callBuiltinDisplayer(static::$displayers[$abstract], $arguments);
}
return $this->callSupportDisplayer($abstract, $arguments);
} | [
"protected",
"function",
"resolveDisplayer",
"(",
"$",
"abstract",
",",
"$",
"arguments",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"abstract",
",",
"static",
"::",
"$",
"displayers",
")",
")",
"{",
"return",
"$",
"this",
"->",
"callBuiltinDisplayer... | Find a displayer to display column.
@param string $abstract
@param array $arguments
@return Column | [
"Find",
"a",
"displayer",
"to",
"display",
"column",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Column.php#L609-L616 |
207,343 | z-song/laravel-admin | src/Admin.php | Admin.navbar | public function navbar(Closure $builder = null)
{
if (is_null($builder)) {
return $this->getNavbar();
}
call_user_func($builder, $this->getNavbar());
} | php | public function navbar(Closure $builder = null)
{
if (is_null($builder)) {
return $this->getNavbar();
}
call_user_func($builder, $this->getNavbar());
} | [
"public",
"function",
"navbar",
"(",
"Closure",
"$",
"builder",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"builder",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getNavbar",
"(",
")",
";",
"}",
"call_user_func",
"(",
"$",
"builder",
",",... | Set navbar.
@param Closure|null $builder
@return Navbar | [
"Set",
"navbar",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Admin.php#L230-L237 |
207,344 | z-song/laravel-admin | src/Admin.php | Admin.bootstrap | public function bootstrap()
{
$this->fireBootingCallbacks();
Form::registerBuiltinFields();
Grid::registerColumnDisplayer();
Grid\Filter::registerFilters();
require config('admin.bootstrap', admin_path('bootstrap.php'));
$assets = Form::collectFieldAssets();
... | php | public function bootstrap()
{
$this->fireBootingCallbacks();
Form::registerBuiltinFields();
Grid::registerColumnDisplayer();
Grid\Filter::registerFilters();
require config('admin.bootstrap', admin_path('bootstrap.php'));
$assets = Form::collectFieldAssets();
... | [
"public",
"function",
"bootstrap",
"(",
")",
"{",
"$",
"this",
"->",
"fireBootingCallbacks",
"(",
")",
";",
"Form",
"::",
"registerBuiltinFields",
"(",
")",
";",
"Grid",
"::",
"registerColumnDisplayer",
"(",
")",
";",
"Grid",
"\\",
"Filter",
"::",
"registerF... | Bootstrap the admin application. | [
"Bootstrap",
"the",
"admin",
"application",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Admin.php#L321-L339 |
207,345 | z-song/laravel-admin | src/Grid/Concerns/HasHeader.php | HasHeader.header | public function header(Closure $closure = null)
{
if (!$closure) {
return $this->header;
}
$this->header = $closure;
return $this;
} | php | public function header(Closure $closure = null)
{
if (!$closure) {
return $this->header;
}
$this->header = $closure;
return $this;
} | [
"public",
"function",
"header",
"(",
"Closure",
"$",
"closure",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"closure",
")",
"{",
"return",
"$",
"this",
"->",
"header",
";",
"}",
"$",
"this",
"->",
"header",
"=",
"$",
"closure",
";",
"return",
"$",
... | Set grid header.
@param Closure|null $closure
@return $this|Closure | [
"Set",
"grid",
"header",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Concerns/HasHeader.php#L22-L31 |
207,346 | z-song/laravel-admin | src/Controllers/AuthController.php | AuthController.getLogin | public function getLogin()
{
if ($this->guard()->check()) {
return redirect($this->redirectPath());
}
return view($this->loginView);
} | php | public function getLogin()
{
if ($this->guard()->check()) {
return redirect($this->redirectPath());
}
return view($this->loginView);
} | [
"public",
"function",
"getLogin",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"guard",
"(",
")",
"->",
"check",
"(",
")",
")",
"{",
"return",
"redirect",
"(",
"$",
"this",
"->",
"redirectPath",
"(",
")",
")",
";",
"}",
"return",
"view",
"(",
"$"... | Show the login page.
@return \Illuminate\Contracts\View\Factory|Redirect|\Illuminate\View\View | [
"Show",
"the",
"login",
"page",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Controllers/AuthController.php#L27-L34 |
207,347 | z-song/laravel-admin | src/Controllers/AuthController.php | AuthController.getLogout | public function getLogout(Request $request)
{
$this->guard()->logout();
$request->session()->invalidate();
return redirect(config('admin.route.prefix'));
} | php | public function getLogout(Request $request)
{
$this->guard()->logout();
$request->session()->invalidate();
return redirect(config('admin.route.prefix'));
} | [
"public",
"function",
"getLogout",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"guard",
"(",
")",
"->",
"logout",
"(",
")",
";",
"$",
"request",
"->",
"session",
"(",
")",
"->",
"invalidate",
"(",
")",
";",
"return",
"redirect",
"(",... | User logout.
@return Redirect | [
"User",
"logout",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Controllers/AuthController.php#L79-L86 |
207,348 | z-song/laravel-admin | src/Controllers/AuthController.php | AuthController.getSetting | public function getSetting(Content $content)
{
$form = $this->settingForm();
$form->tools(
function (Form\Tools $tools) {
$tools->disableList();
}
);
return $content
->header(trans('admin.user_setting'))
->body($form->e... | php | public function getSetting(Content $content)
{
$form = $this->settingForm();
$form->tools(
function (Form\Tools $tools) {
$tools->disableList();
}
);
return $content
->header(trans('admin.user_setting'))
->body($form->e... | [
"public",
"function",
"getSetting",
"(",
"Content",
"$",
"content",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"settingForm",
"(",
")",
";",
"$",
"form",
"->",
"tools",
"(",
"function",
"(",
"Form",
"\\",
"Tools",
"$",
"tools",
")",
"{",
"$",
"... | User setting page.
@param Content $content
@return Content | [
"User",
"setting",
"page",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Controllers/AuthController.php#L95-L107 |
207,349 | z-song/laravel-admin | src/Controllers/AuthController.php | AuthController.redirectPath | protected function redirectPath()
{
if (method_exists($this, 'redirectTo')) {
return $this->redirectTo();
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : config('admin.route.prefix');
} | php | protected function redirectPath()
{
if (method_exists($this, 'redirectTo')) {
return $this->redirectTo();
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : config('admin.route.prefix');
} | [
"protected",
"function",
"redirectPath",
"(",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'redirectTo'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"redirectTo",
"(",
")",
";",
"}",
"return",
"property_exists",
"(",
"$",
"this",
",",
... | Get the post login redirect path.
@return string | [
"Get",
"the",
"post",
"login",
"redirect",
"path",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Controllers/AuthController.php#L173-L180 |
207,350 | z-song/laravel-admin | src/Layout/Column.php | Column.row | public function row($content)
{
if (!$content instanceof \Closure) {
$row = new Row($content);
} else {
$row = new Row();
call_user_func($content, $row);
}
ob_start();
$row->build();
$contents = ob_get_contents();
ob_en... | php | public function row($content)
{
if (!$content instanceof \Closure) {
$row = new Row($content);
} else {
$row = new Row();
call_user_func($content, $row);
}
ob_start();
$row->build();
$contents = ob_get_contents();
ob_en... | [
"public",
"function",
"row",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"$",
"content",
"instanceof",
"\\",
"Closure",
")",
"{",
"$",
"row",
"=",
"new",
"Row",
"(",
"$",
"content",
")",
";",
"}",
"else",
"{",
"$",
"row",
"=",
"new",
"Row",
... | Add a row for column.
@param $content
@return Column | [
"Add",
"a",
"row",
"for",
"column",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Layout/Column.php#L70-L89 |
207,351 | z-song/laravel-admin | src/Layout/Column.php | Column.build | public function build()
{
$this->startColumn();
foreach ($this->contents as $content) {
if ($content instanceof Renderable || $content instanceof Grid) {
echo $content->render();
} else {
echo (string) $content;
}
}
... | php | public function build()
{
$this->startColumn();
foreach ($this->contents as $content) {
if ($content instanceof Renderable || $content instanceof Grid) {
echo $content->render();
} else {
echo (string) $content;
}
}
... | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"this",
"->",
"startColumn",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"contents",
"as",
"$",
"content",
")",
"{",
"if",
"(",
"$",
"content",
"instanceof",
"Renderable",
"||",
"$",
"content",
... | Build column html. | [
"Build",
"column",
"html",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Layout/Column.php#L94-L107 |
207,352 | z-song/laravel-admin | src/Auth/Permission.php | Permission.deny | public static function deny($roles)
{
if (static::isAdministrator()) {
return true;
}
if (Auth::guard('admin')->user()->inRoles($roles)) {
static::error();
}
} | php | public static function deny($roles)
{
if (static::isAdministrator()) {
return true;
}
if (Auth::guard('admin')->user()->inRoles($roles)) {
static::error();
}
} | [
"public",
"static",
"function",
"deny",
"(",
"$",
"roles",
")",
"{",
"if",
"(",
"static",
"::",
"isAdministrator",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"Auth",
"::",
"guard",
"(",
"'admin'",
")",
"->",
"user",
"(",
")",
"->",
... | Roles denied to access.
@param $roles
@return true | [
"Roles",
"denied",
"to",
"access",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Auth/Permission.php#L72-L81 |
207,353 | z-song/laravel-admin | src/Grid/Filter/AbstractFilter.php | AbstractFilter.formatName | protected function formatName($column)
{
$columns = explode('.', $column);
if (count($columns) == 1) {
$name = $columns[0];
} else {
$name = array_shift($columns);
foreach ($columns as $column) {
$name .= "[$column]";
}
... | php | protected function formatName($column)
{
$columns = explode('.', $column);
if (count($columns) == 1) {
$name = $columns[0];
} else {
$name = array_shift($columns);
foreach ($columns as $column) {
$name .= "[$column]";
}
... | [
"protected",
"function",
"formatName",
"(",
"$",
"column",
")",
"{",
"$",
"columns",
"=",
"explode",
"(",
"'.'",
",",
"$",
"column",
")",
";",
"if",
"(",
"count",
"(",
"$",
"columns",
")",
"==",
"1",
")",
"{",
"$",
"name",
"=",
"$",
"columns",
"[... | Format name.
@param string $column
@return string | [
"Format",
"name",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/AbstractFilter.php#L137-L153 |
207,354 | z-song/laravel-admin | src/Grid/Filter/AbstractFilter.php | AbstractFilter.buildCondition | protected function buildCondition()
{
$column = explode('.', $this->column);
if (count($column) == 1) {
return [$this->query => func_get_args()];
}
return $this->buildRelationQuery(...func_get_args());
} | php | protected function buildCondition()
{
$column = explode('.', $this->column);
if (count($column) == 1) {
return [$this->query => func_get_args()];
}
return $this->buildRelationQuery(...func_get_args());
} | [
"protected",
"function",
"buildCondition",
"(",
")",
"{",
"$",
"column",
"=",
"explode",
"(",
"'.'",
",",
"$",
"this",
"->",
"column",
")",
";",
"if",
"(",
"count",
"(",
"$",
"column",
")",
"==",
"1",
")",
"{",
"return",
"[",
"$",
"this",
"->",
"... | Build conditions of filter.
@return mixed | [
"Build",
"conditions",
"of",
"filter",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/AbstractFilter.php#L434-L443 |
207,355 | z-song/laravel-admin | src/Grid/Filter/AbstractFilter.php | AbstractFilter.buildRelationQuery | protected function buildRelationQuery()
{
$args = func_get_args();
list($relation, $args[0]) = explode('.', $this->column);
return ['whereHas' => [$relation, function ($relation) use ($args) {
call_user_func_array([$relation, $this->query], $args);
}]];
} | php | protected function buildRelationQuery()
{
$args = func_get_args();
list($relation, $args[0]) = explode('.', $this->column);
return ['whereHas' => [$relation, function ($relation) use ($args) {
call_user_func_array([$relation, $this->query], $args);
}]];
} | [
"protected",
"function",
"buildRelationQuery",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"list",
"(",
"$",
"relation",
",",
"$",
"args",
"[",
"0",
"]",
")",
"=",
"explode",
"(",
"'.'",
",",
"$",
"this",
"->",
"column",
")",
"... | Build query condition of model relation.
@return array | [
"Build",
"query",
"condition",
"of",
"model",
"relation",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/AbstractFilter.php#L450-L459 |
207,356 | z-song/laravel-admin | src/Grid/Filter/AbstractFilter.php | AbstractFilter.variables | protected function variables()
{
return array_merge([
'id' => $this->id,
'name' => $this->formatName($this->column),
'label' => $this->label,
'value' => $this->value ?: $this->defaultValue,
'presenter' => $this->presenter(),
... | php | protected function variables()
{
return array_merge([
'id' => $this->id,
'name' => $this->formatName($this->column),
'label' => $this->label,
'value' => $this->value ?: $this->defaultValue,
'presenter' => $this->presenter(),
... | [
"protected",
"function",
"variables",
"(",
")",
"{",
"return",
"array_merge",
"(",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'name'",
"=>",
"$",
"this",
"->",
"formatName",
"(",
"$",
"this",
"->",
"column",
")",
",",
"'label'",
"=>",
"$",
"th... | Variables for filter view.
@return array | [
"Variables",
"for",
"filter",
"view",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/AbstractFilter.php#L466-L475 |
207,357 | z-song/laravel-admin | src/Grid/Tools/Paginator.php | Paginator.initPaginator | protected function initPaginator()
{
$this->paginator = $this->grid->model()->eloquent();
if ($this->paginator instanceof LengthAwarePaginator) {
$this->paginator->appends(Input::all());
}
} | php | protected function initPaginator()
{
$this->paginator = $this->grid->model()->eloquent();
if ($this->paginator instanceof LengthAwarePaginator) {
$this->paginator->appends(Input::all());
}
} | [
"protected",
"function",
"initPaginator",
"(",
")",
"{",
"$",
"this",
"->",
"paginator",
"=",
"$",
"this",
"->",
"grid",
"->",
"model",
"(",
")",
"->",
"eloquent",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"paginator",
"instanceof",
"LengthAwarePagina... | Initialize work for Paginator.
@return void | [
"Initialize",
"work",
"for",
"Paginator",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/Paginator.php#L33-L40 |
207,358 | z-song/laravel-admin | src/Grid/Tools/Paginator.php | Paginator.paginationRanger | protected function paginationRanger()
{
$parameters = [
'first' => $this->paginator->firstItem(),
'last' => $this->paginator->lastItem(),
'total' => $this->paginator->total(),
];
$parameters = collect($parameters)->flatMap(function ($parameter, $key) {
... | php | protected function paginationRanger()
{
$parameters = [
'first' => $this->paginator->firstItem(),
'last' => $this->paginator->lastItem(),
'total' => $this->paginator->total(),
];
$parameters = collect($parameters)->flatMap(function ($parameter, $key) {
... | [
"protected",
"function",
"paginationRanger",
"(",
")",
"{",
"$",
"parameters",
"=",
"[",
"'first'",
"=>",
"$",
"this",
"->",
"paginator",
"->",
"firstItem",
"(",
")",
",",
"'last'",
"=>",
"$",
"this",
"->",
"paginator",
"->",
"lastItem",
"(",
")",
",",
... | Get range infomation of paginator.
@return string|\Symfony\Component\Translation\TranslatorInterface | [
"Get",
"range",
"infomation",
"of",
"paginator",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/Paginator.php#L67-L80 |
207,359 | z-song/laravel-admin | src/Grid/Tools/TotalRow.php | TotalRow.total | protected function total($column, $display)
{
if (!is_callable($display) && !is_null($display)) {
return $display;
}
$sum = $this->query->sum($column);
if (is_callable($display)) {
return call_user_func($display, $sum);
}
return $sum;
} | php | protected function total($column, $display)
{
if (!is_callable($display) && !is_null($display)) {
return $display;
}
$sum = $this->query->sum($column);
if (is_callable($display)) {
return call_user_func($display, $sum);
}
return $sum;
} | [
"protected",
"function",
"total",
"(",
"$",
"column",
",",
"$",
"display",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"display",
")",
"&&",
"!",
"is_null",
"(",
"$",
"display",
")",
")",
"{",
"return",
"$",
"display",
";",
"}",
"$",
"sum",
... | Get total value of current column.
@param string $column
@param mixed $display
@return mixed | [
"Get",
"total",
"value",
"of",
"current",
"column",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/TotalRow.php#L42-L55 |
207,360 | z-song/laravel-admin | src/Grid/Tools/TotalRow.php | TotalRow.render | public function render()
{
$columns = $this->getGrid()->columns()->flatMap(function (Column $column) {
$name = $column->getName();
$total = ($display = Arr::get($this->columns, $name)) ? $this->total($name, $display) : '';
return [$name => $total];
})->toArray()... | php | public function render()
{
$columns = $this->getGrid()->columns()->flatMap(function (Column $column) {
$name = $column->getName();
$total = ($display = Arr::get($this->columns, $name)) ? $this->total($name, $display) : '';
return [$name => $total];
})->toArray()... | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"getGrid",
"(",
")",
"->",
"columns",
"(",
")",
"->",
"flatMap",
"(",
"function",
"(",
"Column",
"$",
"column",
")",
"{",
"$",
"name",
"=",
"$",
"column",
"->",
... | Render total-row.
@return \Illuminate\Contracts\View\Factory|\Illuminate\View\View | [
"Render",
"total",
"-",
"row",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Tools/TotalRow.php#L62-L73 |
207,361 | z-song/laravel-admin | src/Form/Field/UploadField.php | UploadField.move | public function move($directory, $name = null)
{
$this->dir($directory);
$this->name($name);
return $this;
} | php | public function move($directory, $name = null)
{
$this->dir($directory);
$this->name($name);
return $this;
} | [
"public",
"function",
"move",
"(",
"$",
"directory",
",",
"$",
"name",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"dir",
"(",
"$",
"directory",
")",
";",
"$",
"this",
"->",
"name",
"(",
"$",
"name",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Specify the directory and name for upload file.
@param string $directory
@param null|string $name
@return $this | [
"Specify",
"the",
"directory",
"and",
"name",
"for",
"upload",
"file",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L181-L188 |
207,362 | z-song/laravel-admin | src/Form/Field/UploadField.php | UploadField.getStoreName | protected function getStoreName(UploadedFile $file)
{
if ($this->useUniqueName) {
return $this->generateUniqueName($file);
}
if ($this->useSequenceName) {
return $this->generateSequenceName($file);
}
if ($this->name instanceof \Closure) {
... | php | protected function getStoreName(UploadedFile $file)
{
if ($this->useUniqueName) {
return $this->generateUniqueName($file);
}
if ($this->useSequenceName) {
return $this->generateSequenceName($file);
}
if ($this->name instanceof \Closure) {
... | [
"protected",
"function",
"getStoreName",
"(",
"UploadedFile",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useUniqueName",
")",
"{",
"return",
"$",
"this",
"->",
"generateUniqueName",
"(",
"$",
"file",
")",
";",
"}",
"if",
"(",
"$",
"this",
"-... | Get store name of upload file.
@param UploadedFile $file
@return string | [
"Get",
"store",
"name",
"of",
"upload",
"file",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L253-L272 |
207,363 | z-song/laravel-admin | src/Form/Field/UploadField.php | UploadField.getDirectory | public function getDirectory()
{
if ($this->directory instanceof \Closure) {
return call_user_func($this->directory, $this->form);
}
return $this->directory ?: $this->defaultDirectory();
} | php | public function getDirectory()
{
if ($this->directory instanceof \Closure) {
return call_user_func($this->directory, $this->form);
}
return $this->directory ?: $this->defaultDirectory();
} | [
"public",
"function",
"getDirectory",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"directory",
"instanceof",
"\\",
"Closure",
")",
"{",
"return",
"call_user_func",
"(",
"$",
"this",
"->",
"directory",
",",
"$",
"this",
"->",
"form",
")",
";",
"}",
"re... | Get directory for store file.
@return mixed|string | [
"Get",
"directory",
"for",
"store",
"file",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L279-L286 |
207,364 | z-song/laravel-admin | src/Form/Field/UploadField.php | UploadField.renameIfExists | public function renameIfExists(UploadedFile $file)
{
if ($this->storage->exists("{$this->getDirectory()}/$this->name")) {
$this->name = $this->generateUniqueName($file);
}
} | php | public function renameIfExists(UploadedFile $file)
{
if ($this->storage->exists("{$this->getDirectory()}/$this->name")) {
$this->name = $this->generateUniqueName($file);
}
} | [
"public",
"function",
"renameIfExists",
"(",
"UploadedFile",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"storage",
"->",
"exists",
"(",
"\"{$this->getDirectory()}/$this->name\"",
")",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"this",
"->",
"... | If name already exists, rename it.
@param $file
@return void | [
"If",
"name",
"already",
"exists",
"rename",
"it",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L313-L318 |
207,365 | z-song/laravel-admin | src/Form/Field/UploadField.php | UploadField.generateSequenceName | protected function generateSequenceName(UploadedFile $file)
{
$index = 1;
$extension = $file->getClientOriginalExtension();
$originalName = $file->getClientOriginalName();
$newName = $originalName.'_'.$index.'.'.$extension;
while ($this->storage->exists("{$this->getDirectory... | php | protected function generateSequenceName(UploadedFile $file)
{
$index = 1;
$extension = $file->getClientOriginalExtension();
$originalName = $file->getClientOriginalName();
$newName = $originalName.'_'.$index.'.'.$extension;
while ($this->storage->exists("{$this->getDirectory... | [
"protected",
"function",
"generateSequenceName",
"(",
"UploadedFile",
"$",
"file",
")",
"{",
"$",
"index",
"=",
"1",
";",
"$",
"extension",
"=",
"$",
"file",
"->",
"getClientOriginalExtension",
"(",
")",
";",
"$",
"originalName",
"=",
"$",
"file",
"->",
"g... | Generate a sequence name for uploaded file.
@param UploadedFile $file
@return string | [
"Generate",
"a",
"sequence",
"name",
"for",
"uploaded",
"file",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/UploadField.php#L359-L372 |
207,366 | z-song/laravel-admin | src/Traits/ModelTree.php | ModelTree.allNodes | public function allNodes()
{
$orderColumn = DB::getQueryGrammar()->wrap($this->orderColumn);
$byOrder = $orderColumn.' = 0,'.$orderColumn;
$self = new static();
if ($this->queryCallback instanceof \Closure) {
$self = call_user_func($this->queryCallback, $self);
... | php | public function allNodes()
{
$orderColumn = DB::getQueryGrammar()->wrap($this->orderColumn);
$byOrder = $orderColumn.' = 0,'.$orderColumn;
$self = new static();
if ($this->queryCallback instanceof \Closure) {
$self = call_user_func($this->queryCallback, $self);
... | [
"public",
"function",
"allNodes",
"(",
")",
"{",
"$",
"orderColumn",
"=",
"DB",
"::",
"getQueryGrammar",
"(",
")",
"->",
"wrap",
"(",
"$",
"this",
"->",
"orderColumn",
")",
";",
"$",
"byOrder",
"=",
"$",
"orderColumn",
".",
"' = 0,'",
".",
"$",
"orderC... | Get all elements.
@return mixed | [
"Get",
"all",
"elements",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Traits/ModelTree.php#L175-L187 |
207,367 | z-song/laravel-admin | src/Traits/ModelTree.php | ModelTree.saveOrder | public static function saveOrder($tree = [], $parentId = 0)
{
if (empty(static::$branchOrder)) {
static::setBranchOrder($tree);
}
foreach ($tree as $branch) {
$node = static::find($branch['id']);
$node->{$node->getParentColumn()} = $parentId;
... | php | public static function saveOrder($tree = [], $parentId = 0)
{
if (empty(static::$branchOrder)) {
static::setBranchOrder($tree);
}
foreach ($tree as $branch) {
$node = static::find($branch['id']);
$node->{$node->getParentColumn()} = $parentId;
... | [
"public",
"static",
"function",
"saveOrder",
"(",
"$",
"tree",
"=",
"[",
"]",
",",
"$",
"parentId",
"=",
"0",
")",
"{",
"if",
"(",
"empty",
"(",
"static",
"::",
"$",
"branchOrder",
")",
")",
"{",
"static",
"::",
"setBranchOrder",
"(",
"$",
"tree",
... | Save tree order from a tree like array.
@param array $tree
@param int $parentId | [
"Save",
"tree",
"order",
"from",
"a",
"tree",
"like",
"array",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Traits/ModelTree.php#L211-L228 |
207,368 | z-song/laravel-admin | src/Traits/ModelTree.php | ModelTree.selectOptions | public static function selectOptions(\Closure $closure = null, $rootText = 'Root')
{
$options = (new static())->withQuery($closure)->buildSelectOptions();
return collect($options)->prepend($rootText, 0)->all();
} | php | public static function selectOptions(\Closure $closure = null, $rootText = 'Root')
{
$options = (new static())->withQuery($closure)->buildSelectOptions();
return collect($options)->prepend($rootText, 0)->all();
} | [
"public",
"static",
"function",
"selectOptions",
"(",
"\\",
"Closure",
"$",
"closure",
"=",
"null",
",",
"$",
"rootText",
"=",
"'Root'",
")",
"{",
"$",
"options",
"=",
"(",
"new",
"static",
"(",
")",
")",
"->",
"withQuery",
"(",
"$",
"closure",
")",
... | Get options for Select field in form.
@param \Closure|null $closure
@param string $rootText
@return array | [
"Get",
"options",
"for",
"Select",
"field",
"in",
"form",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Traits/ModelTree.php#L238-L243 |
207,369 | z-song/laravel-admin | src/Traits/ModelTree.php | ModelTree.buildSelectOptions | protected function buildSelectOptions(array $nodes = [], $parentId = 0, $prefix = '')
{
$prefix = $prefix ?: str_repeat(' ', 6);
$options = [];
if (empty($nodes)) {
$nodes = $this->allNodes();
}
foreach ($nodes as $node) {
$node[$this->titleCol... | php | protected function buildSelectOptions(array $nodes = [], $parentId = 0, $prefix = '')
{
$prefix = $prefix ?: str_repeat(' ', 6);
$options = [];
if (empty($nodes)) {
$nodes = $this->allNodes();
}
foreach ($nodes as $node) {
$node[$this->titleCol... | [
"protected",
"function",
"buildSelectOptions",
"(",
"array",
"$",
"nodes",
"=",
"[",
"]",
",",
"$",
"parentId",
"=",
"0",
",",
"$",
"prefix",
"=",
"''",
")",
"{",
"$",
"prefix",
"=",
"$",
"prefix",
"?",
":",
"str_repeat",
"(",
"' '",
",",
"6",
... | Build options of select field in form.
@param array $nodes
@param int $parentId
@param string $prefix
@return array | [
"Build",
"options",
"of",
"select",
"field",
"in",
"form",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Traits/ModelTree.php#L254-L278 |
207,370 | z-song/laravel-admin | src/Form/Field/ImageField.php | ImageField.callInterventionMethods | public function callInterventionMethods($target)
{
if (!empty($this->interventionCalls)) {
$image = ImageManagerStatic::make($target);
foreach ($this->interventionCalls as $call) {
call_user_func_array(
[$image, $call['method']],
... | php | public function callInterventionMethods($target)
{
if (!empty($this->interventionCalls)) {
$image = ImageManagerStatic::make($target);
foreach ($this->interventionCalls as $call) {
call_user_func_array(
[$image, $call['method']],
... | [
"public",
"function",
"callInterventionMethods",
"(",
"$",
"target",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"interventionCalls",
")",
")",
"{",
"$",
"image",
"=",
"ImageManagerStatic",
"::",
"make",
"(",
"$",
"target",
")",
";",
"fore... | Execute Intervention calls.
@param string $target
@return mixed | [
"Execute",
"Intervention",
"calls",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/ImageField.php#L33-L47 |
207,371 | z-song/laravel-admin | src/Show/Tools.php | Tools.getEditPath | protected function getEditPath()
{
$key = $this->panel->getParent()->getModel()->getKey();
return $this->getListPath().'/'.$key.'/edit';
} | php | protected function getEditPath()
{
$key = $this->panel->getParent()->getModel()->getKey();
return $this->getListPath().'/'.$key.'/edit';
} | [
"protected",
"function",
"getEditPath",
"(",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"panel",
"->",
"getParent",
"(",
")",
"->",
"getModel",
"(",
")",
"->",
"getKey",
"(",
")",
";",
"return",
"$",
"this",
"->",
"getListPath",
"(",
")",
".",
"... | Get request path for edit.
@return string | [
"Get",
"request",
"path",
"for",
"edit",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Tools.php#L163-L168 |
207,372 | z-song/laravel-admin | src/Show/Tools.php | Tools.renderDelete | protected function renderDelete()
{
$trans = [
'delete_confirm' => trans('admin.delete_confirm'),
'confirm' => trans('admin.confirm'),
'cancel' => trans('admin.cancel'),
'delete' => trans('admin.delete'),
];
$class = uni... | php | protected function renderDelete()
{
$trans = [
'delete_confirm' => trans('admin.delete_confirm'),
'confirm' => trans('admin.confirm'),
'cancel' => trans('admin.cancel'),
'delete' => trans('admin.delete'),
];
$class = uni... | [
"protected",
"function",
"renderDelete",
"(",
")",
"{",
"$",
"trans",
"=",
"[",
"'delete_confirm'",
"=>",
"trans",
"(",
"'admin.delete_confirm'",
")",
",",
"'confirm'",
"=>",
"trans",
"(",
"'admin.confirm'",
")",
",",
"'cancel'",
"=>",
"trans",
"(",
"'admin.ca... | Render `delete` tool.
@return string | [
"Render",
"delete",
"tool",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Tools.php#L223-L285 |
207,373 | z-song/laravel-admin | src/Show/Tools.php | Tools.render | public function render()
{
$output = $this->renderCustomTools($this->prepends);
foreach ($this->tools as $tool) {
$renderMethod = 'render'.ucfirst($tool);
$output .= $this->$renderMethod();
}
return $output.$this->renderCustomTools($this->appends);
} | php | public function render()
{
$output = $this->renderCustomTools($this->prepends);
foreach ($this->tools as $tool) {
$renderMethod = 'render'.ucfirst($tool);
$output .= $this->$renderMethod();
}
return $output.$this->renderCustomTools($this->appends);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"renderCustomTools",
"(",
"$",
"this",
"->",
"prepends",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"tools",
"as",
"$",
"tool",
")",
"{",
"$",
"renderMethod",
"="... | Render tools.
@return string | [
"Render",
"tools",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show/Tools.php#L314-L324 |
207,374 | z-song/laravel-admin | src/Form/Field/HasMany.php | HasMany.formatValidationAttribute | protected function formatValidationAttribute($input, $label, $column)
{
$new = $attributes = [];
if (is_array($column)) {
foreach ($column as $index => $col) {
$new[$col.$index] = $col;
}
}
foreach (array_keys(Arr::dot($input)) as $key) {
... | php | protected function formatValidationAttribute($input, $label, $column)
{
$new = $attributes = [];
if (is_array($column)) {
foreach ($column as $index => $col) {
$new[$col.$index] = $col;
}
}
foreach (array_keys(Arr::dot($input)) as $key) {
... | [
"protected",
"function",
"formatValidationAttribute",
"(",
"$",
"input",
",",
"$",
"label",
",",
"$",
"column",
")",
"{",
"$",
"new",
"=",
"$",
"attributes",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"column",
")",
")",
"{",
"foreach",
"("... | Format validation attributes.
@param array $input
@param string $label
@param string $column
@return array | [
"Format",
"validation",
"attributes",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/HasMany.php#L173-L198 |
207,375 | z-song/laravel-admin | src/Form/Field/HasMany.php | HasMany.getKeyName | protected function getKeyName()
{
if (is_null($this->form)) {
return;
}
return $this->form->model()->{$this->relationName}()->getRelated()->getKeyName();
} | php | protected function getKeyName()
{
if (is_null($this->form)) {
return;
}
return $this->form->model()->{$this->relationName}()->getRelated()->getKeyName();
} | [
"protected",
"function",
"getKeyName",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"form",
")",
")",
"{",
"return",
";",
"}",
"return",
"$",
"this",
"->",
"form",
"->",
"model",
"(",
")",
"->",
"{",
"$",
"this",
"->",
"relationName... | Get the HasMany relation key name.
@return string | [
"Get",
"the",
"HasMany",
"relation",
"key",
"name",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/HasMany.php#L307-L314 |
207,376 | z-song/laravel-admin | src/Form/Field/HasMany.php | HasMany.buildRelatedForms | protected function buildRelatedForms()
{
if (is_null($this->form)) {
return [];
}
$model = $this->form->model();
$relation = call_user_func([$model, $this->relationName]);
if (!$relation instanceof Relation && !$relation instanceof MorphMany) {
thro... | php | protected function buildRelatedForms()
{
if (is_null($this->form)) {
return [];
}
$model = $this->form->model();
$relation = call_user_func([$model, $this->relationName]);
if (!$relation instanceof Relation && !$relation instanceof MorphMany) {
thro... | [
"protected",
"function",
"buildRelatedForms",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"form",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"model",
"=",
"$",
"this",
"->",
"form",
"->",
"model",
"(",
")",
";",
"$",
"rela... | Build Nested form for related data.
@throws \Exception
@return array | [
"Build",
"Nested",
"form",
"for",
"related",
"data",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/HasMany.php#L359-L405 |
207,377 | z-song/laravel-admin | src/Form/Field/HasMany.php | HasMany.setupScript | protected function setupScript($script)
{
$method = 'setupScriptFor'.ucfirst($this->viewMode).'View';
call_user_func([$this, $method], $script);
} | php | protected function setupScript($script)
{
$method = 'setupScriptFor'.ucfirst($this->viewMode).'View';
call_user_func([$this, $method], $script);
} | [
"protected",
"function",
"setupScript",
"(",
"$",
"script",
")",
"{",
"$",
"method",
"=",
"'setupScriptFor'",
".",
"ucfirst",
"(",
"$",
"this",
"->",
"viewMode",
")",
".",
"'View'",
";",
"call_user_func",
"(",
"[",
"$",
"this",
",",
"$",
"method",
"]",
... | Setup script for this field in different view mode.
@param string $script
@return void | [
"Setup",
"script",
"for",
"this",
"field",
"in",
"different",
"view",
"mode",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/HasMany.php#L414-L419 |
207,378 | z-song/laravel-admin | src/Form/Field/HasMany.php | HasMany.renderTable | protected function renderTable()
{
$headers = [];
$fields = [];
$hidden = [];
$scripts = [];
/* @var Field $field */
foreach ($this->buildNestedForm($this->column, $this->builder)->fields() as $field) {
if (is_a($field, Hidden::class)) {
$... | php | protected function renderTable()
{
$headers = [];
$fields = [];
$hidden = [];
$scripts = [];
/* @var Field $field */
foreach ($this->buildNestedForm($this->column, $this->builder)->fields() as $field) {
if (is_a($field, Hidden::class)) {
$... | [
"protected",
"function",
"renderTable",
"(",
")",
"{",
"$",
"headers",
"=",
"[",
"]",
";",
"$",
"fields",
"=",
"[",
"]",
";",
"$",
"hidden",
"=",
"[",
"]",
";",
"$",
"scripts",
"=",
"[",
"]",
";",
"/* @var Field $field */",
"foreach",
"(",
"$",
"th... | Render the `HasMany` field for table style.
@throws \Exception
@return mixed | [
"Render",
"the",
"HasMany",
"field",
"for",
"table",
"style",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/Field/HasMany.php#L620-L669 |
207,379 | z-song/laravel-admin | src/Form/HasHooks.php | HasHooks.callHooks | protected function callHooks($name)
{
$hooks = Arr::get($this->hooks, $name, []);
foreach ($hooks as $func) {
if (!$func instanceof Closure) {
continue;
}
$response = call_user_func($func, $this);
if ($response instanceof Response) {... | php | protected function callHooks($name)
{
$hooks = Arr::get($this->hooks, $name, []);
foreach ($hooks as $func) {
if (!$func instanceof Closure) {
continue;
}
$response = call_user_func($func, $this);
if ($response instanceof Response) {... | [
"protected",
"function",
"callHooks",
"(",
"$",
"name",
")",
"{",
"$",
"hooks",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"hooks",
",",
"$",
"name",
",",
"[",
"]",
")",
";",
"foreach",
"(",
"$",
"hooks",
"as",
"$",
"func",
")",
"{",
"if"... | Call hooks by giving name.
@param string $name
@return Response | [
"Call",
"hooks",
"by",
"giving",
"name",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Form/HasHooks.php#L40-L55 |
207,380 | z-song/laravel-admin | src/Grid.php | Grid.handleExportRequest | protected function handleExportRequest($forceExport = false)
{
if (!$scope = request(Exporter::$queryName)) {
return;
}
// clear output buffer.
if (ob_get_length()) {
ob_end_clean();
}
$this->model()->usePaginate(false);
if ($this->b... | php | protected function handleExportRequest($forceExport = false)
{
if (!$scope = request(Exporter::$queryName)) {
return;
}
// clear output buffer.
if (ob_get_length()) {
ob_end_clean();
}
$this->model()->usePaginate(false);
if ($this->b... | [
"protected",
"function",
"handleExportRequest",
"(",
"$",
"forceExport",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"scope",
"=",
"request",
"(",
"Exporter",
"::",
"$",
"queryName",
")",
")",
"{",
"return",
";",
"}",
"// clear output buffer.",
"if",
"(",... | Handle export request.
@param bool $forceExport | [
"Handle",
"export",
"request",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L225-L247 |
207,381 | z-song/laravel-admin | src/Grid.php | Grid.option | public function option($key, $value = null)
{
if (is_null($value)) {
return $this->options[$key];
}
$this->options[$key] = $value;
return $this;
} | php | public function option($key, $value = null)
{
if (is_null($value)) {
return $this->options[$key];
}
$this->options[$key] = $value;
return $this;
} | [
"public",
"function",
"option",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"this",
"->",
"options",
"[",
"$",
"key",
"]",
";",
"}",
"$",
"this",
"->",
"optio... | Get or set option for grid.
@param string $key
@param mixed $value
@return $this|mixed | [
"Get",
"or",
"set",
"option",
"for",
"grid",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L267-L276 |
207,382 | z-song/laravel-admin | src/Grid.php | Grid.columns | public function columns($columns = [])
{
if (func_num_args() == 0) {
return $this->columns;
}
if (func_num_args() == 1 && is_array($columns)) {
foreach ($columns as $column => $label) {
$this->column($column, $label);
}
return... | php | public function columns($columns = [])
{
if (func_num_args() == 0) {
return $this->columns;
}
if (func_num_args() == 1 && is_array($columns)) {
foreach ($columns as $column => $label) {
$this->column($column, $label);
}
return... | [
"public",
"function",
"columns",
"(",
"$",
"columns",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
"==",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"columns",
";",
"}",
"if",
"(",
"func_num_args",
"(",
")",
"==",
"1",
"&&",
"is... | Batch add column to grid.
@example
1.$grid->columns(['name' => 'Name', 'email' => 'Email' ...]);
2.$grid->columns('name', 'email' ...)
@param array $columns
@return Collection|null | [
"Batch",
"add",
"column",
"to",
"grid",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L331-L348 |
207,383 | z-song/laravel-admin | src/Grid.php | Grid.visibleColumns | public function visibleColumns()
{
$visible = array_filter(explode(',', request(Tools\ColumnSelector::SELECT_COLUMN_NAME)));
if (empty($visible)) {
return $this->columns;
}
array_push($visible, '__row_selector__', '__actions__');
return $this->columns->filter(f... | php | public function visibleColumns()
{
$visible = array_filter(explode(',', request(Tools\ColumnSelector::SELECT_COLUMN_NAME)));
if (empty($visible)) {
return $this->columns;
}
array_push($visible, '__row_selector__', '__actions__');
return $this->columns->filter(f... | [
"public",
"function",
"visibleColumns",
"(",
")",
"{",
"$",
"visible",
"=",
"array_filter",
"(",
"explode",
"(",
"','",
",",
"request",
"(",
"Tools",
"\\",
"ColumnSelector",
"::",
"SELECT_COLUMN_NAME",
")",
")",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"v... | Get all visible column instances.
@return Collection|static | [
"Get",
"all",
"visible",
"column",
"instances",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L355-L368 |
207,384 | z-song/laravel-admin | src/Grid.php | Grid.visibleColumnNames | public function visibleColumnNames()
{
$visible = array_filter(explode(',', request(Tools\ColumnSelector::SELECT_COLUMN_NAME)));
if (empty($visible)) {
return $this->columnNames;
}
array_push($visible, '__row_selector__', '__actions__');
return collect($this->c... | php | public function visibleColumnNames()
{
$visible = array_filter(explode(',', request(Tools\ColumnSelector::SELECT_COLUMN_NAME)));
if (empty($visible)) {
return $this->columnNames;
}
array_push($visible, '__row_selector__', '__actions__');
return collect($this->c... | [
"public",
"function",
"visibleColumnNames",
"(",
")",
"{",
"$",
"visible",
"=",
"array_filter",
"(",
"explode",
"(",
"','",
",",
"request",
"(",
"Tools",
"\\",
"ColumnSelector",
"::",
"SELECT_COLUMN_NAME",
")",
")",
")",
";",
"if",
"(",
"empty",
"(",
"$",
... | Get all visible column names.
@return array|static | [
"Get",
"all",
"visible",
"column",
"names",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L375-L388 |
207,385 | z-song/laravel-admin | src/Grid.php | Grid.prependColumn | protected function prependColumn($column = '', $label = '')
{
$column = new Column($column, $label);
$column->setGrid($this);
return tap($column, function ($value) {
$this->columns->prepend($value);
});
} | php | protected function prependColumn($column = '', $label = '')
{
$column = new Column($column, $label);
$column->setGrid($this);
return tap($column, function ($value) {
$this->columns->prepend($value);
});
} | [
"protected",
"function",
"prependColumn",
"(",
"$",
"column",
"=",
"''",
",",
"$",
"label",
"=",
"''",
")",
"{",
"$",
"column",
"=",
"new",
"Column",
"(",
"$",
"column",
",",
"$",
"label",
")",
";",
"$",
"column",
"->",
"setGrid",
"(",
"$",
"this",... | Prepend column to grid.
@param string $column
@param string $label
@return Column | [
"Prepend",
"column",
"to",
"grid",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L416-L424 |
207,386 | z-song/laravel-admin | src/Grid.php | Grid.disablePagination | public function disablePagination(bool $disable = true)
{
$this->model->usePaginate(!$disable);
return $this->option('show_pagination', !$disable);
} | php | public function disablePagination(bool $disable = true)
{
$this->model->usePaginate(!$disable);
return $this->option('show_pagination', !$disable);
} | [
"public",
"function",
"disablePagination",
"(",
"bool",
"$",
"disable",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"model",
"->",
"usePaginate",
"(",
"!",
"$",
"disable",
")",
";",
"return",
"$",
"this",
"->",
"option",
"(",
"'show_pagination'",
",",
"!",... | Disable grid pagination.
@return $this | [
"Disable",
"grid",
"pagination",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L465-L470 |
207,387 | z-song/laravel-admin | src/Grid.php | Grid.actions | public function actions($actions)
{
if ($actions instanceof Closure) {
$this->actionsCallback = $actions;
}
if (is_string($actions) && is_subclass_of($actions, Displayers\Actions::class)) {
$this->actionsClass = $actions;
}
return $this;
} | php | public function actions($actions)
{
if ($actions instanceof Closure) {
$this->actionsCallback = $actions;
}
if (is_string($actions) && is_subclass_of($actions, Displayers\Actions::class)) {
$this->actionsClass = $actions;
}
return $this;
} | [
"public",
"function",
"actions",
"(",
"$",
"actions",
")",
"{",
"if",
"(",
"$",
"actions",
"instanceof",
"Closure",
")",
"{",
"$",
"this",
"->",
"actionsCallback",
"=",
"$",
"actions",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"actions",
")",
"&&",
... | Set grid action callback.
@param Closure|string $actions
@return $this | [
"Set",
"grid",
"action",
"callback",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L509-L520 |
207,388 | z-song/laravel-admin | src/Grid.php | Grid.disableRowSelector | public function disableRowSelector(bool $disable = true)
{
$this->tools->disableBatchActions($disable);
return $this->option('show_row_selector', !$disable);
} | php | public function disableRowSelector(bool $disable = true)
{
$this->tools->disableBatchActions($disable);
return $this->option('show_row_selector', !$disable);
} | [
"public",
"function",
"disableRowSelector",
"(",
"bool",
"$",
"disable",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"tools",
"->",
"disableBatchActions",
"(",
"$",
"disable",
")",
";",
"return",
"$",
"this",
"->",
"option",
"(",
"'show_row_selector'",
",",
... | Disable row selector.
@return Grid|mixed | [
"Disable",
"row",
"selector",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L542-L547 |
207,389 | z-song/laravel-admin | src/Grid.php | Grid.buildRows | protected function buildRows(array $data)
{
$this->rows = collect($data)->map(function ($model, $number) {
return new Row($number, $model);
});
if ($this->rowsCallback) {
$this->rows->map($this->rowsCallback);
}
} | php | protected function buildRows(array $data)
{
$this->rows = collect($data)->map(function ($model, $number) {
return new Row($number, $model);
});
if ($this->rowsCallback) {
$this->rows->map($this->rowsCallback);
}
} | [
"protected",
"function",
"buildRows",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"rows",
"=",
"collect",
"(",
"$",
"data",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"model",
",",
"$",
"number",
")",
"{",
"return",
"new",
"Row",
"(",... | Build the grid rows.
@param array $data
@return void | [
"Build",
"the",
"grid",
"rows",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L602-L611 |
207,390 | z-song/laravel-admin | src/Grid.php | Grid.getCreateUrl | public function getCreateUrl()
{
$queryString = '';
if ($constraints = $this->model()->getConstraints()) {
$queryString = http_build_query($constraints);
}
return sprintf('%s/create%s',
$this->resource(),
$queryString ? ('?'.$queryString) : ''
... | php | public function getCreateUrl()
{
$queryString = '';
if ($constraints = $this->model()->getConstraints()) {
$queryString = http_build_query($constraints);
}
return sprintf('%s/create%s',
$this->resource(),
$queryString ? ('?'.$queryString) : ''
... | [
"public",
"function",
"getCreateUrl",
"(",
")",
"{",
"$",
"queryString",
"=",
"''",
";",
"if",
"(",
"$",
"constraints",
"=",
"$",
"this",
"->",
"model",
"(",
")",
"->",
"getConstraints",
"(",
")",
")",
"{",
"$",
"queryString",
"=",
"http_build_query",
... | Get create url.
@return string | [
"Get",
"create",
"url",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L667-L679 |
207,391 | z-song/laravel-admin | src/Grid.php | Grid.resource | public function resource($path = null)
{
if (!empty($path)) {
$this->resourcePath = $path;
return $this;
}
if (!empty($this->resourcePath)) {
return $this->resourcePath;
}
return app('request')->getPathInfo();
} | php | public function resource($path = null)
{
if (!empty($path)) {
$this->resourcePath = $path;
return $this;
}
if (!empty($this->resourcePath)) {
return $this->resourcePath;
}
return app('request')->getPathInfo();
} | [
"public",
"function",
"resource",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"$",
"this",
"->",
"resourcePath",
"=",
"$",
"path",
";",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"!",
"emp... | Get current resource uri.
@param string $path
@return string | [
"Get",
"current",
"resource",
"uri",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L788-L801 |
207,392 | z-song/laravel-admin | src/Grid.php | Grid.handleGetMutatorColumn | protected function handleGetMutatorColumn($method, $label)
{
if ($this->model()->eloquent()->hasGetMutator($method)) {
return $this->addColumn($method, $label);
}
return false;
} | php | protected function handleGetMutatorColumn($method, $label)
{
if ($this->model()->eloquent()->hasGetMutator($method)) {
return $this->addColumn($method, $label);
}
return false;
} | [
"protected",
"function",
"handleGetMutatorColumn",
"(",
"$",
"method",
",",
"$",
"label",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"model",
"(",
")",
"->",
"eloquent",
"(",
")",
"->",
"hasGetMutator",
"(",
"$",
"method",
")",
")",
"{",
"return",
"$",
... | Handle get mutator column for grid.
@param string $method
@param string $label
@return bool|Column | [
"Handle",
"get",
"mutator",
"column",
"for",
"grid",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L811-L818 |
207,393 | z-song/laravel-admin | src/Grid.php | Grid.setView | public function setView($view, $variables = [])
{
if (!empty($variables)) {
$this->with($variables);
}
$this->view = $view;
} | php | public function setView($view, $variables = [])
{
if (!empty($variables)) {
$this->with($variables);
}
$this->view = $view;
} | [
"public",
"function",
"setView",
"(",
"$",
"view",
",",
"$",
"variables",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"variables",
")",
")",
"{",
"$",
"this",
"->",
"with",
"(",
"$",
"variables",
")",
";",
"}",
"$",
"this",
"->"... | Set a view to render.
@param string $view
@param array $variables | [
"Set",
"a",
"view",
"to",
"render",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L951-L958 |
207,394 | z-song/laravel-admin | src/Grid.php | Grid.render | public function render()
{
$this->handleExportRequest(true);
try {
$this->build();
} catch (\Exception $e) {
return Handler::renderException($e);
}
return view($this->view, $this->variables())->render();
} | php | public function render()
{
$this->handleExportRequest(true);
try {
$this->build();
} catch (\Exception $e) {
return Handler::renderException($e);
}
return view($this->view, $this->variables())->render();
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"this",
"->",
"handleExportRequest",
"(",
"true",
")",
";",
"try",
"{",
"$",
"this",
"->",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"return",
"Handler",
":... | Get the string contents of the grid view.
@return string | [
"Get",
"the",
"string",
"contents",
"of",
"the",
"grid",
"view",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid.php#L1007-L1018 |
207,395 | z-song/laravel-admin | src/Grid/Filter/Where.php | Where.getQueryHash | public static function getQueryHash(\Closure $closure, $label = '')
{
$reflection = new \ReflectionFunction($closure);
return md5($reflection->getFileName().$reflection->getStartLine().$reflection->getEndLine().$label);
} | php | public static function getQueryHash(\Closure $closure, $label = '')
{
$reflection = new \ReflectionFunction($closure);
return md5($reflection->getFileName().$reflection->getStartLine().$reflection->getEndLine().$label);
} | [
"public",
"static",
"function",
"getQueryHash",
"(",
"\\",
"Closure",
"$",
"closure",
",",
"$",
"label",
"=",
"''",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionFunction",
"(",
"$",
"closure",
")",
";",
"return",
"md5",
"(",
"$",
"reflection... | Get the hash string of query closure.
@param \Closure $closure
@param string $label
@return string | [
"Get",
"the",
"hash",
"string",
"of",
"query",
"closure",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Filter/Where.php#L49-L54 |
207,396 | z-song/laravel-admin | src/Grid/Concerns/HasElementNames.php | HasElementNames.setName | public function setName($name)
{
$this->name = $name;
$this->model()->setPerPageName("{$name}_{$this->model()->getPerPageName()}");
$this->getFilter()->setName($name);
return $this;
} | php | public function setName($name)
{
$this->name = $name;
$this->model()->setPerPageName("{$name}_{$this->model()->getPerPageName()}");
$this->getFilter()->setName($name);
return $this;
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"model",
"(",
")",
"->",
"setPerPageName",
"(",
"\"{$name}_{$this->model()->getPerPageName()}\"",
")",
";",
"$",
"this",
"->",... | Set name to grid.
@param string $name
@return $this | [
"Set",
"name",
"to",
"grid",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Grid/Concerns/HasElementNames.php#L35-L44 |
207,397 | z-song/laravel-admin | src/Show.php | Show.fields | public function fields(array $fields = [])
{
if (!Arr::isAssoc($fields)) {
$fields = array_combine($fields, $fields);
}
foreach ($fields as $field => $label) {
$this->field($field, $label);
}
return $this;
} | php | public function fields(array $fields = [])
{
if (!Arr::isAssoc($fields)) {
$fields = array_combine($fields, $fields);
}
foreach ($fields as $field => $label) {
$this->field($field, $label);
}
return $this;
} | [
"public",
"function",
"fields",
"(",
"array",
"$",
"fields",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"Arr",
"::",
"isAssoc",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"fields",
"=",
"array_combine",
"(",
"$",
"fields",
",",
"$",
"fields",
")",
";"... | Add multiple fields.
@param array $fields
@return $this | [
"Add",
"multiple",
"fields",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show.php#L166-L177 |
207,398 | z-song/laravel-admin | src/Show.php | Show.relation | public function relation($name, $label, $builder = null)
{
if (is_null($builder)) {
$builder = $label;
$label = '';
}
return $this->addRelation($name, $builder, $label);
} | php | public function relation($name, $label, $builder = null)
{
if (is_null($builder)) {
$builder = $label;
$label = '';
}
return $this->addRelation($name, $builder, $label);
} | [
"public",
"function",
"relation",
"(",
"$",
"name",
",",
"$",
"label",
",",
"$",
"builder",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"builder",
")",
")",
"{",
"$",
"builder",
"=",
"$",
"label",
";",
"$",
"label",
"=",
"''",
";",
"... | Add a relation to show.
@param string $name
@param string|\Closure $label
@param null|\Closure $builder
@return Relation | [
"Add",
"a",
"relation",
"to",
"show",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show.php#L200-L208 |
207,399 | z-song/laravel-admin | src/Show.php | Show.addField | protected function addField($name, $label = '')
{
$field = new Field($name, $label);
$field->setParent($this);
$this->overwriteExistingField($name);
return tap($field, function ($field) {
$this->fields->push($field);
});
} | php | protected function addField($name, $label = '')
{
$field = new Field($name, $label);
$field->setParent($this);
$this->overwriteExistingField($name);
return tap($field, function ($field) {
$this->fields->push($field);
});
} | [
"protected",
"function",
"addField",
"(",
"$",
"name",
",",
"$",
"label",
"=",
"''",
")",
"{",
"$",
"field",
"=",
"new",
"Field",
"(",
"$",
"name",
",",
"$",
"label",
")",
";",
"$",
"field",
"->",
"setParent",
"(",
"$",
"this",
")",
";",
"$",
"... | Add a model field to show.
@param string $name
@param string $label
@return Field | [
"Add",
"a",
"model",
"field",
"to",
"show",
"."
] | 3e65086f806b54699145f58af53843e5dbbb7994 | https://github.com/z-song/laravel-admin/blob/3e65086f806b54699145f58af53843e5dbbb7994/src/Show.php#L218-L229 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.