@@ -9,35 +9,35 @@ |
||
| 9 | 9 | class DatastoreComments extends Model |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - use SoftDeletes; |
|
| 13 | - |
|
| 14 | - protected $dates = ['deleted_at']; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * The attributes that are mass assignable. |
|
| 18 | - * |
|
| 19 | - * @var array |
|
| 20 | - */ |
|
| 21 | - protected $fillable = ['user_id', 'datastore_id', 'parent_id', 'body']; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * The belongs to Relationship |
|
| 25 | - * |
|
| 26 | - * @var array |
|
| 27 | - */ |
|
| 28 | - public function user() |
|
| 29 | - { |
|
| 30 | - return $this->belongsTo(User::class); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * The has Many Relationship |
|
| 35 | - * |
|
| 36 | - * @var array |
|
| 37 | - */ |
|
| 38 | - public function replies() |
|
| 39 | - { |
|
| 40 | - return $this->hasMany(DatastoreComments::class, 'parent_id'); |
|
| 41 | - } |
|
| 12 | + use SoftDeletes; |
|
| 13 | + |
|
| 14 | + protected $dates = ['deleted_at']; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * The attributes that are mass assignable. |
|
| 18 | + * |
|
| 19 | + * @var array |
|
| 20 | + */ |
|
| 21 | + protected $fillable = ['user_id', 'datastore_id', 'parent_id', 'body']; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * The belongs to Relationship |
|
| 25 | + * |
|
| 26 | + * @var array |
|
| 27 | + */ |
|
| 28 | + public function user() |
|
| 29 | + { |
|
| 30 | + return $this->belongsTo(User::class); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * The has Many Relationship |
|
| 35 | + * |
|
| 36 | + * @var array |
|
| 37 | + */ |
|
| 38 | + public function replies() |
|
| 39 | + { |
|
| 40 | + return $this->hasMany(DatastoreComments::class, 'parent_id'); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | } |
| 44 | 44 | \ No newline at end of file |
@@ -15,14 +15,14 @@ discard block |
||
| 15 | 15 | use ReflectionClass; |
| 16 | 16 | use ReflectionProperty; |
| 17 | 17 | |
| 18 | -class Datastore{ |
|
| 18 | +class Datastore { |
|
| 19 | 19 | |
| 20 | - protected $__asset = false; |
|
| 21 | - protected $__asset_properties = false; |
|
| 22 | - protected $__value_equals = false; |
|
| 23 | - protected $__status_equals = false; |
|
| 24 | - protected $__start_date = null; |
|
| 25 | - protected $__end_date = null; |
|
| 20 | + protected $__asset = false; |
|
| 21 | + protected $__asset_properties = false; |
|
| 22 | + protected $__value_equals = false; |
|
| 23 | + protected $__status_equals = false; |
|
| 24 | + protected $__start_date = null; |
|
| 25 | + protected $__end_date = null; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $this->__model = DatastoreModel::findOrFail($id); |
| 57 | 57 | |
| 58 | - if(!$this->__model){ |
|
| 58 | + if (!$this->__model) { |
|
| 59 | 59 | //could not load <div class="">thr</div> |
| 60 | 60 | throw new DatastoreException("Record not found"); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | foreach ($this->__model->toArray() as $k => $v) |
| 64 | 64 | { |
| 65 | - if($k === 'options' || $k === 'meta'){ |
|
| 65 | + if ($k === 'options' || $k === 'meta') { |
|
| 66 | 66 | $v = json_decode($v, true); |
| 67 | 67 | } |
| 68 | - if(in_array($k, ['created_at','updated_at','date_start','date_end'])){ |
|
| 68 | + if (in_array($k, ['created_at', 'updated_at', 'date_start', 'date_end'])) { |
|
| 69 | 69 | $v = Carbon::parse($v); |
| 70 | 70 | } |
| 71 | 71 | $this->{$k} = $v; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->ownDatastore[] = self::getAssetById($ds->id); |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - }else{ |
|
| 83 | + }else { |
|
| 84 | 84 | $this->__model = new DatastoreModel(); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -92,23 +92,23 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @return void |
| 94 | 94 | */ |
| 95 | - public static function getAssetById($id){ |
|
| 95 | + public static function getAssetById($id) { |
|
| 96 | 96 | $datastore = new self($id); |
| 97 | 97 | $datastore->setAssetType($datastore->type); |
| 98 | 98 | return $datastore; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public static function find($id){ |
|
| 102 | - if(!is_array($id)){ |
|
| 103 | - if(is_object($id)){ |
|
| 101 | + public static function find($id) { |
|
| 102 | + if (!is_array($id)) { |
|
| 103 | + if (is_object($id)) { |
|
| 104 | 104 | return self::getAssetById($id->id); |
| 105 | 105 | } |
| 106 | 106 | return self::getAssetById($id); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if(is_array($id)){ |
|
| 109 | + if (is_array($id)) { |
|
| 110 | 110 | $assets = []; |
| 111 | - foreach($id as $i){ |
|
| 111 | + foreach ($id as $i) { |
|
| 112 | 112 | $assets[] = self::getAssetById($i); |
| 113 | 113 | } |
| 114 | 114 | return $assets; |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
| 132 | - public function ownDatastore(){ |
|
| 133 | - return ($this->ownDatastore)?$this->ownDatastore: array(); |
|
| 132 | + public function ownDatastore() { |
|
| 133 | + return ($this->ownDatastore) ? $this->ownDatastore : array(); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | if (!isset($this->__asset_properties[$p])) |
| 193 | 193 | { |
| 194 | - $this->__asset_properties[$p]['temp'] = self::getAsset($this->__asset->properties[$p]['type']); |
|
| 194 | + $this->__asset_properties[$p]['temp'] = self::getAsset($this->__asset->properties[$p]['type']); |
|
| 195 | 195 | $this->__asset_properties[$p]['temp']->name = (isset($this->__asset->properties[$p]['name'])) ? $this->__asset->properties[$p]['name'] : null; |
| 196 | - $this->__asset_properties[$p]['temp']->key = $p; |
|
| 196 | + $this->__asset_properties[$p]['temp']->key = $p; |
|
| 197 | 197 | $this->__asset_properties[$p]['temp']->private = (isset($this->__asset->properties[$p]['private'])) ? $this->__asset->properties[$p]['private'] : false; // accessibility |
| 198 | 198 | $this->__asset_properties[$p]['temp']->value = (isset($this->__asset->properties[$p]['value'])) ? $this->__asset->properties[$p]['value'] : null; // the actual value of the property |
| 199 | 199 | $this->__asset_properties[$p]['temp']->options = (isset($this->__asset->properties[$p]['options'])) ? $this->__asset->properties[$p]['options'] : null; // additional options specific to the property |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | $this->__asset_properties[$p]['temp']->help = (isset($this->__asset->properties[$p]['help'])) ? $this->__asset->properties[$p]['help'] : null; // additional options specific to the property |
| 203 | 203 | $this->__asset_properties[$p]['temp']->required = (isset($this->__asset->properties[$p]['required'])) ? $this->__asset->properties[$p]['required'] : true; // is the property required |
| 204 | 204 | $this->__asset_properties[$p]['temp']->limit = (isset($this->__asset->properties[$p]['limit'])) ? $this->__asset->properties[$p]['limit'] : null; // additional options specific to the property |
| 205 | - $this->__asset_properties[$p]['temp']->warning = (isset($this->__asset->properties[$p]['warning'])) ? $this->__asset->properties[$p]['warning'] : null; // additional options specific to the property |
|
| 206 | - $this->__asset_properties[$p]['temp']->max_instances = (isset($this->__asset->properties[$p]['max_instances'])) ? $this->__asset->properties[$p]['max_instances'] : 0; // there can be only one |
|
| 205 | + $this->__asset_properties[$p]['temp']->warning = (isset($this->__asset->properties[$p]['warning'])) ? $this->__asset->properties[$p]['warning'] : null; // additional options specific to the property |
|
| 206 | + $this->__asset_properties[$p]['temp']->max_instances = (isset($this->__asset->properties[$p]['max_instances'])) ? $this->__asset->properties[$p]['max_instances'] : 0; // there can be only one |
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $this->__asset_properties[$each->key] = array('temp' => $each); |
| 223 | 223 | @$this->ownDatastore[$idx]->required = (isset($this->__asset->properties[$each->key]['required'])) ? $this->__asset->properties[$each->key]['required'] : true; |
| 224 | 224 | @$this->ownDatastore[$idx]->limit = (isset($this->__asset->properties[$each->key]['limit'])) ? $this->__asset->properties[$each->key]['limit'] : null; |
| 225 | - @$this->ownDatastore[$idx]->warning = (isset($this->__asset->properties[$each->key]['warning'])) ? $this->__asset->properties[$each->key]['warning'] : null; |
|
| 225 | + @$this->ownDatastore[$idx]->warning = (isset($this->__asset->properties[$each->key]['warning'])) ? $this->__asset->properties[$each->key]['warning'] : null; |
|
| 226 | 226 | @$this->ownDatastore[$idx]->help = (isset($this->__asset->properties[$each->key]['help'])) ? $this->__asset->properties[$each->key]['help'] : null; |
| 227 | 227 | @$this->ownDatastore[$idx]->max_instances = (isset($this->__asset->properties[$each->key]['max_instances'])) ? $this->__asset->properties[$each->key]['max_instances'] : 0; |
| 228 | 228 | @$this->ownDatastore[$idx]->options = (isset($this->__asset->properties[$each->key]['options'])) ? $this->__asset->properties[$each->key]['options'] : null; |
@@ -237,19 +237,19 @@ discard block |
||
| 237 | 237 | { |
| 238 | 238 | |
| 239 | 239 | // we need to create a temporary new bean to store new data |
| 240 | - $this->__asset_properties[$prop]['temp'] = self::getAsset($this->__asset->properties[$prop]['type']); |
|
| 241 | - $this->__asset_properties[$prop]['temp']->name = (isset($this->__asset->properties[$prop]['name'])) ? $this->__asset->properties[$prop]['name'] : null; |
|
| 242 | - $this->__asset_properties[$prop]['temp']->key = $prop; |
|
| 240 | + $this->__asset_properties[$prop]['temp'] = self::getAsset($this->__asset->properties[$prop]['type']); |
|
| 241 | + $this->__asset_properties[$prop]['temp']->name = (isset($this->__asset->properties[$prop]['name'])) ? $this->__asset->properties[$prop]['name'] : null; |
|
| 242 | + $this->__asset_properties[$prop]['temp']->key = $prop; |
|
| 243 | 243 | $this->__asset_properties[$prop]['temp']->private = (isset($this->__asset->properties[$prop]['private'])) ? $this->__asset->properties[$prop]['private'] : false; // accessibility |
| 244 | - $this->__asset_properties[$prop]['temp']->value = (isset($this->__asset->properties[$prop]['value'])) ? $this->__asset->properties[$prop]['value'] : null; // the actual value of the property |
|
| 244 | + $this->__asset_properties[$prop]['temp']->value = (isset($this->__asset->properties[$prop]['value'])) ? $this->__asset->properties[$prop]['value'] : null; // the actual value of the property |
|
| 245 | 245 | $this->__asset_properties[$prop]['temp']->options = (isset($this->__asset->properties[$prop]['options'])) ? $this->__asset->properties[$prop]['options'] : null; // additional options specific to the property |
| 246 | 246 | $this->__asset_properties[$prop]['temp']->callback = (isset($this->__asset->properties[$prop]['callback'])) ? $this->__asset->properties[$prop]['callback'] : null; // additional options specific to the property |
| 247 | 247 | $this->__asset_properties[$prop]['temp']->meta = (isset($this->__asset->properties[$prop]['meta'])) ? $this->__asset->properties[$prop]['meta'] : null; // additional options specific to the property |
| 248 | 248 | $this->__asset_properties[$prop]['temp']->help = (isset($this->__asset->properties[$prop]['help'])) ? $this->__asset->properties[$prop]['help'] : null; // additional options specific to the property |
| 249 | 249 | $this->__asset_properties[$prop]['temp']->required = (isset($this->__asset->properties[$prop]['required'])) ? $this->__asset->properties[$prop]['required'] : true; // is the property required |
| 250 | - $this->__asset_properties[$prop]['temp']->limit = (isset($this->__asset->properties[$prop]['limit'])) ? $this->__asset->properties[$prop]['limit'] : null; // additional options specific to the property |
|
| 251 | - $this->__asset_properties[$prop]['temp']->warning = (isset($this->__asset->properties[$prop]['warning'])) ? $this->__asset->properties[$prop]['warning'] : null; // additional options specific to the property |
|
| 252 | - $this->__asset_properties[$prop]['temp']->max_instances = (isset($this->__asset->properties[$prop]['max_instances'])) ? $this->__asset->properties[$prop]['max_instances'] : null; // there can be only one |
|
| 250 | + $this->__asset_properties[$prop]['temp']->limit = (isset($this->__asset->properties[$prop]['limit'])) ? $this->__asset->properties[$prop]['limit'] : null; // additional options specific to the property |
|
| 251 | + $this->__asset_properties[$prop]['temp']->warning = (isset($this->__asset->properties[$prop]['warning'])) ? $this->__asset->properties[$prop]['warning'] : null; // additional options specific to the property |
|
| 252 | + $this->__asset_properties[$prop]['temp']->max_instances = (isset($this->__asset->properties[$prop]['max_instances'])) ? $this->__asset->properties[$prop]['max_instances'] : null; // there can be only one |
|
| 253 | 253 | |
| 254 | 254 | } |
| 255 | 255 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | public static function getKey($string) |
| 266 | 266 | { |
| 267 | - $new = Helpers::splitByCaps($string); |
|
| 267 | + $new = Helpers::splitByCaps($string); |
|
| 268 | 268 | $explode = explode(' ', $new); |
| 269 | 269 | |
| 270 | 270 | if (isset($explode[0]) && $explode[0] == 'Ams') |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | break; |
| 320 | 320 | |
| 321 | 321 | case 2: |
| 322 | - $prop = func_get_arg(0); |
|
| 323 | - $val = func_get_arg(1); |
|
| 322 | + $prop = func_get_arg(0); |
|
| 323 | + $val = func_get_arg(1); |
|
| 324 | 324 | if (isset($this->__asset_properties[$prop])) |
| 325 | 325 | { |
| 326 | 326 | // check whether this is new or existing |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | break; |
| 397 | 397 | |
| 398 | 398 | default: |
| 399 | - $val = func_get_arg(0); |
|
| 399 | + $val = func_get_arg(0); |
|
| 400 | 400 | $this->value = $val; |
| 401 | 401 | } |
| 402 | 402 | } |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | foreach ($props as $prop) |
| 424 | 424 | { |
| 425 | - if (!in_array($prop->name, array('status_equals', 'properties','help','value_equals'))) |
|
| 425 | + if (!in_array($prop->name, array('status_equals', 'properties', 'help', 'value_equals'))) |
|
| 426 | 426 | { |
| 427 | 427 | $record->{$prop->name} = isset($asset->{$prop->name}) ? $asset->{$prop->name} : NULL; |
| 428 | 428 | } |
@@ -430,15 +430,15 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | if ($asset->__status_equals) |
| 432 | 432 | { |
| 433 | - $record->status = isset($record->{$asset->__status_equals})? $record->{$asset->__status_equals} : $this->prop($this->__status_equals); |
|
| 433 | + $record->status = isset($record->{$asset->__status_equals}) ? $record->{$asset->__status_equals} : $this->prop($this->__status_equals); |
|
| 434 | 434 | } |
| 435 | 435 | if ($asset->__start_date) |
| 436 | 436 | { |
| 437 | - $record->start_date = isset($record->{$asset->__start_date})? $record->{$asset->__start_date} : $this->prop($this->__start_date); |
|
| 437 | + $record->start_date = isset($record->{$asset->__start_date}) ? $record->{$asset->__start_date} : $this->prop($this->__start_date); |
|
| 438 | 438 | } |
| 439 | 439 | if ($asset->__end_date) |
| 440 | 440 | { |
| 441 | - $record->end_date = isset($record->{$asset->__end_date})? $record->{$asset->__end_date} : $this->prop($this->__end_date); |
|
| 441 | + $record->end_date = isset($record->{$asset->__end_date}) ? $record->{$asset->__end_date} : $this->prop($this->__end_date); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | $record->options = json_encode($record->options); |
@@ -494,8 +494,8 @@ discard block |
||
| 494 | 494 | public function getMarkup($template = false) |
| 495 | 495 | { |
| 496 | 496 | |
| 497 | - $vars = $this->export(); |
|
| 498 | - $vars['_unique_id'] = uniqid(); |
|
| 497 | + $vars = $this->export(); |
|
| 498 | + $vars['_unique_id'] = uniqid(); |
|
| 499 | 499 | |
| 500 | 500 | // we also want to know what asset this property belongs to |
| 501 | 501 | $output = Helpers::callStatic($this->type, 'render', array($vars, $template)); |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | if ($this->__status_equals) |
| 529 | 529 | { |
| 530 | 530 | |
| 531 | - $data['status'] = isset($data[$this->__status_equals])? $data[$this->__status_equals] : $this->prop($this->__status_equals); |
|
| 531 | + $data['status'] = isset($data[$this->__status_equals]) ? $data[$this->__status_equals] : $this->prop($this->__status_equals); |
|
| 532 | 532 | } |
| 533 | 533 | if ($this->__start_date) |
| 534 | 534 | { |
@@ -589,9 +589,9 @@ discard block |
||
| 589 | 589 | } |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | - public function getFieldValues(){ |
|
| 592 | + public function getFieldValues() { |
|
| 593 | 593 | $data = []; |
| 594 | - foreach(array_keys($this->__asset->properties) as $key){ |
|
| 594 | + foreach (array_keys($this->__asset->properties) as $key) { |
|
| 595 | 595 | $data[$key] = $this->prop($key); |
| 596 | 596 | } |
| 597 | 597 | return $data; |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | return $output; |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | - public function propGetValue($prop){ |
|
| 658 | + public function propGetValue($prop) { |
|
| 659 | 659 | dd($prop); |
| 660 | 660 | } |
| 661 | 661 | |
@@ -683,8 +683,8 @@ discard block |
||
| 683 | 683 | { |
| 684 | 684 | if (isset($this->__asset_properties[$prop]['temp'])) |
| 685 | 685 | { |
| 686 | - $xvars = $this->__asset_properties[$prop]['temp']->export(); |
|
| 687 | - $xvars['unique_id'] = $unique_id; |
|
| 686 | + $xvars = $this->__asset_properties[$prop]['temp']->export(); |
|
| 687 | + $xvars['unique_id'] = $unique_id; |
|
| 688 | 688 | |
| 689 | 689 | $output .= Helpers::callStatic($this->__asset_properties[$prop]['temp']->type, 'form', array($xvars, $this->type)); |
| 690 | 690 | } |
@@ -692,8 +692,8 @@ discard block |
||
| 692 | 692 | { |
| 693 | 693 | if (isset($this->__asset_properties[$prop])) |
| 694 | 694 | { |
| 695 | - $xvars = $this->ownDatastore[$this->__asset_properties[$prop]]->export(); |
|
| 696 | - $xvars['unique_id'] = $unique_id; |
|
| 695 | + $xvars = $this->ownDatastore[$this->__asset_properties[$prop]]->export(); |
|
| 696 | + $xvars['unique_id'] = $unique_id; |
|
| 697 | 697 | |
| 698 | 698 | $output .= Helpers::callStatic($this->ownDatastore[$this->__asset_properties[$prop]]->type, 'form', array($xvars, $this->type)); |
| 699 | 699 | } |
@@ -709,8 +709,8 @@ discard block |
||
| 709 | 709 | return $output; |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | - public function hasMetadataForm(){ |
|
| 713 | - if ($this->namespace == 'asset' && !$this->is_child){ |
|
| 712 | + public function hasMetadataForm() { |
|
| 713 | + if ($this->namespace == 'asset' && !$this->is_child) { |
|
| 714 | 714 | return ($this->meta_description !== 'off' || $this->meta_keywords !== 'off'); |
| 715 | 715 | } |
| 716 | 716 | return false; |
@@ -757,8 +757,8 @@ discard block |
||
| 757 | 757 | return $output; |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | - public function hasDeveloperForm(){ |
|
| 761 | - if ($this->namespace == 'asset' && !$this->is_child){ |
|
| 760 | + public function hasDeveloperForm() { |
|
| 761 | + if ($this->namespace == 'asset' && !$this->is_child) { |
|
| 762 | 762 | return ($this->page_js !== 'off' || $this->page_css !== 'off'); |
| 763 | 763 | } |
| 764 | 764 | return false; |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | $output .= Helpers::callStatic(ASSET::METATEXT, 'form', array($data, 'metatext')); |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | - if ($this->page_js !== 'off' ) |
|
| 789 | + if ($this->page_js !== 'off') |
|
| 790 | 790 | { |
| 791 | 791 | $data = array( |
| 792 | 792 | 'name' => 'Custom JS', |
@@ -817,11 +817,11 @@ discard block |
||
| 817 | 817 | $messages = array(); |
| 818 | 818 | foreach ($this->__asset->properties as $key => $property) |
| 819 | 819 | { |
| 820 | - if($property['type'] !== \Phpsa\Datastore\Ams\AutoCallBackAdderAsset::class && (empty($property['required']) || $property['required'] === true) ) |
|
| 820 | + if ($property['type'] !== \Phpsa\Datastore\Ams\AutoCallBackAdderAsset::class && (empty($property['required']) || $property['required'] === true)) |
|
| 821 | 821 | { |
| 822 | 822 | $rules = empty($property['validation_rules']) ? 'required' : $property['validation_rules']; |
| 823 | - if(!empty($property['validation_messages'])){ |
|
| 824 | - if(is_string($property['validation_messages'])){ |
|
| 823 | + if (!empty($property['validation_messages'])) { |
|
| 824 | + if (is_string($property['validation_messages'])) { |
|
| 825 | 825 | $messages[$key . '.required'] = $property['validation_messages']; |
| 826 | 826 | } |
| 827 | 827 | } |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | { |
| 835 | 835 | $validator = Validator::make($request, $config, $messages); |
| 836 | 836 | |
| 837 | - if($validator->fails()){ |
|
| 837 | + if ($validator->fails()) { |
|
| 838 | 838 | throw new ValidationException($validator); |
| 839 | 839 | } |
| 840 | 840 | } |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | * |
| 946 | 946 | * @return void |
| 947 | 947 | */ |
| 948 | - public function statusOptions(){ |
|
| 948 | + public function statusOptions() { |
|
| 949 | 949 | return ($this->__status_equals) ? $this->__asset_properties[$this->__status_equals]['temp']->options : false; |
| 950 | 950 | } |
| 951 | 951 | |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | * |
| 955 | 955 | * @return void |
| 956 | 956 | */ |
| 957 | - public function getStatusValue(){ |
|
| 957 | + public function getStatusValue() { |
|
| 958 | 958 | $options = $this->statusOptions(); |
| 959 | 959 | return ($options && Helpers::isAssocArray($options) && isset($options[$this->status])) ? $options[$this->status] : $this->status; |
| 960 | 960 | } |
@@ -986,10 +986,10 @@ discard block |
||
| 986 | 986 | * |
| 987 | 987 | * @return bool |
| 988 | 988 | */ |
| 989 | - public function statusIsActive(){ |
|
| 990 | - if($this->__status_equals){ |
|
| 989 | + public function statusIsActive() { |
|
| 990 | + if ($this->__status_equals) { |
|
| 991 | 991 | |
| 992 | - if(!isset($this->__asset->properties[$this->__status_equals]['published'])){ |
|
| 992 | + if (!isset($this->__asset->properties[$this->__status_equals]['published'])) { |
|
| 993 | 993 | throw new DatastoreException("Statused assests need a published option in the asset definition"); |
| 994 | 994 | } |
| 995 | 995 | |
@@ -1029,10 +1029,10 @@ discard block |
||
| 1029 | 1029 | * @deprecated ??? |
| 1030 | 1030 | * @return void |
| 1031 | 1031 | */ |
| 1032 | - public static function getAssetByTypeValue($type,$value) |
|
| 1032 | + public static function getAssetByTypeValue($type, $value) |
|
| 1033 | 1033 | { |
| 1034 | - $asset = DatastoreModel::where('type' , $type)->where('value', $value)->where('namespace', 'asset')->orderBy('modified', 'desc')->first(); |
|
| 1035 | - if($asset){ |
|
| 1034 | + $asset = DatastoreModel::where('type', $type)->where('value', $value)->where('namespace', 'asset')->orderBy('modified', 'desc')->first(); |
|
| 1035 | + if ($asset) { |
|
| 1036 | 1036 | return self::getAsset($asset->type, $asset->id); |
| 1037 | 1037 | } |
| 1038 | 1038 | return false; |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | * |
| 1044 | 1044 | * @return void |
| 1045 | 1045 | */ |
| 1046 | - public function urlPath(){ |
|
| 1046 | + public function urlPath() { |
|
| 1047 | 1047 | return Helpers::getPath($this->type); |
| 1048 | 1048 | } |
| 1049 | 1049 | |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | * |
| 1057 | 1057 | * @return void |
| 1058 | 1058 | */ |
| 1059 | - public function getViewName($prefix = 'frontend.ams'){ |
|
| 1059 | + public function getViewName($prefix = 'frontend.ams') { |
|
| 1060 | 1060 | return $this->__asset::getFilename($prefix); |
| 1061 | 1061 | } |
| 1062 | 1062 | |
@@ -1067,11 +1067,11 @@ discard block |
||
| 1067 | 1067 | * |
| 1068 | 1068 | * @return void |
| 1069 | 1069 | */ |
| 1070 | - public function __get($name){ |
|
| 1070 | + public function __get($name) { |
|
| 1071 | 1071 | return $this->propExists($name) ? $this->prop($name) : $this->__model->{$name}; |
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | - public function getTitleField(){ |
|
| 1074 | + public function getTitleField() { |
|
| 1075 | 1075 | return $this->__value_equals; |
| 1076 | 1076 | } |
| 1077 | 1077 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->ownDatastore[] = self::getAssetById($ds->id); |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - }else{ |
|
| 83 | + } else{ |
|
| 84 | 84 | $this->__model = new DatastoreModel(); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -150,20 +150,16 @@ discard block |
||
| 150 | 150 | if ($k == 'value_equals') |
| 151 | 151 | { |
| 152 | 152 | $this->__value_equals = $v; |
| 153 | - } |
|
| 154 | - else if ($k == 'status_equals') |
|
| 153 | + } else if ($k == 'status_equals') |
|
| 155 | 154 | { |
| 156 | 155 | $this->__status_equals = $v; |
| 157 | - } |
|
| 158 | - else if ($k == 'start_date') |
|
| 156 | + } else if ($k == 'start_date') |
|
| 159 | 157 | { |
| 160 | 158 | $this->__start_date = $v; |
| 161 | - } |
|
| 162 | - else if ($k == 'end_date') |
|
| 159 | + } else if ($k == 'end_date') |
|
| 163 | 160 | { |
| 164 | 161 | $this->__end_date = $v; |
| 165 | - } |
|
| 166 | - else |
|
| 162 | + } else |
|
| 167 | 163 | { |
| 168 | 164 | $this->$k = (isset($this->$k)) ? $this->$k : $v; |
| 169 | 165 | } |
@@ -229,8 +225,7 @@ discard block |
||
| 229 | 225 | } |
| 230 | 226 | } |
| 231 | 227 | //echo '<pre>$this->ownDatastore: '; print_r($this->ownDatastore); echo '</pre>'; die(); |
| 232 | - } |
|
| 233 | - else |
|
| 228 | + } else |
|
| 234 | 229 | { |
| 235 | 230 | // nope - net to create some datastore beans to represent our properties |
| 236 | 231 | foreach ($this->__asset->properties as $prop => $data) |
@@ -306,13 +301,11 @@ discard block |
||
| 306 | 301 | if (isset($this->__asset_properties[$prop]['temp'])) |
| 307 | 302 | { |
| 308 | 303 | return $this->__asset_properties[$prop]['temp']->value; |
| 309 | - } |
|
| 310 | - else |
|
| 304 | + } else |
|
| 311 | 305 | { |
| 312 | 306 | return $this->ownDatastore[$this->__asset_properties[$prop]]->value; |
| 313 | 307 | } |
| 314 | - } |
|
| 315 | - else |
|
| 308 | + } else |
|
| 316 | 309 | { |
| 317 | 310 | return false; |
| 318 | 311 | } |
@@ -332,44 +325,36 @@ discard block |
||
| 332 | 325 | if ($this->__value_equals && $this->__value_equals == $prop) |
| 333 | 326 | { |
| 334 | 327 | $this->val(Helpers::callStatic($this->type, 'valueEquals', array($val))); |
| 335 | - } |
|
| 336 | - else if ($this->__status_equals && $this->__status_equals == $prop) |
|
| 328 | + } else if ($this->__status_equals && $this->__status_equals == $prop) |
|
| 337 | 329 | { |
| 338 | 330 | $this->status($val); |
| 339 | - } |
|
| 340 | - else if ($this->__start_date && $this->__start_date == $prop) |
|
| 331 | + } else if ($this->__start_date && $this->__start_date == $prop) |
|
| 341 | 332 | { |
| 342 | 333 | $this->start_date($val); |
| 343 | - } |
|
| 344 | - else if ($this->__end_date && $this->__end_date == $prop) |
|
| 334 | + } else if ($this->__end_date && $this->__end_date == $prop) |
|
| 345 | 335 | { |
| 346 | 336 | $this->end_date($val); |
| 347 | 337 | } |
| 348 | - } |
|
| 349 | - else |
|
| 338 | + } else |
|
| 350 | 339 | { |
| 351 | 340 | $this->ownDatastore[$this->__asset_properties[$prop]]->value = $val; |
| 352 | 341 | // if value equals is set, set it too |
| 353 | 342 | if ($this->__value_equals && $this->__value_equals == $prop) |
| 354 | 343 | { |
| 355 | 344 | $this->val(Helpers::callStatic($this->type, 'valueEquals', array($val))); |
| 356 | - } |
|
| 357 | - else if ($this->__status_equals && $this->__status_equals == $prop) |
|
| 345 | + } else if ($this->__status_equals && $this->__status_equals == $prop) |
|
| 358 | 346 | { |
| 359 | 347 | $this->status($val); |
| 360 | - } |
|
| 361 | - else if ($this->__start_date && $this->__start_date == $prop) |
|
| 348 | + } else if ($this->__start_date && $this->__start_date == $prop) |
|
| 362 | 349 | { |
| 363 | 350 | $this->start_date($val); |
| 364 | - } |
|
| 365 | - else if ($this->__end_date && $this->__end_date == $prop) |
|
| 351 | + } else if ($this->__end_date && $this->__end_date == $prop) |
|
| 366 | 352 | { |
| 367 | 353 | $this->end_date($val); |
| 368 | 354 | } |
| 369 | 355 | } |
| 370 | 356 | return $this; |
| 371 | - } |
|
| 372 | - else |
|
| 357 | + } else |
|
| 373 | 358 | { |
| 374 | 359 | throw new DatastoreException('The property "' . $prop . '" is not defined for the "' . $this->type . '" asset'); |
| 375 | 360 | } |
@@ -476,8 +461,7 @@ discard block |
||
| 476 | 461 | if (isset($this->__asset_properties[$prop]['temp'])) |
| 477 | 462 | { |
| 478 | 463 | return $this->__asset_properties[$prop]['temp']->getMarkup($template); |
| 479 | - } |
|
| 480 | - else |
|
| 464 | + } else |
|
| 481 | 465 | { |
| 482 | 466 | if (isset($this->__asset_properties[$prop])) |
| 483 | 467 | { |
@@ -555,8 +539,7 @@ discard block |
||
| 555 | 539 | if (isset($this->__asset_properties[$prop]['temp'])) |
| 556 | 540 | { |
| 557 | 541 | echo $this->__asset_properties[$prop]['temp']->getForm($template, $prop); |
| 558 | - } |
|
| 559 | - else |
|
| 542 | + } else |
|
| 560 | 543 | { |
| 561 | 544 | if (isset($this->__asset_properties[$prop])) |
| 562 | 545 | { |
@@ -578,8 +561,7 @@ discard block |
||
| 578 | 561 | if (isset($this->__asset_properties[$prop]['temp'])) |
| 579 | 562 | { |
| 580 | 563 | return $this->__asset_properties[$prop]['temp']->getForm($template, $_prop); |
| 581 | - } |
|
| 582 | - else |
|
| 564 | + } else |
|
| 583 | 565 | { |
| 584 | 566 | if (isset($this->__asset_properties[$prop])) |
| 585 | 567 | { |
@@ -614,8 +596,7 @@ discard block |
||
| 614 | 596 | { |
| 615 | 597 | $output .= $this->returnForm($prop, false, $_prop); |
| 616 | 598 | } |
| 617 | - } |
|
| 618 | - else |
|
| 599 | + } else |
|
| 619 | 600 | { |
| 620 | 601 | return $this->propGetForm($template, $_prop); |
| 621 | 602 | } |
@@ -640,8 +621,7 @@ discard block |
||
| 640 | 621 | if (isset($_prop['unique_id'])) |
| 641 | 622 | { |
| 642 | 623 | $vars['_unique_id'] = $_prop['unique_id']; |
| 643 | - } |
|
| 644 | - else |
|
| 624 | + } else |
|
| 645 | 625 | { |
| 646 | 626 | $vars['_unique_id'] = md5(uniqid(rand(), true)); //UUID ?? |
| 647 | 627 | } |
@@ -672,8 +652,7 @@ discard block |
||
| 672 | 652 | if ($uid) |
| 673 | 653 | { |
| 674 | 654 | $unique_id = md5($uid); |
| 675 | - } |
|
| 676 | - else |
|
| 655 | + } else |
|
| 677 | 656 | { |
| 678 | 657 | $unique_id = md5(uniqid(rand(), true)); |
| 679 | 658 | } |
@@ -687,8 +666,7 @@ discard block |
||
| 687 | 666 | $xvars['unique_id'] = $unique_id; |
| 688 | 667 | |
| 689 | 668 | $output .= Helpers::callStatic($this->__asset_properties[$prop]['temp']->type, 'form', array($xvars, $this->type)); |
| 690 | - } |
|
| 691 | - else |
|
| 669 | + } else |
|
| 692 | 670 | { |
| 693 | 671 | if (isset($this->__asset_properties[$prop])) |
| 694 | 672 | { |
@@ -919,8 +897,7 @@ discard block |
||
| 919 | 897 | if (isset($this->__asset_properties[$pr]['temp'])) |
| 920 | 898 | { |
| 921 | 899 | $this->__asset_properties[$pr]['temp']->meta = $pv; |
| 922 | - } |
|
| 923 | - else |
|
| 900 | + } else |
|
| 924 | 901 | { |
| 925 | 902 | $this->ownDatastore[$this->__asset_properties[$pr]]->meta = $pv; |
| 926 | 903 | } |
@@ -150,10 +150,10 @@ |
||
| 150 | 150 | public $meta_description = null; |
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | - * set to 'off' to turn it off |
|
| 154 | - * |
|
| 155 | - * @var [type] |
|
| 156 | - */ |
|
| 153 | + * set to 'off' to turn it off |
|
| 154 | + * |
|
| 155 | + * @var [type] |
|
| 156 | + */ |
|
| 157 | 157 | public $meta_keywords = null; |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @author Craig Smith <[email protected]> |
| 31 | 31 | */ |
| 32 | -class Asset{ |
|
| 32 | +class Asset { |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Constants for the different asset types! |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | const AUTOCALLBACKADDER = AutoCallBackAdderAsset::class; // ajax powered autocomplete backed on a callback |
| 42 | - const AUTOCALLBACK = AutoCallBackAsset::class; // ajax powered autocomplete backed on a callback |
|
| 42 | + const AUTOCALLBACK = AutoCallBackAsset::class; // ajax powered autocomplete backed on a callback |
|
| 43 | 43 | const AUTOCOMPLETE = AutoCompleteAsset::class; |
| 44 | 44 | const BOOL = BooleanAsset::class; |
| 45 | 45 | const DATEPICKER = DatepickerAsset::class; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | const HTML = HtmlAsset::class; |
| 50 | 50 | const IDENTITY = IdentityAsset::class; |
| 51 | 51 | const IMG = ImageAsset::class; |
| 52 | - const METATEXT = MetatextAsset::class; |
|
| 52 | + const METATEXT = MetatextAsset::class; |
|
| 53 | 53 | const STRING = StringAsset::class; |
| 54 | 54 | const SUBHEADING = SubHeadingAsset::class; |
| 55 | 55 | const TEXT = TextAsset::class; |
@@ -62,70 +62,70 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @var string |
| 64 | 64 | */ |
| 65 | - public $help = null; |
|
| 65 | + public $help = null; |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Sets the required rule for a property |
| 69 | 69 | * |
| 70 | 70 | * @var bool |
| 71 | 71 | */ |
| 72 | - public $required = true; |
|
| 72 | + public $required = true; |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * which property is the actual value name for your asset - target one of the properties |
| 76 | 76 | * |
| 77 | 77 | * @var string |
| 78 | 78 | */ |
| 79 | - public $value_equals = null; |
|
| 79 | + public $value_equals = null; |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Assets namespace, most often extended as an asset, however may be a property if adding a new input type. |
| 83 | 83 | * |
| 84 | 84 | * @var string |
| 85 | 85 | */ |
| 86 | - public $namespace = self::ASSET; |
|
| 86 | + public $namespace = self::ASSET; |
|
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * Generally left alone unless overrideing to be a property then should have the instance class |
| 90 | 90 | * |
| 91 | 91 | * @var string |
| 92 | 92 | */ |
| 93 | - public $type = 'asset'; |
|
| 93 | + public $type = 'asset'; |
|
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | 96 | * Properties for thie asset - used to define the property assets to use to build up the asset |
| 97 | 97 | * |
| 98 | 98 | * @var array |
| 99 | 99 | */ |
| 100 | - public $properties = array(); |
|
| 100 | + public $properties = array(); |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * Public name - This is used to identify |
| 104 | 104 | * |
| 105 | 105 | * @var [type] |
| 106 | 106 | */ |
| 107 | - public $name = null; |
|
| 107 | + public $name = null; |
|
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * just a shortname to use instead of the full $name above |
| 111 | 111 | * |
| 112 | 112 | * @var string |
| 113 | 113 | */ |
| 114 | - public $shortname = null; |
|
| 114 | + public $shortname = null; |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * the max number of instances, 0 means unlimited - normally used for presets like the robots.txt |
| 118 | 118 | * |
| 119 | 119 | * @var int |
| 120 | 120 | */ |
| 121 | - public $max_instances = 0; |
|
| 121 | + public $max_instances = 0; |
|
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * IE if private is true, we do not show the page link block... and idsable the meta |
| 125 | 125 | * but if private is false, we show the page link and let meta decide for itself: |
| 126 | 126 | * @var bool |
| 127 | 127 | */ |
| 128 | - public $private = false; |
|
| 128 | + public $private = false; |
|
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * @deprecated Initial - |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @var [type] |
| 135 | 135 | */ |
| 136 | - public $embedded = null; |
|
| 136 | + public $embedded = null; |
|
| 137 | 137 | |
| 138 | 138 | /** |
| 139 | 139 | * @deprecated version |
| 140 | 140 | * * @TODO - Remove from here and from teh database object |
| 141 | 141 | * @var [type] |
| 142 | 142 | */ |
| 143 | - public $theme = null; |
|
| 143 | + public $theme = null; |
|
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * set to 'off' to turn it off |
@@ -154,14 +154,14 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * @var [type] |
| 156 | 156 | */ |
| 157 | - public $meta_keywords = null; |
|
| 157 | + public $meta_keywords = null; |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * set to 'off' to turn it off |
| 161 | 161 | * |
| 162 | 162 | * @var [type] |
| 163 | 163 | */ |
| 164 | - public $page_css = null; |
|
| 164 | + public $page_css = null; |
|
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | 167 | * set to 'off' to turn it off |
@@ -171,12 +171,12 @@ discard block |
||
| 171 | 171 | public $page_js = null; |
| 172 | 172 | |
| 173 | 173 | |
| 174 | - public $options = false; // Options for the element -- should actually be removed from the database table most likely |
|
| 175 | - public $status_equals = null; // does the asset has a status linked to a prop |
|
| 176 | - public $start_date = null; // does the asset has a start date linked to a prop |
|
| 177 | - public $end_date = null; // does the asset has an end date linked to a prop |
|
| 178 | - public $comment_equals = null; // does the asset allow comments (linked to a specific property - similar to status_equals) |
|
| 179 | - public $warning = null; // field for warnings - deprected in favour of validation_messages |
|
| 174 | + public $options = false; // Options for the element -- should actually be removed from the database table most likely |
|
| 175 | + public $status_equals = null; // does the asset has a status linked to a prop |
|
| 176 | + public $start_date = null; // does the asset has a start date linked to a prop |
|
| 177 | + public $end_date = null; // does the asset has an end date linked to a prop |
|
| 178 | + public $comment_equals = null; // does the asset allow comments (linked to a specific property - similar to status_equals) |
|
| 179 | + public $warning = null; // field for warnings - deprected in favour of validation_messages |
|
| 180 | 180 | //public $published = null; //published status |
| 181 | 181 | //public $validation_messages = null //validation messages |
| 182 | 182 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | public $module = null; |
| 185 | 185 | public $value = null; |
| 186 | 186 | public $status = null; |
| 187 | - public $meta = false; // ancillary meta info/data - similar to options |
|
| 187 | + public $meta = false; // ancillary meta info/data - similar to options |
|
| 188 | 188 | public $callback = null; |
| 189 | 189 | |
| 190 | 190 | /** |
@@ -192,36 +192,36 @@ discard block |
||
| 192 | 192 | * |
| 193 | 193 | * @var [type] |
| 194 | 194 | */ |
| 195 | - public $children = null; |
|
| 195 | + public $children = null; |
|
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | 198 | * Is this a child only asset? if marked as true does not auto display on menu options and can only be linked in as a child property to an asset. |
| 199 | 199 | * |
| 200 | 200 | * @var bool |
| 201 | 201 | */ |
| 202 | - public $is_child = false; |
|
| 202 | + public $is_child = false; |
|
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | 205 | * Asset that can be a child, ie an article belonging to a category |
| 206 | 206 | * |
| 207 | 207 | * @var [type] |
| 208 | 208 | */ |
| 209 | - public $accept = null; |
|
| 209 | + public $accept = null; |
|
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | 212 | * assets that can be children, a value means it is limited to that many children, -1 means unlimited |
| 213 | 213 | * @TodO update this to better display with a selct / multiSelect null / 0 / -1 or any falsy is unlimited, else it is limited to that number... |
| 214 | 214 | * @var [type] |
| 215 | 215 | */ |
| 216 | - public $accept_limit = null; |
|
| 216 | + public $accept_limit = null; |
|
| 217 | 217 | |
| 218 | 218 | |
| 219 | 219 | /** |
| 220 | 220 | * generate the route for this asset |
| 221 | 221 | * Overwrite this in your own assets to generate your own route |
| 222 | 222 | */ |
| 223 | - public static function route(DatastorePages $record, $route = null){ |
|
| 224 | - if(null === $route){ |
|
| 223 | + public static function route(DatastorePages $record, $route = null) { |
|
| 224 | + if (null === $route) { |
|
| 225 | 225 | $route = 'frontend.ams.page.slug'; |
| 226 | 226 | } |
| 227 | 227 | $page = $record->page; |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * @return array |
| 254 | 254 | */ |
| 255 | - public static function getDefaultProperties(){ |
|
| 256 | - $obj = new ReflectionClass(get_called_class()); |
|
| 255 | + public static function getDefaultProperties() { |
|
| 256 | + $obj = new ReflectionClass(get_called_class()); |
|
| 257 | 257 | return $obj->getDefaultProperties(); |
| 258 | 258 | } |
| 259 | 259 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | public static function getValueLabel() |
| 268 | 268 | { |
| 269 | 269 | $props = self::getDefaultProperties(); |
| 270 | - if(empty($props['value_equals']) || empty($props['properties'][$props['value_equals']]['name'])){ |
|
| 270 | + if (empty($props['value_equals']) || empty($props['properties'][$props['value_equals']]['name'])) { |
|
| 271 | 271 | throw new DatastoreException("value_equals is a required parameter"); |
| 272 | 272 | } |
| 273 | 273 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $parts = explode('\\', $path); |
| 317 | 317 | |
| 318 | 318 | $split = array_search('Ams', $parts); |
| 319 | - $ns = array_slice($parts, 0, $split); // first part |
|
| 319 | + $ns = array_slice($parts, 0, $split); // first part |
|
| 320 | 320 | $path = array_slice($parts, $split); // second part |
| 321 | 321 | |
| 322 | 322 | $ns = implode("", $ns); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | { |
| 348 | 348 | $args['unique_id'] = uniqid(); |
| 349 | 349 | } |
| 350 | - $data['data'] = $args; |
|
| 350 | + $data['data'] = $args; |
|
| 351 | 351 | $data['asset_classname'] = $injectedform; |
| 352 | 352 | return View::make($template, $data)->render(); |
| 353 | 353 | } |
@@ -363,9 +363,9 @@ discard block |
||
| 363 | 363 | public static function render($args = [], $params = false) |
| 364 | 364 | { |
| 365 | 365 | |
| 366 | - if(is_string($params)){ |
|
| 366 | + if (is_string($params)) { |
|
| 367 | 367 | $template = $params; |
| 368 | - } else { |
|
| 368 | + }else { |
|
| 369 | 369 | $template = is_array($params) && !empty($params['view']) ? $params['view'] : self::getFilename(); |
| 370 | 370 | } |
| 371 | 371 | |
@@ -405,8 +405,8 @@ discard block |
||
| 405 | 405 | * @return void |
| 406 | 406 | * @author Craig Smith <[email protected]> |
| 407 | 407 | */ |
| 408 | - public static function getPath($className = null){ |
|
| 409 | - if(null === $className) { |
|
| 408 | + public static function getPath($className = null) { |
|
| 409 | + if (null === $className) { |
|
| 410 | 410 | $className = get_called_class(); |
| 411 | 411 | } |
| 412 | 412 | return Helpers::getPath($className); |
@@ -293,8 +293,7 @@ |
||
| 293 | 293 | $out = $props[$lookup]; |
| 294 | 294 | unset($obj, $props); |
| 295 | 295 | return $out; |
| 296 | - } |
|
| 297 | - else |
|
| 296 | + } else |
|
| 298 | 297 | { |
| 299 | 298 | unset($obj, $props); |
| 300 | 299 | return false; |
@@ -12,23 +12,23 @@ |
||
| 12 | 12 | class DatastoreRolesSeeder extends Seeder |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Run the database seed. |
|
| 17 | - */ |
|
| 18 | - public function run() |
|
| 19 | - { |
|
| 15 | + /** |
|
| 16 | + * Run the database seed. |
|
| 17 | + */ |
|
| 18 | + public function run() |
|
| 19 | + { |
|
| 20 | 20 | |
| 21 | - // Create Roles |
|
| 22 | - $cms = Role::create(['name' => 'cms']); |
|
| 21 | + // Create Roles |
|
| 22 | + $cms = Role::create(['name' => 'cms']); |
|
| 23 | 23 | |
| 24 | - // Create Permissions |
|
| 25 | - $permissions = ['manage datastore']; |
|
| 24 | + // Create Permissions |
|
| 25 | + $permissions = ['manage datastore']; |
|
| 26 | 26 | |
| 27 | - foreach ($permissions as $permission) { |
|
| 28 | - Permission::create(['name' => $permission]); |
|
| 27 | + foreach ($permissions as $permission) { |
|
| 28 | + Permission::create(['name' => $permission]); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $cms->givePermissionTo('manage datastore'); |
| 32 | 32 | |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -10,41 +10,41 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class CreateDatastoreDatastoreTable extends Migration |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Run the migrations. |
|
| 15 | - * |
|
| 16 | - * @return void |
|
| 17 | - */ |
|
| 18 | - public function up() |
|
| 19 | - { |
|
| 20 | - Schema::create('datastore_datastore', function (Blueprint $table) { |
|
| 21 | - $table->bigIncrements('id'); |
|
| 22 | - $table->unsignedBigInteger('datastore_id')->nullable(); |
|
| 23 | - $table->unsignedBigInteger('datastore2_id')->nullable(); |
|
| 13 | + /** |
|
| 14 | + * Run the migrations. |
|
| 15 | + * |
|
| 16 | + * @return void |
|
| 17 | + */ |
|
| 18 | + public function up() |
|
| 19 | + { |
|
| 20 | + Schema::create('datastore_datastore', function (Blueprint $table) { |
|
| 21 | + $table->bigIncrements('id'); |
|
| 22 | + $table->unsignedBigInteger('datastore_id')->nullable(); |
|
| 23 | + $table->unsignedBigInteger('datastore2_id')->nullable(); |
|
| 24 | 24 | |
| 25 | 25 | $table->unique(['datastore2_id', 'datastore_id']); |
| 26 | - $table->index('datastore_id'); |
|
| 27 | - $table->index('datastore2_id'); |
|
| 26 | + $table->index('datastore_id'); |
|
| 27 | + $table->index('datastore2_id'); |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | - $table->foreign('datastore_id')->references('id')->on('datastore')->onDelete('CASCADE')->onUpdate('RESTRICT'); |
|
| 30 | + $table->foreign('datastore_id')->references('id')->on('datastore')->onDelete('CASCADE')->onUpdate('RESTRICT'); |
|
| 31 | 31 | $table->foreign('datastore2_id')->references('id')->on('datastore')->onDelete('CASCADE')->onUpdate('RESTRICT'); |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | - }); |
|
| 35 | + }); |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Reverse the migrations. |
|
| 43 | - * |
|
| 44 | - * @return void |
|
| 45 | - */ |
|
| 46 | - public function down() |
|
| 47 | - { |
|
| 48 | - Schema::dropIfExists('datastore_datastore'); |
|
| 49 | - } |
|
| 41 | + /** |
|
| 42 | + * Reverse the migrations. |
|
| 43 | + * |
|
| 44 | + * @return void |
|
| 45 | + */ |
|
| 46 | + public function down() |
|
| 47 | + { |
|
| 48 | + Schema::dropIfExists('datastore_datastore'); |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function up() |
| 19 | 19 | { |
| 20 | - Schema::create('datastore_datastore', function (Blueprint $table) { |
|
| 20 | + Schema::create('datastore_datastore', function(Blueprint $table) { |
|
| 21 | 21 | $table->bigIncrements('id'); |
| 22 | 22 | $table->unsignedBigInteger('datastore_id')->nullable(); |
| 23 | 23 | $table->unsignedBigInteger('datastore2_id')->nullable(); |
@@ -10,68 +10,68 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class CreateDatastoreTable extends Migration |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Run the migrations. |
|
| 15 | - * |
|
| 16 | - * @return void |
|
| 17 | - */ |
|
| 18 | - public function up() |
|
| 19 | - { |
|
| 20 | - Schema::create('datastore', function (Blueprint $table) { |
|
| 13 | + /** |
|
| 14 | + * Run the migrations. |
|
| 15 | + * |
|
| 16 | + * @return void |
|
| 17 | + */ |
|
| 18 | + public function up() |
|
| 19 | + { |
|
| 20 | + Schema::create('datastore', function (Blueprint $table) { |
|
| 21 | 21 | $table->bigIncrements('id'); |
| 22 | - $table->string('type', 255)->nullable(); |
|
| 23 | - $table->string('namespace', 255)->nullable(); |
|
| 24 | - $table->string('module', 255); |
|
| 25 | - $table->string('name', 255)->nullable(); |
|
| 26 | - $table->string('key', 255)->nullable(); |
|
| 27 | - $table->unsignedTinyInteger('private')->nullable()->default(0); |
|
| 28 | - $table->longText('value')->nullable(); |
|
| 29 | - $table->string('options', 255)->nullable(); |
|
| 30 | - $table->string('meta', 255)->nullable(); |
|
| 31 | - $table->string('accept', 255)->nullable()->comment('comma separated list of assets it accepts as related'); |
|
| 32 | - $table->string('accept_limit', 255)->nullable(); |
|
| 33 | - $table->unsignedBigInteger('datastore_id')->nullable(); |
|
| 34 | - $table->string('shortname', 255)->nullable(); |
|
| 35 | - $table->string('children', 255)->nullable(); |
|
| 36 | - $table->unsignedTinyInteger('is_child')->nullable(); |
|
| 37 | - $table->string('status', 255)->nullable(); |
|
| 38 | - $table->string('embedded', 255)->nullable(); |
|
| 39 | - $table->string('theme', 50)->nullable(); |
|
| 40 | - $table->text('meta_description')->nullable(); |
|
| 41 | - $table->text('meta_keywords')->nullable(); |
|
| 42 | - $table->text('page_css')->nullable(); |
|
| 43 | - $table->text('page_js')->nullable(); |
|
| 44 | - $table->string('limit', 20)->nullable(); |
|
| 45 | - $table->string('warning', 20)->nullable(); |
|
| 46 | - $table->string('callback', 255)->nullable(); |
|
| 47 | - $table->unsignedTinyInteger('required')->nullable(); |
|
| 48 | - $table->string('comment_equals', 255)->nullable(); |
|
| 49 | - $table->integer('max_instances')->nullable()->default(0); |
|
| 50 | - $table->date('start_date')->nullable(); |
|
| 51 | - $table->date('end_date')->nullable(); |
|
| 22 | + $table->string('type', 255)->nullable(); |
|
| 23 | + $table->string('namespace', 255)->nullable(); |
|
| 24 | + $table->string('module', 255); |
|
| 25 | + $table->string('name', 255)->nullable(); |
|
| 26 | + $table->string('key', 255)->nullable(); |
|
| 27 | + $table->unsignedTinyInteger('private')->nullable()->default(0); |
|
| 28 | + $table->longText('value')->nullable(); |
|
| 29 | + $table->string('options', 255)->nullable(); |
|
| 30 | + $table->string('meta', 255)->nullable(); |
|
| 31 | + $table->string('accept', 255)->nullable()->comment('comma separated list of assets it accepts as related'); |
|
| 32 | + $table->string('accept_limit', 255)->nullable(); |
|
| 33 | + $table->unsignedBigInteger('datastore_id')->nullable(); |
|
| 34 | + $table->string('shortname', 255)->nullable(); |
|
| 35 | + $table->string('children', 255)->nullable(); |
|
| 36 | + $table->unsignedTinyInteger('is_child')->nullable(); |
|
| 37 | + $table->string('status', 255)->nullable(); |
|
| 38 | + $table->string('embedded', 255)->nullable(); |
|
| 39 | + $table->string('theme', 50)->nullable(); |
|
| 40 | + $table->text('meta_description')->nullable(); |
|
| 41 | + $table->text('meta_keywords')->nullable(); |
|
| 42 | + $table->text('page_css')->nullable(); |
|
| 43 | + $table->text('page_js')->nullable(); |
|
| 44 | + $table->string('limit', 20)->nullable(); |
|
| 45 | + $table->string('warning', 20)->nullable(); |
|
| 46 | + $table->string('callback', 255)->nullable(); |
|
| 47 | + $table->unsignedTinyInteger('required')->nullable(); |
|
| 48 | + $table->string('comment_equals', 255)->nullable(); |
|
| 49 | + $table->integer('max_instances')->nullable()->default(0); |
|
| 50 | + $table->date('start_date')->nullable(); |
|
| 51 | + $table->date('end_date')->nullable(); |
|
| 52 | 52 | $table->string('lang', 255)->nullable(); |
| 53 | 53 | $table->timestamps(); |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | - $table->index('datastore_id', 'index_foreignkey_datastore'); |
|
| 58 | + $table->index('datastore_id', 'index_foreignkey_datastore'); |
|
| 59 | 59 | |
| 60 | - $table->foreign('datastore_id', 'datastore_ibfk_1')->references('id')->on('datastore')->onDelete('CASCADE')->onUpdate('RESTRICT'); |
|
| 60 | + $table->foreign('datastore_id', 'datastore_ibfk_1')->references('id')->on('datastore')->onDelete('CASCADE')->onUpdate('RESTRICT'); |
|
| 61 | 61 | |
| 62 | - }); |
|
| 62 | + }); |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Reverse the migrations. |
|
| 70 | - * |
|
| 71 | - * @return void |
|
| 72 | - */ |
|
| 73 | - public function down() |
|
| 74 | - { |
|
| 75 | - Schema::dropIfExists('datastore'); |
|
| 76 | - } |
|
| 68 | + /** |
|
| 69 | + * Reverse the migrations. |
|
| 70 | + * |
|
| 71 | + * @return void |
|
| 72 | + */ |
|
| 73 | + public function down() |
|
| 74 | + { |
|
| 75 | + Schema::dropIfExists('datastore'); |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function up() |
| 19 | 19 | { |
| 20 | - Schema::create('datastore', function (Blueprint $table) { |
|
| 20 | + Schema::create('datastore', function(Blueprint $table) { |
|
| 21 | 21 | $table->bigIncrements('id'); |
| 22 | 22 | $table->string('type', 255)->nullable(); |
| 23 | 23 | $table->string('namespace', 255)->nullable(); |
@@ -10,34 +10,34 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class CreateDatastoreCommentsTable extends Migration |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Run the migrations. |
|
| 15 | - * |
|
| 16 | - * @return void |
|
| 17 | - */ |
|
| 18 | - public function up() |
|
| 19 | - { |
|
| 20 | - Schema::create('datastore_comments', function (Blueprint $table) { |
|
| 21 | - $table->bigIncrements('id'); |
|
| 13 | + /** |
|
| 14 | + * Run the migrations. |
|
| 15 | + * |
|
| 16 | + * @return void |
|
| 17 | + */ |
|
| 18 | + public function up() |
|
| 19 | + { |
|
| 20 | + Schema::create('datastore_comments', function (Blueprint $table) { |
|
| 21 | + $table->bigIncrements('id'); |
|
| 22 | 22 | $table->bigInteger('user_id')->unsigned(); |
| 23 | - $table->bigInteger('datastore_id')->unsigned(); |
|
| 24 | - $table->bigInteger('parent_id')->unsigned()->nullable(); |
|
| 25 | - $table->text('body'); |
|
| 26 | - $table->timestamps(); |
|
| 27 | - $table->softDeletes(); |
|
| 28 | - }); |
|
| 23 | + $table->bigInteger('datastore_id')->unsigned(); |
|
| 24 | + $table->bigInteger('parent_id')->unsigned()->nullable(); |
|
| 25 | + $table->text('body'); |
|
| 26 | + $table->timestamps(); |
|
| 27 | + $table->softDeletes(); |
|
| 28 | + }); |
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | |
| 32 | - } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Reverse the migrations. |
|
| 36 | - * |
|
| 37 | - * @return void |
|
| 38 | - */ |
|
| 39 | - public function down() |
|
| 40 | - { |
|
| 41 | - Schema::dropIfExists('datastore_comments'); |
|
| 42 | - } |
|
| 34 | + /** |
|
| 35 | + * Reverse the migrations. |
|
| 36 | + * |
|
| 37 | + * @return void |
|
| 38 | + */ |
|
| 39 | + public function down() |
|
| 40 | + { |
|
| 41 | + Schema::dropIfExists('datastore_comments'); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function up() |
| 19 | 19 | { |
| 20 | - Schema::create('datastore_comments', function (Blueprint $table) { |
|
| 20 | + Schema::create('datastore_comments', function(Blueprint $table) { |
|
| 21 | 21 | $table->bigIncrements('id'); |
| 22 | 22 | $table->bigInteger('user_id')->unsigned(); |
| 23 | 23 | $table->bigInteger('datastore_id')->unsigned(); |
@@ -10,37 +10,37 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class CreateDatastorePagesTable extends Migration |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Run the migrations. |
|
| 15 | - * |
|
| 16 | - * @return void |
|
| 17 | - */ |
|
| 18 | - public function up() |
|
| 19 | - { |
|
| 20 | - Schema::create('datastore_pages', function (Blueprint $table) { |
|
| 21 | - $table->bigIncrements('id'); |
|
| 22 | - $table->string('title', 255)->nullable(); |
|
| 23 | - $table->string('slug', 255)->nullable(); |
|
| 24 | - $table->unsignedBigInteger('asset')->nullable()->default(0); |
|
| 25 | - |
|
| 26 | - |
|
| 27 | - |
|
| 28 | - $table->foreign('asset', 'datastore_asset_foreign_key')->references('id')->on('datastore')->onDelete('RESTRICT |
|
| 13 | + /** |
|
| 14 | + * Run the migrations. |
|
| 15 | + * |
|
| 16 | + * @return void |
|
| 17 | + */ |
|
| 18 | + public function up() |
|
| 19 | + { |
|
| 20 | + Schema::create('datastore_pages', function (Blueprint $table) { |
|
| 21 | + $table->bigIncrements('id'); |
|
| 22 | + $table->string('title', 255)->nullable(); |
|
| 23 | + $table->string('slug', 255)->nullable(); |
|
| 24 | + $table->unsignedBigInteger('asset')->nullable()->default(0); |
|
| 25 | + |
|
| 26 | + |
|
| 27 | + |
|
| 28 | + $table->foreign('asset', 'datastore_asset_foreign_key')->references('id')->on('datastore')->onDelete('RESTRICT |
|
| 29 | 29 | ')->onUpdate('RESTRICT'); |
| 30 | 30 | |
| 31 | - }); |
|
| 31 | + }); |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Reverse the migrations. |
|
| 39 | - * |
|
| 40 | - * @return void |
|
| 41 | - */ |
|
| 42 | - public function down() |
|
| 43 | - { |
|
| 44 | - Schema::dropIfExists('datastore_pages'); |
|
| 45 | - } |
|
| 37 | + /** |
|
| 38 | + * Reverse the migrations. |
|
| 39 | + * |
|
| 40 | + * @return void |
|
| 41 | + */ |
|
| 42 | + public function down() |
|
| 43 | + { |
|
| 44 | + Schema::dropIfExists('datastore_pages'); |
|
| 45 | + } |
|
| 46 | 46 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function up() |
| 19 | 19 | { |
| 20 | - Schema::create('datastore_pages', function (Blueprint $table) { |
|
| 20 | + Schema::create('datastore_pages', function(Blueprint $table) { |
|
| 21 | 21 | $table->bigIncrements('id'); |
| 22 | 22 | $table->string('title', 255)->nullable(); |
| 23 | 23 | $table->string('slug', 255)->nullable(); |
@@ -10,12 +10,12 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class DatastoreDatastoreRepository extends BaseRepository |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * @return string |
|
| 15 | - */ |
|
| 16 | - public function model() |
|
| 17 | - { |
|
| 18 | - return DatastoreDatastore::class; |
|
| 13 | + /** |
|
| 14 | + * @return string |
|
| 15 | + */ |
|
| 16 | + public function model() |
|
| 17 | + { |
|
| 18 | + return DatastoreDatastore::class; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function paginateAccepted($datastore_id, $status = NULL, $limit = 25, $pageName = 'page', $page = null){ |
@@ -18,12 +18,12 @@ |
||
| 18 | 18 | return DatastoreDatastore::class; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function paginateAccepted($datastore_id, $status = NULL, $limit = 25, $pageName = 'page', $page = null){ |
|
| 21 | + public function paginateAccepted($datastore_id, $status = NULL, $limit = 25, $pageName = 'page', $page = null) { |
|
| 22 | 22 | $this->where('datastore2_id', $datastore_id)->with('datastore'); |
| 23 | 23 | |
| 24 | 24 | $this->whereHas('datastore', function($query) use ($status) { |
| 25 | - if($status){ |
|
| 26 | - if(!is_array($status)){ |
|
| 25 | + if ($status) { |
|
| 26 | + if (!is_array($status)) { |
|
| 27 | 27 | $status = [$status]; |
| 28 | 28 | } |
| 29 | 29 | $query->whereIn('status', $status); |