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
30,700
BKWLD/decoy
classes/Observers/ManyToManyChecklist.php
ManyToManyChecklist.updateRelationship
private function updateRelationship($model, $relationship) { // Make sure the relationship exists on the model. This also prevents the // wrong model (who might also have an `saved` callback) from trying to have // this data saved on it if (!method_exists($model, $relationship)) { ...
php
private function updateRelationship($model, $relationship) { // Make sure the relationship exists on the model. This also prevents the // wrong model (who might also have an `saved` callback) from trying to have // this data saved on it if (!method_exists($model, $relationship)) { ...
[ "private", "function", "updateRelationship", "(", "$", "model", ",", "$", "relationship", ")", "{", "// Make sure the relationship exists on the model. This also prevents the", "// wrong model (who might also have an `saved` callback) from trying to have", "// this data saved on it", "i...
Process a particular input instance @param Bkwld\Decoy\Models\Base $model A model instance @param string $relationship The relationship name
[ "Process", "a", "particular", "input", "instance" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Observers/ManyToManyChecklist.php#L46-L75
30,701
BKWLD/decoy
classes/Input/ModelValidator.php
ModelValidator.validate
public function validate(BaseModel $model, $rules = null, $messages = []) { return $this->validateAndPrefixErrors(null, $model, $rules, $messages); }
php
public function validate(BaseModel $model, $rules = null, $messages = []) { return $this->validateAndPrefixErrors(null, $model, $rules, $messages); }
[ "public", "function", "validate", "(", "BaseModel", "$", "model", ",", "$", "rules", "=", "null", ",", "$", "messages", "=", "[", "]", ")", "{", "return", "$", "this", "->", "validateAndPrefixErrors", "(", "null", ",", "$", "model", ",", "$", "rules", ...
Validate a model, firing Decoy events @param BaseModel $data @param array $rules A Laravel rules array. If null, will be pulled from model @param array $messages Special error messages @return Validator
[ "Validate", "a", "model", "firing", "Decoy", "events" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/ModelValidator.php#L25-L28
30,702
BKWLD/decoy
classes/Input/ModelValidator.php
ModelValidator.handleImageRules
public function handleImageRules($model, $rules) { // If the model is an image, the rules were passed in by NestedModels // and are good to go if (is_a($model, Image::class)) { return $rules; } // Otherwise, remove any image rules because this is a non-Image and...
php
public function handleImageRules($model, $rules) { // If the model is an image, the rules were passed in by NestedModels // and are good to go if (is_a($model, Image::class)) { return $rules; } // Otherwise, remove any image rules because this is a non-Image and...
[ "public", "function", "handleImageRules", "(", "$", "model", ",", "$", "rules", ")", "{", "// If the model is an image, the rules were passed in by NestedModels", "// and are good to go", "if", "(", "is_a", "(", "$", "model", ",", "Image", "::", "class", ")", ")", "...
Handle the Images feature, which is special because you define the rules on the parent model. @param BaseModel $data @param array $rules A Laravel rules array. If null, will be pulled from model @return array
[ "Handle", "the", "Images", "feature", "which", "is", "special", "because", "you", "define", "the", "rules", "on", "the", "parent", "model", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/ModelValidator.php#L96-L110
30,703
BKWLD/decoy
classes/Input/ModelValidator.php
ModelValidator.nestArray
public function nestArray($prefix, $array) { $data = []; foreach($array as $key => $value) { array_set($data, $prefix.$key, $value); } return $data; }
php
public function nestArray($prefix, $array) { $data = []; foreach($array as $key => $value) { array_set($data, $prefix.$key, $value); } return $data; }
[ "public", "function", "nestArray", "(", "$", "prefix", ",", "$", "array", ")", "{", "$", "data", "=", "[", "]", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "array_set", "(", "$", "data", ",", "$", "prefix", ...
Nest an array at another depth using the prefix @param string $prefix @param array $array @return array
[ "Nest", "an", "array", "at", "another", "depth", "using", "the", "prefix" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/ModelValidator.php#L119-L126
30,704
BKWLD/decoy
classes/Input/ModelValidator.php
ModelValidator.prefixArrayKeys
public function prefixArrayKeys($prefix, $array) { return array_combine(array_map(function ($key) use ($prefix) { return $prefix.$key; }, array_keys($array)), array_values($array)); }
php
public function prefixArrayKeys($prefix, $array) { return array_combine(array_map(function ($key) use ($prefix) { return $prefix.$key; }, array_keys($array)), array_values($array)); }
[ "public", "function", "prefixArrayKeys", "(", "$", "prefix", ",", "$", "array", ")", "{", "return", "array_combine", "(", "array_map", "(", "function", "(", "$", "key", ")", "use", "(", "$", "prefix", ")", "{", "return", "$", "prefix", ".", "$", "key",...
Apply a prefix to the keys of an array @param string $prefix @param array $array @return array
[ "Apply", "a", "prefix", "to", "the", "keys", "of", "an", "array" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/ModelValidator.php#L135-L140
30,705
BKWLD/decoy
classes/Input/ModelValidator.php
ModelValidator.removePrefixFromMessages
protected function removePrefixFromMessages($prefix, $validator) { // Get all the rules in a single flat array $rules = array_flatten($validator->getRules()); // Get just the rules, not rule modifiers $rules = array_map(function($rule) { preg_match('#^([^:]+)#', $rule, $...
php
protected function removePrefixFromMessages($prefix, $validator) { // Get all the rules in a single flat array $rules = array_flatten($validator->getRules()); // Get just the rules, not rule modifiers $rules = array_map(function($rule) { preg_match('#^([^:]+)#', $rule, $...
[ "protected", "function", "removePrefixFromMessages", "(", "$", "prefix", ",", "$", "validator", ")", "{", "// Get all the rules in a single flat array", "$", "rules", "=", "array_flatten", "(", "$", "validator", "->", "getRules", "(", ")", ")", ";", "// Get just the...
Add replacers to the validator that strip back out the prefix @param string $prefix @param Illuminate\Validation\Validator $validator @return void
[ "Add", "replacers", "to", "the", "validator", "that", "strip", "back", "out", "the", "prefix" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/ModelValidator.php#L149-L173
30,706
BKWLD/decoy
classes/Input/Search.php
Search.query
public static function query($terms) { return 'query='.urlencode(json_encode(array_map(function ($input, $field) { return [$field, '=', $input]; }, $terms, array_keys($terms)))); }
php
public static function query($terms) { return 'query='.urlencode(json_encode(array_map(function ($input, $field) { return [$field, '=', $input]; }, $terms, array_keys($terms)))); }
[ "public", "static", "function", "query", "(", "$", "terms", ")", "{", "return", "'query='", ".", "urlencode", "(", "json_encode", "(", "array_map", "(", "function", "(", "$", "input", ",", "$", "field", ")", "{", "return", "[", "$", "field", ",", "'='"...
Utility method to generate a query string that applies the condition provided in the args @param array $terms An associative array where the keys are "fields" and the values are "inputs" @return string
[ "Utility", "method", "to", "generate", "a", "query", "string", "that", "applies", "the", "condition", "provided", "in", "the", "args" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/Search.php#L27-L32
30,707
BKWLD/decoy
classes/Input/Search.php
Search.condition
private function condition($query, $field, $comparison, $input, $type) { // Convert date formats if ($type == 'date') { $field = $this->convertDateField($field); $input = Carbon::createFromFormat(__('decoy::form.date.format'), $input) ->format('Y-m-d'); ...
php
private function condition($query, $field, $comparison, $input, $type) { // Convert date formats if ($type == 'date') { $field = $this->convertDateField($field); $input = Carbon::createFromFormat(__('decoy::form.date.format'), $input) ->format('Y-m-d'); ...
[ "private", "function", "condition", "(", "$", "query", ",", "$", "field", ",", "$", "comparison", ",", "$", "input", ",", "$", "type", ")", "{", "// Convert date formats", "if", "(", "$", "type", "==", "'date'", ")", "{", "$", "field", "=", "$", "thi...
Add a condition to a query @param Illuminate\Database\Query\Builder $query @param string $field The field name from search config @param string $comparison The operator string from the search UI @param string $input The inpu...
[ "Add", "a", "condition", "to", "a", "query" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/Search.php#L93-L127
30,708
BKWLD/decoy
classes/Input/Search.php
Search.applyEquality
protected function applyEquality($comparison, $query, $field, $input) { // Make SQL safe values $safe_field = $this->makeSafeField($field); $safe_input = $input == '' ? 'NULL' : DB::connection()->getPdo()->quote($input); // Different engines have different APIs switch(DB::getDriverName()) { case 'm...
php
protected function applyEquality($comparison, $query, $field, $input) { // Make SQL safe values $safe_field = $this->makeSafeField($field); $safe_input = $input == '' ? 'NULL' : DB::connection()->getPdo()->quote($input); // Different engines have different APIs switch(DB::getDriverName()) { case 'm...
[ "protected", "function", "applyEquality", "(", "$", "comparison", ",", "$", "query", ",", "$", "field", ",", "$", "input", ")", "{", "// Make SQL safe values", "$", "safe_field", "=", "$", "this", "->", "makeSafeField", "(", "$", "field", ")", ";", "$", ...
Make the NULL-safe equals query @param string $comparison @param Builder $query @param string $field @param string $input @return Builder
[ "Make", "the", "NULL", "-", "safe", "equals", "query" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/Search.php#L154-L171
30,709
BKWLD/decoy
classes/Input/Search.php
Search.longhand
public function longhand($config) { $search = []; foreach ($config as $key => $val) { // Make locale menu if ($val == 'locale') { $search['locale'] = [ 'type' => 'select', 'label' => 'Locale', 'optio...
php
public function longhand($config) { $search = []; foreach ($config as $key => $val) { // Make locale menu if ($val == 'locale') { $search['locale'] = [ 'type' => 'select', 'label' => 'Locale', 'optio...
[ "public", "function", "longhand", "(", "$", "config", ")", "{", "$", "search", "=", "[", "]", ";", "foreach", "(", "$", "config", "as", "$", "key", "=>", "$", "val", ")", "{", "// Make locale menu", "if", "(", "$", "val", "==", "'locale'", ")", "{"...
Make the shorthand options of the search config explicit @param array $config Search config from the controller class definition @return array
[ "Make", "the", "shorthand", "options", "of", "the", "search", "config", "explicit" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/Search.php#L261-L304
30,710
BKWLD/decoy
classes/Input/Search.php
Search.longhandOptions
private function longhandOptions($options) { // Call static method. You don't pass the paranethesis // to static calls if (preg_match('#::.+\(\)#', $options)) { return call_user_func(substr($options, 0, strlen($options) - 2)); } // Return static variable ...
php
private function longhandOptions($options) { // Call static method. You don't pass the paranethesis // to static calls if (preg_match('#::.+\(\)#', $options)) { return call_user_func(substr($options, 0, strlen($options) - 2)); } // Return static variable ...
[ "private", "function", "longhandOptions", "(", "$", "options", ")", "{", "// Call static method. You don't pass the paranethesis", "// to static calls", "if", "(", "preg_match", "(", "'#::.+\\(\\)#'", ",", "$", "options", ")", ")", "{", "return", "call_user_func", "(",...
Parse select options, returning a transformed array with static arrays or callbacks executed @param array $options @return array
[ "Parse", "select", "options", "returning", "a", "transformed", "array", "with", "static", "arrays", "or", "callbacks", "executed" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/Search.php#L313-L330
30,711
BKWLD/decoy
classes/Input/Search.php
Search.makeSoftDeletesCondition
public function makeSoftDeletesCondition($controller) { if (!$controller->withTrashed()) return []; return [ 'deleted_at' => [ 'type' => 'select', 'label' => 'status', 'options' => [ 'exists' => 'exists', ...
php
public function makeSoftDeletesCondition($controller) { if (!$controller->withTrashed()) return []; return [ 'deleted_at' => [ 'type' => 'select', 'label' => 'status', 'options' => [ 'exists' => 'exists', ...
[ "public", "function", "makeSoftDeletesCondition", "(", "$", "controller", ")", "{", "if", "(", "!", "$", "controller", "->", "withTrashed", "(", ")", ")", "return", "[", "]", ";", "return", "[", "'deleted_at'", "=>", "[", "'type'", "=>", "'select'", ",", ...
Make soft deletes condition if the controller supports trashed records. Returns an array so it can be easily merged into exisitng configs. @param Controller\Base $controller @return array
[ "Make", "soft", "deletes", "condition", "if", "the", "controller", "supports", "trashed", "records", ".", "Returns", "an", "array", "so", "it", "can", "be", "easily", "merged", "into", "exisitng", "configs", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/Search.php#L339-L365
30,712
BKWLD/decoy
classes/Models/Encoding.php
Encoding.onCreating
public function onCreating() { // Delete any other encoding jobs for the same parent and field self::where('encodable_type', '=', $this->encodable_type) ->where('encodable_id', '=', $this->encodable_id) ->where('encodable_attribute', '=', $this->encodable_attribute) ...
php
public function onCreating() { // Delete any other encoding jobs for the same parent and field self::where('encodable_type', '=', $this->encodable_type) ->where('encodable_id', '=', $this->encodable_id) ->where('encodable_attribute', '=', $this->encodable_attribute) ...
[ "public", "function", "onCreating", "(", ")", "{", "// Delete any other encoding jobs for the same parent and field", "self", "::", "where", "(", "'encodable_type'", ",", "'='", ",", "$", "this", "->", "encodable_type", ")", "->", "where", "(", "'encodable_id'", ",", ...
Set default fields and delete any old encodings for the same source. @return void
[ "Set", "default", "fields", "and", "delete", "any", "old", "encodings", "for", "the", "same", "source", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Encoding.php#L69-L79
30,713
BKWLD/decoy
classes/Models/Encoding.php
Encoding.onDeleted
public function onDeleted() { // Get the directory of an output if (($sources = (array) $this->outputs) // Convert sources to an array && count($sources) // If there are sources && ($first = array_pop($sources)) // Get the last source ...
php
public function onDeleted() { // Get the directory of an output if (($sources = (array) $this->outputs) // Convert sources to an array && count($sources) // If there are sources && ($first = array_pop($sources)) // Get the last source ...
[ "public", "function", "onDeleted", "(", ")", "{", "// Get the directory of an output", "if", "(", "(", "$", "sources", "=", "(", "array", ")", "$", "this", "->", "outputs", ")", "// Convert sources to an array", "&&", "count", "(", "$", "sources", ")", "// If ...
Delete encoded files that are local to this filesystem
[ "Delete", "encoded", "files", "that", "are", "local", "to", "this", "filesystem" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Encoding.php#L97-L108
30,714
BKWLD/decoy
classes/Models/Encoding.php
Encoding.source
public function source() { $val = $this->encodable->{$this->encodable_attribute}; if (preg_match('#^http#', $val)) { return $val; } return URL::asset($val); }
php
public function source() { $val = $this->encodable->{$this->encodable_attribute}; if (preg_match('#^http#', $val)) { return $val; } return URL::asset($val); }
[ "public", "function", "source", "(", ")", "{", "$", "val", "=", "$", "this", "->", "encodable", "->", "{", "$", "this", "->", "encodable_attribute", "}", ";", "if", "(", "preg_match", "(", "'#^http#'", ",", "$", "val", ")", ")", "{", "return", "$", ...
Get the source video for the encode @return string The path to the video relative to the document root
[ "Get", "the", "source", "video", "for", "the", "encode" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Encoding.php#L150-L158
30,715
BKWLD/decoy
classes/Models/Encoding.php
Encoding.storeJob
public function storeJob($job_id, $outputs = null) { $this->status = 'queued'; $this->job_id = $job_id; $this->outputs = $outputs; $this->save(); }
php
public function storeJob($job_id, $outputs = null) { $this->status = 'queued'; $this->job_id = $job_id; $this->outputs = $outputs; $this->save(); }
[ "public", "function", "storeJob", "(", "$", "job_id", ",", "$", "outputs", "=", "null", ")", "{", "$", "this", "->", "status", "=", "'queued'", ";", "$", "this", "->", "job_id", "=", "$", "job_id", ";", "$", "this", "->", "outputs", "=", "$", "outp...
Store a record of the encoding job @param string $job_id A unique id generated by the service @param mixed $outputs An optional assoc array where the keys are labels for the outputs and the values are absolute paths of where the output will be saved @return void
[ "Store", "a", "record", "of", "the", "encoding", "job" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Encoding.php#L169-L175
30,716
BKWLD/decoy
classes/Models/Encoding.php
Encoding.status
public function status($status, $message = null) { if (!in_array($status, static::$states)) { throw new Exception('Unknown state: '.$status); } // If the current status is complete, don't update again. I have seen cases of a late // processing call on a HLS stream file ...
php
public function status($status, $message = null) { if (!in_array($status, static::$states)) { throw new Exception('Unknown state: '.$status); } // If the current status is complete, don't update again. I have seen cases of a late // processing call on a HLS stream file ...
[ "public", "function", "status", "(", "$", "status", ",", "$", "message", "=", "null", ")", "{", "if", "(", "!", "in_array", "(", "$", "status", ",", "static", "::", "$", "states", ")", ")", "{", "throw", "new", "Exception", "(", "'Unknown state: '", ...
Update the status of the encode @param string status @param string $message @return void
[ "Update", "the", "status", "of", "the", "encode" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Encoding.php#L184-L214
30,717
BKWLD/decoy
classes/Models/Encoding.php
Encoding.getAdminVideoTagAttribute
public function getAdminVideoTagAttribute() { if (!$tag = $this->getTagAttribute()) { return; } $tag->controls(); if (isset($this->response->output->width)) { $tag->width($this->response->output->width); } return $tag->render(); }
php
public function getAdminVideoTagAttribute() { if (!$tag = $this->getTagAttribute()) { return; } $tag->controls(); if (isset($this->response->output->width)) { $tag->width($this->response->output->width); } return $tag->render(); }
[ "public", "function", "getAdminVideoTagAttribute", "(", ")", "{", "if", "(", "!", "$", "tag", "=", "$", "this", "->", "getTagAttribute", "(", ")", ")", "{", "return", ";", "}", "$", "tag", "->", "controls", "(", ")", ";", "if", "(", "isset", "(", "...
Generate an HTML5 video tag with extra elements for displaying in the admin @return string html
[ "Generate", "an", "HTML5", "video", "tag", "with", "extra", "elements", "for", "displaying", "in", "the", "admin" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Encoding.php#L234-L246
30,718
BKWLD/decoy
classes/Models/Encoding.php
Encoding.getAdminStatsMarkupAttribute
protected function getAdminStatsMarkupAttribute() { if (!$stats = $this->getStatsAttribute()) { return ''; } return '<div class="stats">' .implode('', array_map(function ($val, $key) { return sprintf('<span class="label"> <span>%s<...
php
protected function getAdminStatsMarkupAttribute() { if (!$stats = $this->getStatsAttribute()) { return ''; } return '<div class="stats">' .implode('', array_map(function ($val, $key) { return sprintf('<span class="label"> <span>%s<...
[ "protected", "function", "getAdminStatsMarkupAttribute", "(", ")", "{", "if", "(", "!", "$", "stats", "=", "$", "this", "->", "getStatsAttribute", "(", ")", ")", "{", "return", "''", ";", "}", "return", "'<div class=\"stats\">'", ".", "implode", "(", "''", ...
Get stats as labels with badges @return string html
[ "Get", "stats", "as", "labels", "with", "badges" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Encoding.php#L253-L268
30,719
BKWLD/decoy
classes/Models/Encoding.php
Encoding.getStatsAttribute
protected function getStatsAttribute() { if (empty($this->response->output)) { return; } $o = $this->response->output; return array_filter([ 'Bitrate' => number_format($o->video_bitrate_in_kbps + $o->audio_bitrate_in_kbps).' kbps', ...
php
protected function getStatsAttribute() { if (empty($this->response->output)) { return; } $o = $this->response->output; return array_filter([ 'Bitrate' => number_format($o->video_bitrate_in_kbps + $o->audio_bitrate_in_kbps).' kbps', ...
[ "protected", "function", "getStatsAttribute", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "response", "->", "output", ")", ")", "{", "return", ";", "}", "$", "o", "=", "$", "this", "->", "response", "->", "output", ";", "return", "arra...
Read an array of stats from the response @return array|void
[ "Read", "an", "array", "of", "stats", "from", "the", "response" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Encoding.php#L275-L290
30,720
BKWLD/decoy
classes/Models/Encoding.php
Encoding.getTagAttribute
public function getTagAttribute() { // Require sources and for the encoding to be complete if (!$sources = $this->getOutputsValue()) { return; } // Start the tag $tag = HtmlElement::video(); $tag->value('Your browser does not support the video tag. You sh...
php
public function getTagAttribute() { // Require sources and for the encoding to be complete if (!$sources = $this->getOutputsValue()) { return; } // Start the tag $tag = HtmlElement::video(); $tag->value('Your browser does not support the video tag. You sh...
[ "public", "function", "getTagAttribute", "(", ")", "{", "// Require sources and for the encoding to be complete", "if", "(", "!", "$", "sources", "=", "$", "this", "->", "getOutputsValue", "(", ")", ")", "{", "return", ";", "}", "// Start the tag", "$", "tag", "...
Generate an HTML5 video tag via Former's HtmlObject for the outputs @return HtmlObject\Element
[ "Generate", "an", "HTML5", "video", "tag", "via", "Former", "s", "HtmlObject", "for", "the", "outputs" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Encoding.php#L316-L350
30,721
BKWLD/decoy
classes/Models/Encoding.php
Encoding.getOutputsValue
public function getOutputsValue() { if ($this->status != 'complete') { return; } $val = $this->getAttributeFromArray('outputs'); if (is_string($val)) { return $this->outputs; } return $val; }
php
public function getOutputsValue() { if ($this->status != 'complete') { return; } $val = $this->getAttributeFromArray('outputs'); if (is_string($val)) { return $this->outputs; } return $val; }
[ "public", "function", "getOutputsValue", "(", ")", "{", "if", "(", "$", "this", "->", "status", "!=", "'complete'", ")", "{", "return", ";", "}", "$", "val", "=", "$", "this", "->", "getAttributeFromArray", "(", "'outputs'", ")", ";", "if", "(", "is_st...
Get the outputs value. I made this to work around an issue where Laravel was double casting the outputs. I'm not sure why this was happening after some lengthy digging but it seemed unique to Encodings on Elements. So I'm testing whether the attribute value has already been casted. @return object
[ "Get", "the", "outputs", "value", ".", "I", "made", "this", "to", "work", "around", "an", "issue", "where", "Laravel", "was", "double", "casting", "the", "outputs", ".", "I", "m", "not", "sure", "why", "this", "was", "happening", "after", "some", "length...
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Encoding.php#L360-L372
30,722
BKWLD/decoy
classes/Markup/ImageElement.php
ImageElement.render
public function render() { // Different conditions for different types of tags switch ($this->element) { // Img tags use the src case 'img': if (empty($this->getAttribute('src'))) { return ''; } break; ...
php
public function render() { // Different conditions for different types of tags switch ($this->element) { // Img tags use the src case 'img': if (empty($this->getAttribute('src'))) { return ''; } break; ...
[ "public", "function", "render", "(", ")", "{", "// Different conditions for different types of tags", "switch", "(", "$", "this", "->", "element", ")", "{", "// Img tags use the src", "case", "'img'", ":", "if", "(", "empty", "(", "$", "this", "->", "getAttribute"...
Check that an image URL exists before allowing the tag to render @return string
[ "Check", "that", "an", "image", "URL", "exists", "before", "allowing", "the", "tag", "to", "render" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Markup/ImageElement.php#L30-L53
30,723
BKWLD/decoy
classes/Routing/UrlGenerator.php
UrlGenerator.relative
public function relative($action = 'index', $id = null, $child = null) { // Get the current path, adding a leading slash that should be missing $path = '/'.$this->path; // Get the URL up to and including the last controller. If we're not linking // to a child, also remove the id, w...
php
public function relative($action = 'index', $id = null, $child = null) { // Get the current path, adding a leading slash that should be missing $path = '/'.$this->path; // Get the URL up to and including the last controller. If we're not linking // to a child, also remove the id, w...
[ "public", "function", "relative", "(", "$", "action", "=", "'index'", ",", "$", "id", "=", "null", ",", "$", "child", "=", "null", ")", "{", "// Get the current path, adding a leading slash that should be missing", "$", "path", "=", "'/'", ".", "$", "this", "-...
Construct a route that takes into account the current url path as well as the function arguments @param string $action The action we're linking to: index/edit/etc @param integer $id Optional id that we're linking to. Required for actions like edit. @param string $child The name (or full class) of a child co...
[ "Construct", "a", "route", "that", "takes", "into", "account", "the", "current", "url", "path", "as", "well", "as", "the", "function", "arguments" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/UrlGenerator.php#L49-L100
30,724
BKWLD/decoy
classes/Routing/UrlGenerator.php
UrlGenerator.action
public function action($controller = null, $id = null) { // Assume that the current, first path segment is the directory decoy is // running in preg_match('#[a-z-]+#i', $this->path, $matches); $decoy = $matches[0]; // Strip the action from the controller $action = ''...
php
public function action($controller = null, $id = null) { // Assume that the current, first path segment is the directory decoy is // running in preg_match('#[a-z-]+#i', $this->path, $matches); $decoy = $matches[0]; // Strip the action from the controller $action = ''...
[ "public", "function", "action", "(", "$", "controller", "=", "null", ",", "$", "id", "=", "null", ")", "{", "// Assume that the current, first path segment is the directory decoy is", "// running in", "preg_match", "(", "'#[a-z-]+#i'", ",", "$", "this", "->", "path", ...
Make a URL given a fully namespaced controller. This only generates routes as if the controller is in the root level; as if it has no parents. @param string $controller ex: Bkwld\Decoy\Controllers\Admins@create @param integer $id @return string ex: http://admin/admins/create
[ "Make", "a", "URL", "given", "a", "fully", "namespaced", "controller", ".", "This", "only", "generates", "routes", "as", "if", "the", "controller", "is", "in", "the", "root", "level", ";", "as", "if", "it", "has", "no", "parents", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/UrlGenerator.php#L110-L142
30,725
BKWLD/decoy
classes/Routing/UrlGenerator.php
UrlGenerator.slugController
public function slugController($controller) { // Get the controller name $controller = preg_replace('#^('.preg_quote('Bkwld\Decoy\Controllers\\') .'|'.preg_quote('App\Http\Controllers\Admin\\').')#', '', $controller); // Convert study caps to dashes $controller = Str::sn...
php
public function slugController($controller) { // Get the controller name $controller = preg_replace('#^('.preg_quote('Bkwld\Decoy\Controllers\\') .'|'.preg_quote('App\Http\Controllers\Admin\\').')#', '', $controller); // Convert study caps to dashes $controller = Str::sn...
[ "public", "function", "slugController", "(", "$", "controller", ")", "{", "// Get the controller name", "$", "controller", "=", "preg_replace", "(", "'#^('", ".", "preg_quote", "(", "'Bkwld\\Decoy\\Controllers\\\\'", ")", ".", "'|'", ".", "preg_quote", "(", "'App\\H...
Convert a controller to how it is referenced in a url @param string $controller ex: Admin\ArticlesAreCoolController @return string ex: articles-are-cool
[ "Convert", "a", "controller", "to", "how", "it", "is", "referenced", "in", "a", "url" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/UrlGenerator.php#L150-L161
30,726
BKWLD/decoy
classes/Observers/Changes.php
Changes.handle
public function handle($event, $payload) { list($model) = $payload; // Don't log changes to pivot models. Even though a user may have initiated // this, it's kind of meaningless to them. These events can happen when a // user messes with drag and drop positioning. if (is_a...
php
public function handle($event, $payload) { list($model) = $payload; // Don't log changes to pivot models. Even though a user may have initiated // this, it's kind of meaningless to them. These events can happen when a // user messes with drag and drop positioning. if (is_a...
[ "public", "function", "handle", "(", "$", "event", ",", "$", "payload", ")", "{", "list", "(", "$", "model", ")", "=", "$", "payload", ";", "// Don't log changes to pivot models. Even though a user may have initiated", "// this, it's kind of meaningless to them. These eve...
Handle all Eloquent model events @param string $event @param array $payload Contains: - Bkwld\Decoy\Models\Base $model
[ "Handle", "all", "Eloquent", "model", "events" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Observers/Changes.php#L30-L80
30,727
BKWLD/decoy
classes/Layout/Breadcrumbs.php
Breadcrumbs.parseURL
public function parseURL() { $breadcrumbs = []; // Get the segments $path = Request::path(); $segments = explode('/', $path); // Loop through them in blocks of 2: [list, detail] $url = $segments[0]; for ($i=1; $i<count($segments); $i+=2) { // If...
php
public function parseURL() { $breadcrumbs = []; // Get the segments $path = Request::path(); $segments = explode('/', $path); // Loop through them in blocks of 2: [list, detail] $url = $segments[0]; for ($i=1; $i<count($segments); $i+=2) { // If...
[ "public", "function", "parseURL", "(", ")", "{", "$", "breadcrumbs", "=", "[", "]", ";", "// Get the segments", "$", "path", "=", "Request", "::", "path", "(", ")", ";", "$", "segments", "=", "explode", "(", "'/'", ",", "$", "path", ")", ";", "// Loo...
Step through the URL, creating controller and model objects for relevant segments to populate richer data in the breadcrumbs, automatically @return array
[ "Step", "through", "the", "URL", "creating", "controller", "and", "model", "objects", "for", "relevant", "segments", "to", "populate", "richer", "data", "in", "the", "breadcrumbs", "automatically" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Layout/Breadcrumbs.php#L50-L100
30,728
BKWLD/decoy
classes/Layout/Breadcrumbs.php
Breadcrumbs.find
public function find($controller, $id) { $model = $controller->model(); if ($controller->withTrashed()) { return $model::withTrashed()->find($id); } else { return $model::find($id); } }
php
public function find($controller, $id) { $model = $controller->model(); if ($controller->withTrashed()) { return $model::withTrashed()->find($id); } else { return $model::find($id); } }
[ "public", "function", "find", "(", "$", "controller", ",", "$", "id", ")", "{", "$", "model", "=", "$", "controller", "->", "model", "(", ")", ";", "if", "(", "$", "controller", "->", "withTrashed", "(", ")", ")", "{", "return", "$", "model", "::",...
Lookup a model instance given the controller and id, including any trashed models in case the controller should show trashed models @param Controller\Base $controller @param integer $id @return Model
[ "Lookup", "a", "model", "instance", "given", "the", "controller", "and", "id", "including", "any", "trashed", "models", "in", "case", "the", "controller", "should", "show", "trashed", "models" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Layout/Breadcrumbs.php#L110-L118
30,729
BKWLD/decoy
classes/Layout/Breadcrumbs.php
Breadcrumbs.back
public function back() { // If there aren't enough breadcrumbs for a back URL, report false if (count($this->links) < 2) { return; } // Get the URL from two back from the end in the breadcrumbs array $urls = array_keys($this->links); return $urls[count(...
php
public function back() { // If there aren't enough breadcrumbs for a back URL, report false if (count($this->links) < 2) { return; } // Get the URL from two back from the end in the breadcrumbs array $urls = array_keys($this->links); return $urls[count(...
[ "public", "function", "back", "(", ")", "{", "// If there aren't enough breadcrumbs for a back URL, report false", "if", "(", "count", "(", "$", "this", "->", "links", ")", "<", "2", ")", "{", "return", ";", "}", "// Get the URL from two back from the end in the breadcr...
Get the url for a back button given a breadcrumbs array. Or return false if there is no where to go back to. @return string|void
[ "Get", "the", "url", "for", "a", "back", "button", "given", "a", "breadcrumbs", "array", ".", "Or", "return", "false", "if", "there", "is", "no", "where", "to", "go", "back", "to", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Layout/Breadcrumbs.php#L146-L158
30,730
BKWLD/decoy
classes/Layout/Breadcrumbs.php
Breadcrumbs.smartBack
public function smartBack() { // If we are on a listing page (an odd length), do the normal stuff // http://stackoverflow.com/a/9153969/59160 if (count($this->links) & 1) { return $this->back(); } // If we're on the first level detail page, do normal stuff ...
php
public function smartBack() { // If we are on a listing page (an odd length), do the normal stuff // http://stackoverflow.com/a/9153969/59160 if (count($this->links) & 1) { return $this->back(); } // If we're on the first level detail page, do normal stuff ...
[ "public", "function", "smartBack", "(", ")", "{", "// If we are on a listing page (an odd length), do the normal stuff", "// http://stackoverflow.com/a/9153969/59160", "if", "(", "count", "(", "$", "this", "->", "links", ")", "&", "1", ")", "{", "return", "$", "this", ...
If hitting back from a child detail page, goes to the parent detail page rather than to the child listing page. For instance, if you are editing the slides of a news page, when you go "back", it's back to the news page and not the listing of the news slides @return string
[ "If", "hitting", "back", "from", "a", "child", "detail", "page", "goes", "to", "the", "parent", "detail", "page", "rather", "than", "to", "the", "child", "listing", "page", ".", "For", "instance", "if", "you", "are", "editing", "the", "slides", "of", "a"...
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Layout/Breadcrumbs.php#L168-L186
30,731
BKWLD/decoy
classes/Input/EncodingProviders/Zencoder.php
Zencoder.encode
public function encode($source, $preset) { // Tell the Zencoder SDK to create a job try { $outputs = $this->outputsConfig($preset); $job = $this->sdk()->jobs->create([ 'input' => $source, 'output' => $outputs, ]); // St...
php
public function encode($source, $preset) { // Tell the Zencoder SDK to create a job try { $outputs = $this->outputsConfig($preset); $job = $this->sdk()->jobs->create([ 'input' => $source, 'output' => $outputs, ]); // St...
[ "public", "function", "encode", "(", "$", "source", ",", "$", "preset", ")", "{", "// Tell the Zencoder SDK to create a job", "try", "{", "$", "outputs", "=", "$", "this", "->", "outputsConfig", "(", "$", "preset", ")", ";", "$", "job", "=", "$", "this", ...
Tell the service to encode an asset it's source @param string $source A full URL for the source asset @param string $preset The key to the preset function @return void
[ "Tell", "the", "service", "to", "encode", "an", "asset", "it", "s", "source" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/EncodingProviders/Zencoder.php#L58-L77
30,732
BKWLD/decoy
classes/Input/EncodingProviders/Zencoder.php
Zencoder.filterHLS
protected function filterHLS($config) { // Do not allow any outputs that have a type of "segmented" or "playlist" if (empty($config['playlist'])) { return array_filter($config, function ($output) { return !(isset($output['type']) && in_array($output['type'], ['segmented',...
php
protected function filterHLS($config) { // Do not allow any outputs that have a type of "segmented" or "playlist" if (empty($config['playlist'])) { return array_filter($config, function ($output) { return !(isset($output['type']) && in_array($output['type'], ['segmented',...
[ "protected", "function", "filterHLS", "(", "$", "config", ")", "{", "// Do not allow any outputs that have a type of \"segmented\" or \"playlist\"", "if", "(", "empty", "(", "$", "config", "[", "'playlist'", "]", ")", ")", "{", "return", "array_filter", "(", "$", "c...
If the playlist is set to `false` then remove all the HLS encodings. HLS is the "http live streaming" outputs that let us serve a video that can adjust quality levels in response to the bandwidth of the clietn. Works only on iPhone, Android, and Safari right now. @param array $config A config assoc array @return ar...
[ "If", "the", "playlist", "is", "set", "to", "false", "then", "remove", "all", "the", "HLS", "encodings", ".", "HLS", "is", "the", "http", "live", "streaming", "outputs", "that", "let", "us", "serve", "a", "video", "that", "can", "adjust", "quality", "lev...
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/EncodingProviders/Zencoder.php#L104-L115
30,733
BKWLD/decoy
classes/Input/EncodingProviders/Zencoder.php
Zencoder.addCommonProps
protected function addCommonProps($outputs) { // Decoy settings $common = [ // Destination location as a directory 'base_url' => $this->destination(), // Register for notifications for when the conding is done. If testing // from CLI, just set the ap...
php
protected function addCommonProps($outputs) { // Decoy settings $common = [ // Destination location as a directory 'base_url' => $this->destination(), // Register for notifications for when the conding is done. If testing // from CLI, just set the ap...
[ "protected", "function", "addCommonProps", "(", "$", "outputs", ")", "{", "// Decoy settings", "$", "common", "=", "[", "// Destination location as a directory", "'base_url'", "=>", "$", "this", "->", "destination", "(", ")", ",", "// Register for notifications for when...
Update the config with properties that are common to all outputs @param array $config @return array
[ "Update", "the", "config", "with", "properties", "that", "are", "common", "to", "all", "outputs" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/EncodingProviders/Zencoder.php#L123-L150
30,734
BKWLD/decoy
classes/Input/EncodingProviders/Zencoder.php
Zencoder.outputsToHash
protected function outputsToHash($outputs) { return array_map(function ($output) { // If a destination_root was set, subsitute that in for the destination // in the retured URL if ($root = Config::get('decoy.encode.destination_root')) { return str_replace...
php
protected function outputsToHash($outputs) { return array_map(function ($output) { // If a destination_root was set, subsitute that in for the destination // in the retured URL if ($root = Config::get('decoy.encode.destination_root')) { return str_replace...
[ "protected", "function", "outputsToHash", "(", "$", "outputs", ")", "{", "return", "array_map", "(", "function", "(", "$", "output", ")", "{", "// If a destination_root was set, subsitute that in for the destination", "// in the retured URL", "if", "(", "$", "root", "="...
Massage the outputs from Zencoder into a key-val associative array @param array $outputs @return array
[ "Massage", "the", "outputs", "from", "Zencoder", "into", "a", "key", "-", "val", "associative", "array" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/EncodingProviders/Zencoder.php#L158-L171
30,735
BKWLD/decoy
classes/Input/EncodingProviders/Zencoder.php
Zencoder.handleNotification
public function handleNotification($input) { // Parse the input $job = $this->sdk()->notifications->parseIncoming()->job; // Find the encoding model instance. If it's not found, then just // ignore it. This can easily happen if someone replaces a video // while one is bein...
php
public function handleNotification($input) { // Parse the input $job = $this->sdk()->notifications->parseIncoming()->job; // Find the encoding model instance. If it's not found, then just // ignore it. This can easily happen if someone replaces a video // while one is bein...
[ "public", "function", "handleNotification", "(", "$", "input", ")", "{", "// Parse the input", "$", "job", "=", "$", "this", "->", "sdk", "(", ")", "->", "notifications", "->", "parseIncoming", "(", ")", "->", "job", ";", "// Find the encoding model instance. I...
Handle notification requests from the SDK @param array $input Request::input() @return mixed Reponse to the API
[ "Handle", "notification", "requests", "from", "the", "SDK" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/EncodingProviders/Zencoder.php#L179-L227
30,736
BKWLD/decoy
classes/Input/EncodingProviders/Zencoder.php
Zencoder.progress
public function progress() { try { $progress = $this->sdk()->jobs->progress($this->model->job_id); if ($progress->state == 'finished') { return 100; } return $progress->progress; } catch (\Exception $e) { return 0; ...
php
public function progress() { try { $progress = $this->sdk()->jobs->progress($this->model->job_id); if ($progress->state == 'finished') { return 100; } return $progress->progress; } catch (\Exception $e) { return 0; ...
[ "public", "function", "progress", "(", ")", "{", "try", "{", "$", "progress", "=", "$", "this", "->", "sdk", "(", ")", "->", "jobs", "->", "progress", "(", "$", "this", "->", "model", "->", "job_id", ")", ";", "if", "(", "$", "progress", "->", "s...
Return the encoding percentage as an int @return int 0-100
[ "Return", "the", "encoding", "percentage", "as", "an", "int" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/EncodingProviders/Zencoder.php#L234-L246
30,737
BKWLD/decoy
classes/Input/EncodingProviders/Zencoder.php
Zencoder.zencoderArray
public function zencoderArray($obj) { if (is_array($obj)) { return $obj; } if (is_a($obj, 'Services_Zencoder_Object')) { return get_object_vars($obj); } throw new Exception('Unexpected object: '.get_class($obj)); }
php
public function zencoderArray($obj) { if (is_array($obj)) { return $obj; } if (is_a($obj, 'Services_Zencoder_Object')) { return get_object_vars($obj); } throw new Exception('Unexpected object: '.get_class($obj)); }
[ "public", "function", "zencoderArray", "(", "$", "obj", ")", "{", "if", "(", "is_array", "(", "$", "obj", ")", ")", "{", "return", "$", "obj", ";", "}", "if", "(", "is_a", "(", "$", "obj", ",", "'Services_Zencoder_Object'", ")", ")", "{", "return", ...
Convert a Services_Zencoder_Object object to an array @param Services_Zencoder_Object|array $obj @return array
[ "Convert", "a", "Services_Zencoder_Object", "object", "to", "an", "array" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/EncodingProviders/Zencoder.php#L264-L275
30,738
BKWLD/decoy
classes/Exceptions/Handler.php
Handler.handle404s
protected function handle404s($request, BaseException $e) { // Check for right exception if (!is_a($e, ModelNotFoundException::class) && !is_a($e, NotFoundHttpException::class)) { return; } // Check for a valid redirect if ($rule = RedirectRule::matchUsingRequest...
php
protected function handle404s($request, BaseException $e) { // Check for right exception if (!is_a($e, ModelNotFoundException::class) && !is_a($e, NotFoundHttpException::class)) { return; } // Check for a valid redirect if ($rule = RedirectRule::matchUsingRequest...
[ "protected", "function", "handle404s", "(", "$", "request", ",", "BaseException", "$", "e", ")", "{", "// Check for right exception", "if", "(", "!", "is_a", "(", "$", "e", ",", "ModelNotFoundException", "::", "class", ")", "&&", "!", "is_a", "(", "$", "e"...
If a 404 exception, check if there is a redirect rule. Or return a simple header if an AJAX request. @param \Illuminate\Http\Request $request @param \Exception $e @return \Illuminate\Http\RedirectResponse
[ "If", "a", "404", "exception", "check", "if", "there", "is", "a", "redirect", "rule", ".", "Or", "return", "a", "simple", "header", "if", "an", "AJAX", "request", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Exceptions/Handler.php#L51-L67
30,739
BKWLD/decoy
classes/Exceptions/Handler.php
Handler.handleValidation
protected function handleValidation($request, BaseException $e) { if (!is_a($e, ValidationFail::class)) { return; } // Log validation errors so Reporter will output them // if (Config::get('app.debug')) Log::debug(print_r($e->validation->messages(), true)); // R...
php
protected function handleValidation($request, BaseException $e) { if (!is_a($e, ValidationFail::class)) { return; } // Log validation errors so Reporter will output them // if (Config::get('app.debug')) Log::debug(print_r($e->validation->messages(), true)); // R...
[ "protected", "function", "handleValidation", "(", "$", "request", ",", "BaseException", "$", "e", ")", "{", "if", "(", "!", "is_a", "(", "$", "e", ",", "ValidationFail", "::", "class", ")", ")", "{", "return", ";", "}", "// Log validation errors so Reporter ...
Redirect users to the previous page with validation errors @param \Illuminate\Http\Request $request @param \Exception $e @return \Illuminate\Http\Response
[ "Redirect", "users", "to", "the", "previous", "page", "with", "validation", "errors" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Exceptions/Handler.php#L91-L106
30,740
BKWLD/decoy
classes/Controllers/Traits/Exportable.php
Exportable.makeCsvFileTitle
protected function makeCsvFileTitle() { return vsprintf('%s %s as of %s at %s.csv', [ Decoy::site(), $this->title(), Carbon::now()->format('n.j.y'), Carbon::now()->format('g:i A'), ]); }
php
protected function makeCsvFileTitle() { return vsprintf('%s %s as of %s at %s.csv', [ Decoy::site(), $this->title(), Carbon::now()->format('n.j.y'), Carbon::now()->format('g:i A'), ]); }
[ "protected", "function", "makeCsvFileTitle", "(", ")", "{", "return", "vsprintf", "(", "'%s %s as of %s at %s.csv'", ",", "[", "Decoy", "::", "site", "(", ")", ",", "$", "this", "->", "title", "(", ")", ",", "Carbon", "::", "now", "(", ")", "->", "format...
Make the title of the CSV @return string
[ "Make", "the", "title", "of", "the", "CSV" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Controllers/Traits/Exportable.php#L86-L94
30,741
BKWLD/decoy
classes/Observers/Encoding.php
Encoding.onSaving
public function onSaving($event, $payload) { list($model) = $payload; if (!$this->isEncodable($model)) { return; } foreach ($model->getDirtyEncodableAttributes() as $attribute) { // If the attribute has a value, encode the attribute if ($model->...
php
public function onSaving($event, $payload) { list($model) = $payload; if (!$this->isEncodable($model)) { return; } foreach ($model->getDirtyEncodableAttributes() as $attribute) { // If the attribute has a value, encode the attribute if ($model->...
[ "public", "function", "onSaving", "(", "$", "event", ",", "$", "payload", ")", "{", "list", "(", "$", "model", ")", "=", "$", "payload", ";", "if", "(", "!", "$", "this", "->", "isEncodable", "(", "$", "model", ")", ")", "{", "return", ";", "}", ...
Start a new encode if a new encodable file was uploaded @param string $event @param array $payload Contains: - Bkwld\Decoy\Models\Base $model @return void
[ "Start", "a", "new", "encode", "if", "a", "new", "encodable", "file", "was", "uploaded" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Observers/Encoding.php#L18-L38
30,742
BKWLD/decoy
classes/Observers/Encoding.php
Encoding.isEncodable
public function isEncodable($model) { if (!method_exists($model, 'getDirtyEncodableAttributes')) { return false; } if (is_a($model, 'Bkwld\Decoy\Models\Element') && $model->getAttribute('type') != 'video-encoder') { return false; } return true; }
php
public function isEncodable($model) { if (!method_exists($model, 'getDirtyEncodableAttributes')) { return false; } if (is_a($model, 'Bkwld\Decoy\Models\Element') && $model->getAttribute('type') != 'video-encoder') { return false; } return true; }
[ "public", "function", "isEncodable", "(", "$", "model", ")", "{", "if", "(", "!", "method_exists", "(", "$", "model", ",", "'getDirtyEncodableAttributes'", ")", ")", "{", "return", "false", ";", "}", "if", "(", "is_a", "(", "$", "model", ",", "'Bkwld\\De...
Check if a model should be encoded @param Bkwld\Decoy\Models\Base $model @return boolean
[ "Check", "if", "a", "model", "should", "be", "encoded" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Observers/Encoding.php#L62-L73
30,743
BKWLD/decoy
classes/Observers/Localize.php
Localize.handle
public function handle($event, $payload) { list($model) = $payload; if (!empty($model->locale) && empty($model->locale_group) && !is_a($model, Element::class) // Elements don't have groups && ($locales = Config::get('decoy.site.locales')) && c...
php
public function handle($event, $payload) { list($model) = $payload; if (!empty($model->locale) && empty($model->locale_group) && !is_a($model, Element::class) // Elements don't have groups && ($locales = Config::get('decoy.site.locales')) && c...
[ "public", "function", "handle", "(", "$", "event", ",", "$", "payload", ")", "{", "list", "(", "$", "model", ")", "=", "$", "payload", ";", "if", "(", "!", "empty", "(", "$", "model", "->", "locale", ")", "&&", "empty", "(", "$", "model", "->", ...
Called on model saving @param string $event @param array $payload Contains: - Bkwld\Decoy\Models\Base $model @return void
[ "Called", "on", "model", "saving" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Observers/Localize.php#L23-L34
30,744
BKWLD/decoy
classes/Middleware/Auth.php
Auth.dectectFromExplicitRoute
protected function dectectFromExplicitRoute() { // Get the action $action = Route::current()->getActionName(); if ($action == 'Closure') { throw new \Exception('decoy.auth requires routing to controllers.'); } // Get parse the `uses` from the route definition ...
php
protected function dectectFromExplicitRoute() { // Get the action $action = Route::current()->getActionName(); if ($action == 'Closure') { throw new \Exception('decoy.auth requires routing to controllers.'); } // Get parse the `uses` from the route definition ...
[ "protected", "function", "dectectFromExplicitRoute", "(", ")", "{", "// Get the action", "$", "action", "=", "Route", "::", "current", "(", ")", "->", "getActionName", "(", ")", ";", "if", "(", "$", "action", "==", "'Closure'", ")", "{", "throw", "new", "\...
Get the action and controller from an explicilty defined route @return array action,controller @throws Exception
[ "Get", "the", "action", "and", "controller", "from", "an", "explicilty", "defined", "route" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Middleware/Auth.php#L57-L75
30,745
BKWLD/decoy
classes/Middleware/Auth.php
Auth.dectectFromWildcardRouter
protected function dectectFromWildcardRouter() { $wildcard = App::make('decoy.wildcard'); // Attach / detach are ACL-ed by the parent controller. It's the one being // touched, $action = $wildcard->detectAction(); if (in_array($action, ['attach', 'remove'])) { $...
php
protected function dectectFromWildcardRouter() { $wildcard = App::make('decoy.wildcard'); // Attach / detach are ACL-ed by the parent controller. It's the one being // touched, $action = $wildcard->detectAction(); if (in_array($action, ['attach', 'remove'])) { $...
[ "protected", "function", "dectectFromWildcardRouter", "(", ")", "{", "$", "wildcard", "=", "App", "::", "make", "(", "'decoy.wildcard'", ")", ";", "// Attach / detach are ACL-ed by the parent controller. It's the one being", "// touched,", "$", "action", "=", "$", "wildc...
Get the action and controller from the wildcard router @return array action,controller
[ "Get", "the", "action", "and", "controller", "from", "the", "wildcard", "router" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Middleware/Auth.php#L82-L103
30,746
BKWLD/decoy
classes/Models/Admin.php
Admin.onValidating
public function onValidating($validation) { // Only apply mods when editing an existing record if (!$this->exists) { return; } $rules = self::$rules; // Make password optional $rules = array_except($rules, 'password'); // Ignore the current reco...
php
public function onValidating($validation) { // Only apply mods when editing an existing record if (!$this->exists) { return; } $rules = self::$rules; // Make password optional $rules = array_except($rules, 'password'); // Ignore the current reco...
[ "public", "function", "onValidating", "(", "$", "validation", ")", "{", "// Only apply mods when editing an existing record", "if", "(", "!", "$", "this", "->", "exists", ")", "{", "return", ";", "}", "$", "rules", "=", "self", "::", "$", "rules", ";", "// M...
Tweak some validation rules @param Illuminate\Validation\Validator $validation
[ "Tweak", "some", "validation", "rules" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Admin.php#L84-L101
30,747
BKWLD/decoy
classes/Models/Admin.php
Admin.onCreating
public function onCreating() { // Send out email if (Request::has('_send_email')) { $this->sendCreateEmail(); } // Make them active $this->active = 1; // If the current user can't grant permissions, make the new admin // have the same role as the...
php
public function onCreating() { // Send out email if (Request::has('_send_email')) { $this->sendCreateEmail(); } // Make them active $this->active = 1; // If the current user can't grant permissions, make the new admin // have the same role as the...
[ "public", "function", "onCreating", "(", ")", "{", "// Send out email", "if", "(", "Request", "::", "has", "(", "'_send_email'", ")", ")", "{", "$", "this", "->", "sendCreateEmail", "(", ")", ";", "}", "// Make them active", "$", "this", "->", "active", "=...
New admin callbacks @return void
[ "New", "admin", "callbacks" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Admin.php#L108-L129
30,748
BKWLD/decoy
classes/Models/Admin.php
Admin.onSaving
public function onSaving() { // If the password is changing, hash it if ($this->isDirty('password')) { $this->password = bcrypt($this->password); } // Save or clear permission choices if the form had a "custom permissions" // pushed checkbox if (Request::...
php
public function onSaving() { // If the password is changing, hash it if ($this->isDirty('password')) { $this->password = bcrypt($this->password); } // Save or clear permission choices if the form had a "custom permissions" // pushed checkbox if (Request::...
[ "public", "function", "onSaving", "(", ")", "{", "// If the password is changing, hash it", "if", "(", "$", "this", "->", "isDirty", "(", "'password'", ")", ")", "{", "$", "this", "->", "password", "=", "bcrypt", "(", "$", "this", "->", "password", ")", ";...
Callbacks regardless of new or old @return void
[ "Callbacks", "regardless", "of", "new", "or", "old" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Admin.php#L148-L161
30,749
BKWLD/decoy
classes/Models/Admin.php
Admin.sendUpdateEmail
public function sendUpdateEmail() { // Prepare data for mail $admin = app('decoy.user'); $email = [ 'editor_first_name' => $admin->first_name, 'editor_last_name' => $admin->last_name, 'first_name' =>request('first_name'), 'last_name' =>request(...
php
public function sendUpdateEmail() { // Prepare data for mail $admin = app('decoy.user'); $email = [ 'editor_first_name' => $admin->first_name, 'editor_last_name' => $admin->last_name, 'first_name' =>request('first_name'), 'last_name' =>request(...
[ "public", "function", "sendUpdateEmail", "(", ")", "{", "// Prepare data for mail", "$", "admin", "=", "app", "(", "'decoy.user'", ")", ";", "$", "email", "=", "[", "'editor_first_name'", "=>", "$", "admin", "->", "first_name", ",", "'editor_last_name'", "=>", ...
Send update email @return void
[ "Send", "update", "email" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Admin.php#L193-L213
30,750
BKWLD/decoy
classes/Models/Admin.php
Admin.shouldLogChange
public function shouldLogChange($action) { if ($action != 'deleted' && count($this->getDirty()) == 1 && $this->isDirty('remember_token')) { return false; } return parent::shouldLogChange($action); }
php
public function shouldLogChange($action) { if ($action != 'deleted' && count($this->getDirty()) == 1 && $this->isDirty('remember_token')) { return false; } return parent::shouldLogChange($action); }
[ "public", "function", "shouldLogChange", "(", "$", "action", ")", "{", "if", "(", "$", "action", "!=", "'deleted'", "&&", "count", "(", "$", "this", "->", "getDirty", "(", ")", ")", "==", "1", "&&", "$", "this", "->", "isDirty", "(", "'remember_token'"...
Don't log if admin is logging in and out @param string $action @return boolean
[ "Don", "t", "log", "if", "admin", "is", "logging", "in", "and", "out" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Admin.php#L259-L267
30,751
BKWLD/decoy
classes/Models/Admin.php
Admin.getAdminStatusAttribute
public function getAdminStatusAttribute() { $html =''; // Add the role if (($roles = static::getRoleTitles()) && count($roles)) { $html .= '<span class="label label-primary">'.$roles[$this->role].'</span>'; } // If row is you if ($this->id == app('decoy....
php
public function getAdminStatusAttribute() { $html =''; // Add the role if (($roles = static::getRoleTitles()) && count($roles)) { $html .= '<span class="label label-primary">'.$roles[$this->role].'</span>'; } // If row is you if ($this->id == app('decoy....
[ "public", "function", "getAdminStatusAttribute", "(", ")", "{", "$", "html", "=", "''", ";", "// Add the role", "if", "(", "(", "$", "roles", "=", "static", "::", "getRoleTitles", "(", ")", ")", "&&", "count", "(", "$", "roles", ")", ")", "{", "$", "...
Show a badge if the user is the currently logged in @return string
[ "Show", "a", "badge", "if", "the", "user", "is", "the", "currently", "logged", "in" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Admin.php#L319-L342
30,752
BKWLD/decoy
classes/Models/Admin.php
Admin.getPermissionOptions
public static function getPermissionOptions($admin = null) { // Get all the app controllers $controllers = array_map(function($path) { return 'App\Http\Controllers\Admin\\'.basename($path, '.php'); }, glob(app_path('/Http/Controllers/Admin/*.php'))); // Add some Decoy co...
php
public static function getPermissionOptions($admin = null) { // Get all the app controllers $controllers = array_map(function($path) { return 'App\Http\Controllers\Admin\\'.basename($path, '.php'); }, glob(app_path('/Http/Controllers/Admin/*.php'))); // Add some Decoy co...
[ "public", "static", "function", "getPermissionOptions", "(", "$", "admin", "=", "null", ")", "{", "// Get all the app controllers", "$", "controllers", "=", "array_map", "(", "function", "(", "$", "path", ")", "{", "return", "'App\\Http\\Controllers\\Admin\\\\'", "....
Get the list of all permissions @param Admin|null $admin @return array
[ "Get", "the", "list", "of", "all", "permissions" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Admin.php#L391-L451
30,753
BKWLD/decoy
classes/Models/Traits/SerializeWithImages.php
SerializeWithImages.withDefaultImage
public function withDefaultImage( $width = null, $height = null, $options = null) { $this->withRenamedImage(null, null, $width, $height, $options); return $this; }
php
public function withDefaultImage( $width = null, $height = null, $options = null) { $this->withRenamedImage(null, null, $width, $height, $options); return $this; }
[ "public", "function", "withDefaultImage", "(", "$", "width", "=", "null", ",", "$", "height", "=", "null", ",", "$", "options", "=", "null", ")", "{", "$", "this", "->", "withRenamedImage", "(", "null", ",", "null", ",", "$", "width", ",", "$", "heig...
Convenience method for adding the default, null, named image crop @param integer $width @param integer $height @param array $options @return $this
[ "Convenience", "method", "for", "adding", "the", "default", "null", "named", "image", "crop" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/SerializeWithImages.php#L24-L32
30,754
BKWLD/decoy
classes/Models/Traits/SerializeWithImages.php
SerializeWithImages.withImage
public function withImage( $name = null, $width = null, $height = null, $options = null) { $this->withRenamedImage($name, $name, $width, $height, $options); return $this; }
php
public function withImage( $name = null, $width = null, $height = null, $options = null) { $this->withRenamedImage($name, $name, $width, $height, $options); return $this; }
[ "public", "function", "withImage", "(", "$", "name", "=", "null", ",", "$", "width", "=", "null", ",", "$", "height", "=", "null", ",", "$", "options", "=", "null", ")", "{", "$", "this", "->", "withRenamedImage", "(", "$", "name", ",", "$", "name"...
Convenience method for specifying the name of the image to add @param string $name @param integer $width @param integer $height @param array $options @return $this
[ "Convenience", "method", "for", "specifying", "the", "name", "of", "the", "image", "to", "add" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/SerializeWithImages.php#L43-L52
30,755
BKWLD/decoy
classes/Models/Traits/SerializeWithImages.php
SerializeWithImages.withRenamedImage
public function withRenamedImage( $name = null, $property = null, $width = null, $height = null, $options = null) { // The json needs a property name if (empty($property)) { $property = 'default'; } // Add a transform that adds and...
php
public function withRenamedImage( $name = null, $property = null, $width = null, $height = null, $options = null) { // The json needs a property name if (empty($property)) { $property = 'default'; } // Add a transform that adds and...
[ "public", "function", "withRenamedImage", "(", "$", "name", "=", "null", ",", "$", "property", "=", "null", ",", "$", "width", "=", "null", ",", "$", "height", "=", "null", ",", "$", "options", "=", "null", ")", "{", "// The json needs a property name", ...
Add an Image instance with the provided crop in instructions to every item in the collection. @param string $name The `name` attribute to look for in Images @param string $property The property name to use in the JSON output @param integer $width @param integer $height @param array $options @return $this ...
[ "Add", "an", "Image", "instance", "with", "the", "provided", "crop", "in", "instructions", "to", "every", "item", "in", "the", "collection", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/SerializeWithImages.php#L67-L130
30,756
BKWLD/decoy
classes/Models/Traits/SerializeWithImages.php
SerializeWithImages.getRelatedModelsWithImages
protected function getRelatedModelsWithImages($parents, $relation) { $models = []; foreach ($parents as $parent) { // Get the related object $related = $parent->$relation; // The related object is a model (like in a belongsTo setup), add it to // the...
php
protected function getRelatedModelsWithImages($parents, $relation) { $models = []; foreach ($parents as $parent) { // Get the related object $related = $parent->$relation; // The related object is a model (like in a belongsTo setup), add it to // the...
[ "protected", "function", "getRelatedModelsWithImages", "(", "$", "parents", ",", "$", "relation", ")", "{", "$", "models", "=", "[", "]", ";", "foreach", "(", "$", "parents", "as", "$", "parent", ")", "{", "// Get the related object", "$", "related", "=", ...
Take an array of parent models and return a new array of the children of all parents in one array @param array $parents Array of eloquent models @param string $relation Relation name @return array
[ "Take", "an", "array", "of", "parent", "models", "and", "return", "a", "new", "array", "of", "the", "children", "of", "all", "parents", "in", "one", "array" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/SerializeWithImages.php#L140-L162
30,757
BKWLD/decoy
classes/Models/Change.php
Change.log
public static function log(Model $model, $action, Admin $admin = null) { // Create a new change instance if (static::shouldWriteChange($model, $action)) { $changed = static::getChanged($model, $action); $change = static::createLog($model, $action, $admin, $changed); }...
php
public static function log(Model $model, $action, Admin $admin = null) { // Create a new change instance if (static::shouldWriteChange($model, $action)) { $changed = static::getChanged($model, $action); $change = static::createLog($model, $action, $admin, $changed); }...
[ "public", "static", "function", "log", "(", "Model", "$", "model", ",", "$", "action", ",", "Admin", "$", "admin", "=", "null", ")", "{", "// Create a new change instance", "if", "(", "static", "::", "shouldWriteChange", "(", "$", "model", ",", "$", "actio...
A convenience method for saving a change instance @param Model $model The model being touched @param string $action Generally a CRUD verb: "created", "updated", "deleted" @param Admin $admin The admin acting on the record @return static|void
[ "A", "convenience", "method", "for", "saving", "a", "change", "instance" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L96-L120
30,758
BKWLD/decoy
classes/Models/Change.php
Change.shouldWriteChange
static private function shouldWriteChange(Model $model, $action) { if (in_array($action, ['created', 'deleted'])) return true; $changed_attributes = array_keys($model->getDirty()); $ignored = ['updated_at', 'public']; $loggable = array_diff($changed_attributes, $ignored); ret...
php
static private function shouldWriteChange(Model $model, $action) { if (in_array($action, ['created', 'deleted'])) return true; $changed_attributes = array_keys($model->getDirty()); $ignored = ['updated_at', 'public']; $loggable = array_diff($changed_attributes, $ignored); ret...
[ "static", "private", "function", "shouldWriteChange", "(", "Model", "$", "model", ",", "$", "action", ")", "{", "if", "(", "in_array", "(", "$", "action", ",", "[", "'created'", ",", "'deleted'", "]", ")", ")", "return", "true", ";", "$", "changed_attrib...
Don't log changes when the only thing that changed was the published state or updated timestamp. We check if there are any attributes besides these that changed. @param Model $model The model being touched @param string $action @return boolean
[ "Don", "t", "log", "changes", "when", "the", "only", "thing", "that", "changed", "was", "the", "published", "state", "or", "updated", "timestamp", ".", "We", "check", "if", "there", "are", "any", "attributes", "besides", "these", "that", "changed", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L131-L138
30,759
BKWLD/decoy
classes/Models/Change.php
Change.getChanged
static private function getChanged(Model $model, $action) { $changed = $model->getDirty(); if ($action == 'deleted' || empty($changed)) { $changed = null; } return $changed; }
php
static private function getChanged(Model $model, $action) { $changed = $model->getDirty(); if ($action == 'deleted' || empty($changed)) { $changed = null; } return $changed; }
[ "static", "private", "function", "getChanged", "(", "Model", "$", "model", ",", "$", "action", ")", "{", "$", "changed", "=", "$", "model", "->", "getDirty", "(", ")", ";", "if", "(", "$", "action", "==", "'deleted'", "||", "empty", "(", "$", "change...
Get the changes attributes @param Model $model The model being touched @param string $action @return array|null
[ "Get", "the", "changes", "attributes" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L147-L154
30,760
BKWLD/decoy
classes/Models/Change.php
Change.createLog
static protected function createLog( Model $model, $action, Admin $admin = null, $changed = null) { return static::create([ 'model' => get_class($model), 'key' => $model->getKey(), 'action' => $action, 'title' => static::getMode...
php
static protected function createLog( Model $model, $action, Admin $admin = null, $changed = null) { return static::create([ 'model' => get_class($model), 'key' => $model->getKey(), 'action' => $action, 'title' => static::getMode...
[ "static", "protected", "function", "createLog", "(", "Model", "$", "model", ",", "$", "action", ",", "Admin", "$", "admin", "=", "null", ",", "$", "changed", "=", "null", ")", "{", "return", "static", "::", "create", "(", "[", "'model'", "=>", "get_cla...
Create a change entry @param Model $model Th @param string $action @param Admin $admin
[ "Create", "a", "change", "entry" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L163-L177
30,761
BKWLD/decoy
classes/Models/Change.php
Change.getAdminId
static protected function getAdminId(Admin $admin = null) { if (!$admin) { $admin = app('decoy.user'); } return $admin ? $admin->getKey() : null; }
php
static protected function getAdminId(Admin $admin = null) { if (!$admin) { $admin = app('decoy.user'); } return $admin ? $admin->getKey() : null; }
[ "static", "protected", "function", "getAdminId", "(", "Admin", "$", "admin", "=", "null", ")", "{", "if", "(", "!", "$", "admin", ")", "{", "$", "admin", "=", "app", "(", "'decoy.user'", ")", ";", "}", "return", "$", "admin", "?", "$", "admin", "->...
Get the admin id @param Admin $admin @return integer
[ "Get", "the", "admin", "id" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L197-L203
30,762
BKWLD/decoy
classes/Models/Change.php
Change.logPublishingChange
static public function logPublishingChange( Model $model, $action, Admin $admin = null) { if ($model->isDirty('public')) { if ($model->public) { static::createLog($model, 'published', $admin); } else if (!$model->public && $action != 'created')...
php
static public function logPublishingChange( Model $model, $action, Admin $admin = null) { if ($model->isDirty('public')) { if ($model->public) { static::createLog($model, 'published', $admin); } else if (!$model->public && $action != 'created')...
[ "static", "public", "function", "logPublishingChange", "(", "Model", "$", "model", ",", "$", "action", ",", "Admin", "$", "admin", "=", "null", ")", "{", "if", "(", "$", "model", "->", "isDirty", "(", "'public'", ")", ")", "{", "if", "(", "$", "model...
Log changes to publishing state. The initial publish should be logged but not an initil unpublished state. @param Model $model @param string $action @param Admin $admin @return void
[ "Log", "changes", "to", "publishing", "state", ".", "The", "initial", "publish", "should", "be", "logged", "but", "not", "an", "initil", "unpublished", "state", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L214-L226
30,763
BKWLD/decoy
classes/Models/Change.php
Change.getAdminTitleHtmlAttribute
public function getAdminTitleHtmlAttribute() { return __('decoy::changes.admin_title', [ 'admin' => $this->getAdminLinkAttribute(), 'action' => $this->getActionLabelAttribute(), 'model' => $this->getModelNameHtmlAttribute(), 'model_title' => $this->getLinkedTi...
php
public function getAdminTitleHtmlAttribute() { return __('decoy::changes.admin_title', [ 'admin' => $this->getAdminLinkAttribute(), 'action' => $this->getActionLabelAttribute(), 'model' => $this->getModelNameHtmlAttribute(), 'model_title' => $this->getLinkedTi...
[ "public", "function", "getAdminTitleHtmlAttribute", "(", ")", "{", "return", "__", "(", "'decoy::changes.admin_title'", ",", "[", "'admin'", "=>", "$", "this", "->", "getAdminLinkAttribute", "(", ")", ",", "'action'", "=>", "$", "this", "->", "getActionLabelAttrib...
Format the the activity like a sentence @return string HTML
[ "Format", "the", "the", "activity", "like", "a", "sentence" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L257-L266
30,764
BKWLD/decoy
classes/Models/Change.php
Change.getAdminLinkAttribute
public function getAdminLinkAttribute() { if ($this->admin_id) { return sprintf('<a href="%s">%s</a>', $this->filterUrl(['admin_id' => $this->admin_id]), $this->admin->getAdminTitleHtmlAttribute()); } else { return 'Someone'; } }
php
public function getAdminLinkAttribute() { if ($this->admin_id) { return sprintf('<a href="%s">%s</a>', $this->filterUrl(['admin_id' => $this->admin_id]), $this->admin->getAdminTitleHtmlAttribute()); } else { return 'Someone'; } }
[ "public", "function", "getAdminLinkAttribute", "(", ")", "{", "if", "(", "$", "this", "->", "admin_id", ")", "{", "return", "sprintf", "(", "'<a href=\"%s\">%s</a>'", ",", "$", "this", "->", "filterUrl", "(", "[", "'admin_id'", "=>", "$", "this", "->", "ad...
Get the admin name and link @return string HTML
[ "Get", "the", "admin", "name", "and", "link" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L273-L282
30,765
BKWLD/decoy
classes/Models/Change.php
Change.getActionLabelAttribute
public function getActionLabelAttribute() { $map = [ 'created' => 'success', 'updated' => 'warning', 'deleted' => 'danger', 'published' => 'info', 'unpublished' => 'default', ]; return sprintf('<a href="%s" class="label label-%s">%...
php
public function getActionLabelAttribute() { $map = [ 'created' => 'success', 'updated' => 'warning', 'deleted' => 'danger', 'published' => 'info', 'unpublished' => 'default', ]; return sprintf('<a href="%s" class="label label-%s">%...
[ "public", "function", "getActionLabelAttribute", "(", ")", "{", "$", "map", "=", "[", "'created'", "=>", "'success'", ",", "'updated'", "=>", "'warning'", ",", "'deleted'", "=>", "'danger'", ",", "'published'", "=>", "'info'", ",", "'unpublished'", "=>", "'def...
Format the activity as a colored label @return string HTML
[ "Format", "the", "activity", "as", "a", "colored", "label" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L289-L303
30,766
BKWLD/decoy
classes/Models/Change.php
Change.getModelNameHtmlAttribute
public function getModelNameHtmlAttribute() { $class = Decoy::controllerForModel($this->model); // There is not a controller for the model if (!$class || !class_exists($class)) { return sprintf('<b><a href="%s">%s</a></b>', $this->filterUrl(['model' => $this->model])...
php
public function getModelNameHtmlAttribute() { $class = Decoy::controllerForModel($this->model); // There is not a controller for the model if (!$class || !class_exists($class)) { return sprintf('<b><a href="%s">%s</a></b>', $this->filterUrl(['model' => $this->model])...
[ "public", "function", "getModelNameHtmlAttribute", "(", ")", "{", "$", "class", "=", "Decoy", "::", "controllerForModel", "(", "$", "this", "->", "model", ")", ";", "// There is not a controller for the model", "if", "(", "!", "$", "class", "||", "!", "class_exi...
Format the model name by translating it through the controllers's defined title @return string HTML
[ "Format", "the", "model", "name", "by", "translating", "it", "through", "the", "controllers", "s", "defined", "title" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L311-L328
30,767
BKWLD/decoy
classes/Models/Change.php
Change.getLinkedTitleAttribute
public function getLinkedTitleAttribute() { if (!$this->title) return; return sprintf('<a href="%s">"%s"</a>', $this->filterUrl(['model' => $this->model, 'key' => $this->key]), $this->title); }
php
public function getLinkedTitleAttribute() { if (!$this->title) return; return sprintf('<a href="%s">"%s"</a>', $this->filterUrl(['model' => $this->model, 'key' => $this->key]), $this->title); }
[ "public", "function", "getLinkedTitleAttribute", "(", ")", "{", "if", "(", "!", "$", "this", "->", "title", ")", "return", ";", "return", "sprintf", "(", "'<a href=\"%s\">\"%s\"</a>'", ",", "$", "this", "->", "filterUrl", "(", "[", "'model'", "=>", "$", "t...
Get the title of the model. Perhaps in the future there will be more smarts here, like generating a link to the edit view @return string HTML
[ "Get", "the", "title", "of", "the", "model", ".", "Perhaps", "in", "the", "future", "there", "will", "be", "more", "smarts", "here", "like", "generating", "a", "link", "to", "the", "edit", "view" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L336-L342
30,768
BKWLD/decoy
classes/Models/Change.php
Change.getDateAttribute
public function getDateAttribute() { \Carbon\Carbon::setLocale(Decoy::locale()); return sprintf('<a href="%s" class="js-tooltip" title="%s">%s</a>', $this->filterUrl(['created_at' => $this->created_at->format('m/d/Y')]), $this->getHumanDateAttribute(), $this->crea...
php
public function getDateAttribute() { \Carbon\Carbon::setLocale(Decoy::locale()); return sprintf('<a href="%s" class="js-tooltip" title="%s">%s</a>', $this->filterUrl(['created_at' => $this->created_at->format('m/d/Y')]), $this->getHumanDateAttribute(), $this->crea...
[ "public", "function", "getDateAttribute", "(", ")", "{", "\\", "Carbon", "\\", "Carbon", "::", "setLocale", "(", "Decoy", "::", "locale", "(", ")", ")", ";", "return", "sprintf", "(", "'<a href=\"%s\" class=\"js-tooltip\" title=\"%s\">%s</a>'", ",", "$", "this", ...
Get the date of the change @return string HTML
[ "Get", "the", "date", "of", "the", "change" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L349-L356
30,769
BKWLD/decoy
classes/Models/Change.php
Change.getFilterActionAttribute
public function getFilterActionAttribute() { return sprintf('<a href="%s" class="glyphicon glyphicon-filter js-tooltip" title="' . __('decoy::changes.standard_list.filter') . '" data-placement="left"></a>', $this->filterUrl(['model' => $this->model, 'key' => $...
php
public function getFilterActionAttribute() { return sprintf('<a href="%s" class="glyphicon glyphicon-filter js-tooltip" title="' . __('decoy::changes.standard_list.filter') . '" data-placement="left"></a>', $this->filterUrl(['model' => $this->model, 'key' => $...
[ "public", "function", "getFilterActionAttribute", "(", ")", "{", "return", "sprintf", "(", "'<a href=\"%s\"\n class=\"glyphicon glyphicon-filter js-tooltip\"\n title=\"'", ".", "__", "(", "'decoy::changes.standard_list.filter'", ")", ".", "'\"\n data-...
Make the preview filter icon @return string
[ "Make", "the", "preview", "filter", "icon" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L388-L396
30,770
BKWLD/decoy
classes/Models/Change.php
Change.getChangesActionAttribute
public function getChangesActionAttribute() { // If there are changes, add the modal button if ($this->changed) { return sprintf('<a href="%s" class="glyphicon glyphicon-export js-tooltip changes-modal-link" title="%s" data-placement="left"></a>', ...
php
public function getChangesActionAttribute() { // If there are changes, add the modal button if ($this->changed) { return sprintf('<a href="%s" class="glyphicon glyphicon-export js-tooltip changes-modal-link" title="%s" data-placement="left"></a>', ...
[ "public", "function", "getChangesActionAttribute", "(", ")", "{", "// If there are changes, add the modal button", "if", "(", "$", "this", "->", "changed", ")", "{", "return", "sprintf", "(", "'<a href=\"%s\"\n class=\"glyphicon glyphicon-export js-tooltip changes-...
Make the changes icon @return string
[ "Make", "the", "changes", "icon" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L413-L430
30,771
BKWLD/decoy
classes/Models/Change.php
Change.getPreviewActionAttribute
public function getPreviewActionAttribute() { if ($this->changedModel && $this->changedModel->uri && $this->action != 'deleted') { return sprintf('<a href="%s" target="_blank" class="glyphicon glyphicon-bookmark js-tooltip" title="%s" data-...
php
public function getPreviewActionAttribute() { if ($this->changedModel && $this->changedModel->uri && $this->action != 'deleted') { return sprintf('<a href="%s" target="_blank" class="glyphicon glyphicon-bookmark js-tooltip" title="%s" data-...
[ "public", "function", "getPreviewActionAttribute", "(", ")", "{", "if", "(", "$", "this", "->", "changedModel", "&&", "$", "this", "->", "changedModel", "->", "uri", "&&", "$", "this", "->", "action", "!=", "'deleted'", ")", "{", "return", "sprintf", "(", ...
Make link to preview a version as long as the model has a URI and the action wasn't a delete action. @return string
[ "Make", "link", "to", "preview", "a", "version", "as", "long", "as", "the", "model", "has", "a", "URI", "and", "the", "action", "wasn", "t", "a", "delete", "action", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L438-L451
30,772
BKWLD/decoy
classes/Models/Change.php
Change.attributesForModal
public function attributesForModal() { // Remove some specific attributes. Leaving empties in there so the updating // of values to NULL is displayed. $attributes = array_except($this->changed, [ 'id', 'updated_at', 'created_at', 'password', 'remember_token', ]); ...
php
public function attributesForModal() { // Remove some specific attributes. Leaving empties in there so the updating // of values to NULL is displayed. $attributes = array_except($this->changed, [ 'id', 'updated_at', 'created_at', 'password', 'remember_token', ]); ...
[ "public", "function", "attributesForModal", "(", ")", "{", "// Remove some specific attributes. Leaving empties in there so the updating", "// of values to NULL is displayed.", "$", "attributes", "=", "array_except", "(", "$", "this", "->", "changed", ",", "[", "'id'", ",", ...
Get just the attributes that should be displayed in the admin modal. @return array
[ "Get", "just", "the", "attributes", "that", "should", "be", "displayed", "in", "the", "admin", "modal", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Change.php#L472-L487
30,773
BKWLD/decoy
classes/Models/Traits/HasImages.php
HasImages.croppedImages
public function croppedImages($width = null, $height = null, $options = null) { return array_combine( // Keys $this->images->map(function ($image) { return $image->name ?: 'default'; })->toArray(), // Values $this->images->map(fun...
php
public function croppedImages($width = null, $height = null, $options = null) { return array_combine( // Keys $this->images->map(function ($image) { return $image->name ?: 'default'; })->toArray(), // Values $this->images->map(fun...
[ "public", "function", "croppedImages", "(", "$", "width", "=", "null", ",", "$", "height", "=", "null", ",", "$", "options", "=", "null", ")", "{", "return", "array_combine", "(", "// Keys", "$", "this", "->", "images", "->", "map", "(", "function", "(...
Return an array of all images associated with the model, keyed by their name, while optionally applying a crop to them
[ "Return", "an", "array", "of", "all", "images", "associated", "with", "the", "model", "keyed", "by", "their", "name", "while", "optionally", "applying", "a", "crop", "to", "them" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/HasImages.php#L92-L106
30,774
BKWLD/decoy
classes/Models/Traits/HasImages.php
HasImages.appendToImgs
public function appendToImgs(Image $image, $property) { // Create or fetch the container for all images on the model. The // container could not be "images" because that is used by the // relationship function and leads to trouble. if (!$this->getAttribute('imgs')) { $img...
php
public function appendToImgs(Image $image, $property) { // Create or fetch the container for all images on the model. The // container could not be "images" because that is used by the // relationship function and leads to trouble. if (!$this->getAttribute('imgs')) { $img...
[ "public", "function", "appendToImgs", "(", "Image", "$", "image", ",", "$", "property", ")", "{", "// Create or fetch the container for all images on the model. The", "// container could not be \"images\" because that is used by the", "// relationship function and leads to trouble.", "...
Add an Image to the `imgs` attribute of the model for the purpose of exposing it when serialized. @param Image $image @param string $property @return $this
[ "Add", "an", "Image", "to", "the", "imgs", "attribute", "of", "the", "model", "for", "the", "purpose", "of", "exposing", "it", "when", "serialized", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/HasImages.php#L116-L138
30,775
BKWLD/decoy
classes/Routing/Router.php
Router.registerAll
public function registerAll() { // Public routes Route::group([ 'prefix' => $this->dir, 'middleware' => 'decoy.public', ], function () { $this->registerLogin(); $this->registerResetPassword(); }); // Routes that don't require a...
php
public function registerAll() { // Public routes Route::group([ 'prefix' => $this->dir, 'middleware' => 'decoy.public', ], function () { $this->registerLogin(); $this->registerResetPassword(); }); // Routes that don't require a...
[ "public", "function", "registerAll", "(", ")", "{", "// Public routes", "Route", "::", "group", "(", "[", "'prefix'", "=>", "$", "this", "->", "dir", ",", "'middleware'", "=>", "'decoy.public'", ",", "]", ",", "function", "(", ")", "{", "$", "this", "->"...
Register all routes @return void
[ "Register", "all", "routes" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Router.php#L43-L75
30,776
BKWLD/decoy
classes/Routing/Router.php
Router.registerWildcard
public function registerWildcard() { // Setup a wildcarded catch all route Route::any('{path}', ['as' => 'decoy::wildcard', function ($path) { // Remember the detected route App::make('events')->listen('wildcard.detection', function ($controller, $action) { $...
php
public function registerWildcard() { // Setup a wildcarded catch all route Route::any('{path}', ['as' => 'decoy::wildcard', function ($path) { // Remember the detected route App::make('events')->listen('wildcard.detection', function ($controller, $action) { $...
[ "public", "function", "registerWildcard", "(", ")", "{", "// Setup a wildcarded catch all route", "Route", "::", "any", "(", "'{path}'", ",", "[", "'as'", "=>", "'decoy::wildcard'", ",", "function", "(", "$", "path", ")", "{", "// Remember the detected route", "App"...
Setup wilcard routing @return void
[ "Setup", "wilcard", "routing" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Router.php#L129-L149
30,777
BKWLD/decoy
classes/Routing/Router.php
Router.action
public function action($name = null) { if ($name) { $this->action = $name; } if ($this->action) { return $this->action; } // Wildcard return Route::currentRouteAction(); }
php
public function action($name = null) { if ($name) { $this->action = $name; } if ($this->action) { return $this->action; } // Wildcard return Route::currentRouteAction(); }
[ "public", "function", "action", "(", "$", "name", "=", "null", ")", "{", "if", "(", "$", "name", ")", "{", "$", "this", "->", "action", "=", "$", "name", ";", "}", "if", "(", "$", "this", "->", "action", ")", "{", "return", "$", "this", "->", ...
Set and get the action for this request @return string '\Bkwld\Decoy\Controllers\Account@forgot'
[ "Set", "and", "get", "the", "action", "for", "this", "request" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Router.php#L275-L287
30,778
BKWLD/decoy
classes/Input/Position.php
Position.has
public function has() { if (!Request::has('position')) { return false; } if (isset($this->item->position)) { return true; } if (!empty($this->pivot) && isset($this->pivot->position)) { return true; } return false; }
php
public function has() { if (!Request::has('position')) { return false; } if (isset($this->item->position)) { return true; } if (!empty($this->pivot) && isset($this->pivot->position)) { return true; } return false; }
[ "public", "function", "has", "(", ")", "{", "if", "(", "!", "Request", "::", "has", "(", "'position'", ")", ")", "{", "return", "false", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "item", "->", "position", ")", ")", "{", "return", "tru...
Check if we have all dependencies for an position change
[ "Check", "if", "we", "have", "all", "dependencies", "for", "an", "position", "change" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/Position.php#L36-L51
30,779
BKWLD/decoy
classes/Input/Position.php
Position.fill
public function fill() { // Write the position value to the pivot table if (isset($this->pivot->position)) { $this->pivot->position = request('position'); $this->pivot->save(); // Write position value to the item } elseif (isset($this->item->position)) { ...
php
public function fill() { // Write the position value to the pivot table if (isset($this->pivot->position)) { $this->pivot->position = request('position'); $this->pivot->save(); // Write position value to the item } elseif (isset($this->item->position)) { ...
[ "public", "function", "fill", "(", ")", "{", "// Write the position value to the pivot table", "if", "(", "isset", "(", "$", "this", "->", "pivot", "->", "position", ")", ")", "{", "$", "this", "->", "pivot", "->", "position", "=", "request", "(", "'position...
Set new position
[ "Set", "new", "position" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/Position.php#L56-L74
30,780
BKWLD/decoy
classes/Fields/Traits/CaptureHelp.php
CaptureHelp.help
public function help($help, $attributes = []) { $this->help = $help; return parent::help($help, $attributes); }
php
public function help($help, $attributes = []) { $this->help = $help; return parent::help($help, $attributes); }
[ "public", "function", "help", "(", "$", "help", ",", "$", "attributes", "=", "[", "]", ")", "{", "$", "this", "->", "help", "=", "$", "help", ";", "return", "parent", "::", "help", "(", "$", "help", ",", "$", "attributes", ")", ";", "}" ]
Store the help locally @param string $help The help text @param array $attributes Facultative attributes @return $this
[ "Store", "the", "help", "locally" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/Traits/CaptureHelp.php#L32-L37
30,781
BKWLD/decoy
classes/Fields/Traits/CaptureHelp.php
CaptureHelp.blockhelp
public function blockhelp($help, $attributes = []) { $this->blockhelp = $help; return parent::help($help, $attributes); }
php
public function blockhelp($help, $attributes = []) { $this->blockhelp = $help; return parent::help($help, $attributes); }
[ "public", "function", "blockhelp", "(", "$", "help", ",", "$", "attributes", "=", "[", "]", ")", "{", "$", "this", "->", "blockhelp", "=", "$", "help", ";", "return", "parent", "::", "help", "(", "$", "help", ",", "$", "attributes", ")", ";", "}" ]
Store the block help locally @param string $help The help text @param array $attributes Facultative attributes @return $this
[ "Store", "the", "block", "help", "locally" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/Traits/CaptureHelp.php#L46-L51
30,782
BKWLD/decoy
classes/Middleware/Guest.php
Guest.getHome
public function getHome() { // Vars $config = config('decoy.site.post_login_redirect'); $auth = app('decoy.user'); // Make the config optional if ($config) { // Support the config being a colsure if (is_callable($config)) { $config = ...
php
public function getHome() { // Vars $config = config('decoy.site.post_login_redirect'); $auth = app('decoy.user'); // Make the config optional if ($config) { // Support the config being a colsure if (is_callable($config)) { $config = ...
[ "public", "function", "getHome", "(", ")", "{", "// Vars", "$", "config", "=", "config", "(", "'decoy.site.post_login_redirect'", ")", ";", "$", "auth", "=", "app", "(", "'decoy.user'", ")", ";", "// Make the config optional", "if", "(", "$", "config", ")", ...
Determine what the dashboard URL should be, where the user is redirected after login. @return string
[ "Determine", "what", "the", "dashboard", "URL", "should", "be", "where", "the", "user", "is", "redirected", "after", "login", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Middleware/Guest.php#L37-L67
30,783
BKWLD/decoy
classes/Middleware/Guest.php
Guest.getNavUrls
public function getNavUrls($nav = null) { // If no nav passed, as it would be for a sub navs, get the configed nav if (empty($nav)) { $nav = config('decoy.site.nav'); } // Allow for the nav to be acallable if (is_callable($nav)) { $nav = call_user_fun...
php
public function getNavUrls($nav = null) { // If no nav passed, as it would be for a sub navs, get the configed nav if (empty($nav)) { $nav = config('decoy.site.nav'); } // Allow for the nav to be acallable if (is_callable($nav)) { $nav = call_user_fun...
[ "public", "function", "getNavUrls", "(", "$", "nav", "=", "null", ")", "{", "// If no nav passed, as it would be for a sub navs, get the configed nav", "if", "(", "empty", "(", "$", "nav", ")", ")", "{", "$", "nav", "=", "config", "(", "'decoy.site.nav'", ")", "...
Return a flat list of all the URLs in the nav. This doesn't include ones automatically added by Decoy @param array $nav @return array
[ "Return", "a", "flat", "list", "of", "all", "the", "URLs", "in", "the", "nav", ".", "This", "doesn", "t", "include", "ones", "automatically", "added", "by", "Decoy" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Middleware/Guest.php#L76-L99
30,784
BKWLD/decoy
classes/Fields/VideoEncoder.php
VideoEncoder.wrapAndRender
public function wrapAndRender() { // Check if the model has encodings if (($item = $this->getModel()) && method_exists($item, 'encodings')) { // If so, get it's encoding model instance $this->encoding = $item->encodings() ->where('encodable_attribute', $this-...
php
public function wrapAndRender() { // Check if the model has encodings if (($item = $this->getModel()) && method_exists($item, 'encodings')) { // If so, get it's encoding model instance $this->encoding = $item->encodings() ->where('encodable_attribute', $this-...
[ "public", "function", "wrapAndRender", "(", ")", "{", "// Check if the model has encodings", "if", "(", "(", "$", "item", "=", "$", "this", "->", "getModel", "(", ")", ")", "&&", "method_exists", "(", "$", "item", ",", "'encodings'", ")", ")", "{", "// If ...
Prints out the field, wrapped in its group. @return string
[ "Prints", "out", "the", "field", "wrapped", "in", "its", "group", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/VideoEncoder.php#L101-L119
30,785
BKWLD/decoy
classes/Fields/VideoEncoder.php
VideoEncoder.renderPresets
protected function renderPresets() { // Create the dropdown menu options $config = config('decoy.encode.presets'); $presets = array_keys($config); $dropdown = implode('', array_map(function ($config, $preset) { return '<li> <a href="#" data-val="'.$preset....
php
protected function renderPresets() { // Create the dropdown menu options $config = config('decoy.encode.presets'); $presets = array_keys($config); $dropdown = implode('', array_map(function ($config, $preset) { return '<li> <a href="#" data-val="'.$preset....
[ "protected", "function", "renderPresets", "(", ")", "{", "// Create the dropdown menu options", "$", "config", "=", "config", "(", "'decoy.encode.presets'", ")", ";", "$", "presets", "=", "array_keys", "(", "$", "config", ")", ";", "$", "dropdown", "=", "implode...
Render the presets select menu @return string
[ "Render", "the", "presets", "select", "menu" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/VideoEncoder.php#L126-L158
30,786
BKWLD/decoy
classes/Fields/VideoEncoder.php
VideoEncoder.presetValue
protected function presetValue() { if ($this->encoding) { return $this->encoding->preset; } if ($this->preset) { return $this->preset; } return array_keys(config('decoy.encode.presets'))[0]; }
php
protected function presetValue() { if ($this->encoding) { return $this->encoding->preset; } if ($this->preset) { return $this->preset; } return array_keys(config('decoy.encode.presets'))[0]; }
[ "protected", "function", "presetValue", "(", ")", "{", "if", "(", "$", "this", "->", "encoding", ")", "{", "return", "$", "this", "->", "encoding", "->", "preset", ";", "}", "if", "(", "$", "this", "->", "preset", ")", "{", "return", "$", "this", "...
Get the preset value @return string
[ "Get", "the", "preset", "value" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/VideoEncoder.php#L165-L176
30,787
BKWLD/decoy
classes/Fields/VideoEncoder.php
VideoEncoder.renderIndestructibleReview
protected function renderIndestructibleReview() { if ($this->encoding && $this->encoding->status == 'complete') { return $this->renderPlayerOrStatus(); } return $this->renderPlayerOrStatus().parent::renderIndestructibleReview(); }
php
protected function renderIndestructibleReview() { if ($this->encoding && $this->encoding->status == 'complete') { return $this->renderPlayerOrStatus(); } return $this->renderPlayerOrStatus().parent::renderIndestructibleReview(); }
[ "protected", "function", "renderIndestructibleReview", "(", ")", "{", "if", "(", "$", "this", "->", "encoding", "&&", "$", "this", "->", "encoding", "->", "status", "==", "'complete'", ")", "{", "return", "$", "this", "->", "renderPlayerOrStatus", "(", ")", ...
Should only the video player with no checkbox @return string HTML
[ "Should", "only", "the", "video", "player", "with", "no", "checkbox" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/VideoEncoder.php#L193-L200
30,788
BKWLD/decoy
classes/Fields/VideoEncoder.php
VideoEncoder.renderPlayerOrStatus
protected function renderPlayerOrStatus() { if (!$this->encoding) { return $this->renderError('No encoding instance found.'); } switch ($this->encoding->status) { case 'complete': return $this->renderPlayer(); case 'error': ...
php
protected function renderPlayerOrStatus() { if (!$this->encoding) { return $this->renderError('No encoding instance found.'); } switch ($this->encoding->status) { case 'complete': return $this->renderPlayer(); case 'error': ...
[ "protected", "function", "renderPlayerOrStatus", "(", ")", "{", "if", "(", "!", "$", "this", "->", "encoding", ")", "{", "return", "$", "this", "->", "renderError", "(", "'No encoding instance found.'", ")", ";", "}", "switch", "(", "$", "this", "->", "enc...
Render the player if the encoding is complete. Otherwise, show progress @return string HTML
[ "Render", "the", "player", "if", "the", "encoding", "is", "complete", ".", "Otherwise", "show", "progress" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/VideoEncoder.php#L207-L233
30,789
BKWLD/decoy
classes/Controllers/Workers.php
Workers.tail
public function tail($worker) { // Form the path to the file $file = Model::logPath(urldecode($worker)); if (!file_exists($file)) { throw new Exception('Log not found: '.$file); } $size = 1024 * 100; // in bytes to get // Read from the end of the file ...
php
public function tail($worker) { // Form the path to the file $file = Model::logPath(urldecode($worker)); if (!file_exists($file)) { throw new Exception('Log not found: '.$file); } $size = 1024 * 100; // in bytes to get // Read from the end of the file ...
[ "public", "function", "tail", "(", "$", "worker", ")", "{", "// Form the path to the file", "$", "file", "=", "Model", "::", "logPath", "(", "urldecode", "(", "$", "worker", ")", ")", ";", "if", "(", "!", "file_exists", "(", "$", "file", ")", ")", "{",...
Ajax service that tails the log file for the selected worker @param $worker
[ "Ajax", "service", "that", "tails", "the", "log", "file", "for", "the", "selected", "worker" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Controllers/Workers.php#L34-L56
30,790
BKWLD/decoy
classes/Auth/Policy.php
Policy.check
public function check(Admin $admin, $action, $controller) { // Convert controller instance to its string name if (is_object($controller)) { $controller = get_class($controller); } // Get the slug version of the controller. Test if a URL was passed first // and, ...
php
public function check(Admin $admin, $action, $controller) { // Convert controller instance to its string name if (is_object($controller)) { $controller = get_class($controller); } // Get the slug version of the controller. Test if a URL was passed first // and, ...
[ "public", "function", "check", "(", "Admin", "$", "admin", ",", "$", "action", ",", "$", "controller", ")", "{", "// Convert controller instance to its string name", "if", "(", "is_object", "(", "$", "controller", ")", ")", "{", "$", "controller", "=", "get_cl...
Check an Admin model against an action performed on a controller against permissions from the config. @param Admin $admin @param string $action The verb we're checking. Examples: - create - read - update - destroy - manage - publish @param string $controller - controller instance - controller name (Admin\A...
[ "Check", "an", "Admin", "model", "against", "an", "action", "performed", "on", "a", "controller", "against", "permissions", "from", "the", "config", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Auth/Policy.php#L34-L124
30,791
BKWLD/decoy
classes/Models/Base.php
Base.hasGetMutator
public function hasGetMutator($key) { if (!Decoy::handling() || !array_key_exists($key, $this->attributes) || in_array($key, $this->admin_mutators)) { return parent::hasGetMutator($key); } }
php
public function hasGetMutator($key) { if (!Decoy::handling() || !array_key_exists($key, $this->attributes) || in_array($key, $this->admin_mutators)) { return parent::hasGetMutator($key); } }
[ "public", "function", "hasGetMutator", "(", "$", "key", ")", "{", "if", "(", "!", "Decoy", "::", "handling", "(", ")", "||", "!", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "attributes", ")", "||", "in_array", "(", "$", "key", ",", ...
Disable mutators unless the active request isn't for the admin, the key doesn't reference a true database-backed attribute, or the key was expressly whitelisted in the admin_mutators property. @param string $key @return mixed
[ "Disable", "mutators", "unless", "the", "active", "request", "isn", "t", "for", "the", "admin", "the", "key", "doesn", "t", "reference", "a", "true", "database", "-", "backed", "attribute", "or", "the", "key", "was", "expressly", "whitelisted", "in", "the", ...
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L124-L131
30,792
BKWLD/decoy
classes/Models/Base.php
Base.getAdminThumbAttribute
public function getAdminThumbAttribute($width = 40, $height = 40) { // Check if there are images for the model if (!method_exists($this, 'images')) { return; } $images = $this->images; if ($images->isEmpty()) { return; } // Get null-...
php
public function getAdminThumbAttribute($width = 40, $height = 40) { // Check if there are images for the model if (!method_exists($this, 'images')) { return; } $images = $this->images; if ($images->isEmpty()) { return; } // Get null-...
[ "public", "function", "getAdminThumbAttribute", "(", "$", "width", "=", "40", ",", "$", "height", "=", "40", ")", "{", "// Check if there are images for the model", "if", "(", "!", "method_exists", "(", "$", "this", ",", "'images'", ")", ")", "{", "return", ...
The URL for the thumbnail @return string URL
[ "The", "URL", "for", "the", "thumbnail" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L290-L305
30,793
BKWLD/decoy
classes/Models/Base.php
Base.getFileAttributesAttribute
public function getFileAttributesAttribute() { // Get all the file validation rule keys $attributes = array_keys(array_filter(static::$rules, function ($rules) { return preg_match('#file|image|mimes|video|dimensions#i', $rules); })); // Get all the model attributes from...
php
public function getFileAttributesAttribute() { // Get all the file validation rule keys $attributes = array_keys(array_filter(static::$rules, function ($rules) { return preg_match('#file|image|mimes|video|dimensions#i', $rules); })); // Get all the model attributes from...
[ "public", "function", "getFileAttributesAttribute", "(", ")", "{", "// Get all the file validation rule keys", "$", "attributes", "=", "array_keys", "(", "array_filter", "(", "static", "::", "$", "rules", ",", "function", "(", "$", "rules", ")", "{", "return", "pr...
Get all file fields by looking at Upchuck config and validation rules @return array The keys of all the attributes that store file references
[ "Get", "all", "file", "fields", "by", "looking", "at", "Upchuck", "config", "and", "validation", "rules" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L329-L345
30,794
BKWLD/decoy
classes/Models/Base.php
Base.getAdminRowClassAttribute
public function getAdminRowClassAttribute() { $classes = []; // Add a visbility classs if ($this->public) { $classes[] = 'is-public'; } // Add a soft-deleted class if (method_exists($this, 'trashed') && $this->trashed()) { $classes[] = 'is-trashe...
php
public function getAdminRowClassAttribute() { $classes = []; // Add a visbility classs if ($this->public) { $classes[] = 'is-public'; } // Add a soft-deleted class if (method_exists($this, 'trashed') && $this->trashed()) { $classes[] = 'is-trashe...
[ "public", "function", "getAdminRowClassAttribute", "(", ")", "{", "$", "classes", "=", "[", "]", ";", "// Add a visbility classs", "if", "(", "$", "this", "->", "public", ")", "{", "$", "classes", "[", "]", "=", "'is-public'", ";", "}", "// Add a soft-delete...
Automatically add classes to rows in listing tables in the admin @return string
[ "Automatically", "add", "classes", "to", "rows", "in", "listing", "tables", "in", "the", "admin" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L367-L382
30,795
BKWLD/decoy
classes/Models/Base.php
Base.getAttributesForLocalizationComparisonAttribute
public function getAttributesForLocalizationComparisonAttribute() { $attributes = $this->getAttributes(); if (method_exists($this, 'croppedImages')) { $attributes['images'] = $this->croppedImages(300); } return $attributes; }
php
public function getAttributesForLocalizationComparisonAttribute() { $attributes = $this->getAttributes(); if (method_exists($this, 'croppedImages')) { $attributes['images'] = $this->croppedImages(300); } return $attributes; }
[ "public", "function", "getAttributesForLocalizationComparisonAttribute", "(", ")", "{", "$", "attributes", "=", "$", "this", "->", "getAttributes", "(", ")", ";", "if", "(", "method_exists", "(", "$", "this", ",", "'croppedImages'", ")", ")", "{", "$", "attrib...
Expose model attributes for comparison by the localization sidebar @return array
[ "Expose", "model", "attributes", "for", "comparison", "by", "the", "localization", "sidebar" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L389-L396
30,796
BKWLD/decoy
classes/Models/Base.php
Base.makeAdminActions
public function makeAdminActions($data) { $actions = []; if ($html = $this->makeVisibilityAction($data)) { $actions['visibility'] = $html; } if ($html = $this->makeEditAction($data)) { $actions['edit'] = $html; } if ($html = $this->makeViewA...
php
public function makeAdminActions($data) { $actions = []; if ($html = $this->makeVisibilityAction($data)) { $actions['visibility'] = $html; } if ($html = $this->makeEditAction($data)) { $actions['edit'] = $html; } if ($html = $this->makeViewA...
[ "public", "function", "makeAdminActions", "(", "$", "data", ")", "{", "$", "actions", "=", "[", "]", ";", "if", "(", "$", "html", "=", "$", "this", "->", "makeVisibilityAction", "(", "$", "data", ")", ")", "{", "$", "actions", "[", "'visibility'", "]...
Make the markup for the actions column of the admin listing view. The indivudal actions are stored in an array that is iterted through in the view @param array $data The data passed to a listing view @return array
[ "Make", "the", "markup", "for", "the", "actions", "column", "of", "the", "admin", "listing", "view", ".", "The", "indivudal", "actions", "are", "stored", "in", "an", "array", "that", "is", "iterted", "through", "in", "the", "view" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L410-L431
30,797
BKWLD/decoy
classes/Models/Base.php
Base.makeVisibilityAction
protected function makeVisibilityAction($data) { extract($data); // Check if this model supports editing the visibility if ($many_to_many || !app('decoy.user')->can('publish', $controller) || !array_key_exists('public', $this->attributes)) { return; ...
php
protected function makeVisibilityAction($data) { extract($data); // Check if this model supports editing the visibility if ($many_to_many || !app('decoy.user')->can('publish', $controller) || !array_key_exists('public', $this->attributes)) { return; ...
[ "protected", "function", "makeVisibilityAction", "(", "$", "data", ")", "{", "extract", "(", "$", "data", ")", ";", "// Check if this model supports editing the visibility", "if", "(", "$", "many_to_many", "||", "!", "app", "(", "'decoy.user'", ")", "->", "can", ...
Make the visibility state action @param array $data The data passed to a listing view @return string
[ "Make", "the", "visibility", "state", "action" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L439-L458
30,798
BKWLD/decoy
classes/Models/Base.php
Base.makeEditAction
protected function makeEditAction($data) { extract($data); // Make markup $editable = app('decoy.user')->can('update', $controller); return sprintf('<a href="%s" class="action-edit js-tooltip" data-placement="left" title="%s"> <span class="glyphicon glyph...
php
protected function makeEditAction($data) { extract($data); // Make markup $editable = app('decoy.user')->can('update', $controller); return sprintf('<a href="%s" class="action-edit js-tooltip" data-placement="left" title="%s"> <span class="glyphicon glyph...
[ "protected", "function", "makeEditAction", "(", "$", "data", ")", "{", "extract", "(", "$", "data", ")", ";", "// Make markup", "$", "editable", "=", "app", "(", "'decoy.user'", ")", "->", "can", "(", "'update'", ",", "$", "controller", ")", ";", "return...
Make the edit or view action. @param array $data The data passed to a listing view @return string
[ "Make", "the", "edit", "or", "view", "action", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L466-L482
30,799
BKWLD/decoy
classes/Models/Base.php
Base.getAdminEditUri
public function getAdminEditUri($controller, $many_to_many = false) { if ($many_to_many) { return URL::to(DecoyURL::action($controller.'@edit', $this->getKey())); } return URL::to(DecoyURL::relative('edit', $this->getKey(), $controller)); }
php
public function getAdminEditUri($controller, $many_to_many = false) { if ($many_to_many) { return URL::to(DecoyURL::action($controller.'@edit', $this->getKey())); } return URL::to(DecoyURL::relative('edit', $this->getKey(), $controller)); }
[ "public", "function", "getAdminEditUri", "(", "$", "controller", ",", "$", "many_to_many", "=", "false", ")", "{", "if", "(", "$", "many_to_many", ")", "{", "return", "URL", "::", "to", "(", "DecoyURL", "::", "action", "(", "$", "controller", ".", "'@edi...
Get the admin edit URL assuming you know the controller and whether it's being listed as a many to many @param string $controller ex: Admin\ArticlesController @param boolean $many_to_many @return string
[ "Get", "the", "admin", "edit", "URL", "assuming", "you", "know", "the", "controller", "and", "whether", "it", "s", "being", "listed", "as", "a", "many", "to", "many" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L492-L499