@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <div class="row form-group"> |
| 2 | - <?php $key = isset($data['unique_id']) ? $data['key'] . '_' . $data['unique_id'] : $data['key'] ; ?> |
|
| 2 | + <?php $key = isset($data['unique_id']) ? $data['key'] . '_' . $data['unique_id'] : $data['key']; ?> |
|
| 3 | 3 | {{ html()->label($data['name'])->class('col-md-2 form-control-label')->for($key) }} |
| 4 | 4 | <div class="col-md-10"> |
| 5 | 5 | |
@@ -14,16 +14,16 @@ discard block |
||
| 14 | 14 | ->attribute('id', $key . '_file') |
| 15 | 15 | ->placeholder('Choose File') |
| 16 | 16 | ->class('form-control ams-upload-filename'); |
| 17 | - if($data['required']){ |
|
| 17 | + if ($data['required']) { |
|
| 18 | 18 | $input = $input->required(); |
| 19 | 19 | } |
| 20 | - if($asset_classname){ |
|
| 20 | + if ($asset_classname) { |
|
| 21 | 21 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
| 22 | - }else{ |
|
| 22 | + }else { |
|
| 23 | 23 | $name = $data['key']; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - $name .= (isset($multiform) && $multiform) ? '[]' : '';?> |
|
| 26 | + $name .= (isset($multiform) && $multiform) ? '[]' : ''; ?> |
|
| 27 | 27 | |
| 28 | 28 | {{ $input->name($name)->value(old($name, !empty($data['value']) ? $data['value'] : NULL)) }} |
| 29 | 29 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | } |
| 14 | 14 | if($asset_classname){ |
| 15 | 15 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
| 16 | - }else{ |
|
| 16 | + } else{ |
|
| 17 | 17 | $name = $data['key']; |
| 18 | 18 | } |
| 19 | 19 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <div class="row form-group"> |
| 2 | - <?php $key = isset($data['unique_id']) ? $data['key'] . '_' . $data['unique_id'] : $data['key'] ; ?> |
|
| 2 | + <?php $key = isset($data['unique_id']) ? $data['key'] . '_' . $data['unique_id'] : $data['key']; ?> |
|
| 3 | 3 | |
| 4 | 4 | {{ html()->label($data['name'])->class('col-md-2 form-control-label')->for($key) }} |
| 5 | 5 | <div class="col-md-10"> |
@@ -14,17 +14,17 @@ discard block |
||
| 14 | 14 | ->attribute('id', $key) |
| 15 | 15 | ->class('form-control autoinput'); |
| 16 | 16 | |
| 17 | - if($data['required']){ |
|
| 17 | + if ($data['required']) { |
|
| 18 | 18 | $input = $input->required(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if($asset_classname){ |
|
| 21 | + if ($asset_classname) { |
|
| 22 | 22 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
| 23 | - }else{ |
|
| 23 | + }else { |
|
| 24 | 24 | $name = $data['key']; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - $name .= (isset($multiform) && $multiform) ? '[]' : '';?> |
|
| 27 | + $name .= (isset($multiform) && $multiform) ? '[]' : ''; ?> |
|
| 28 | 28 | |
| 29 | 29 | {{ $input->name($name)->value(old($name, !empty($data['value']) ? $data['value'] : NULL)) }} |
| 30 | 30 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | |
| 21 | 21 | if($asset_classname){ |
| 22 | 22 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
| 23 | - }else{ |
|
| 23 | + } else{ |
|
| 24 | 24 | $name = $data['key']; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | - $user_labels = is_array($data['meta']) ? $data['meta'] : []; |
|
| 2 | + $user_labels = is_array($data['meta']) ? $data['meta'] : []; |
|
| 3 | 3 | $options = !empty($data['options']) ? $data['options'] : []; |
| 4 | 4 | |
| 5 | - $uid = $data['key'] . $data['unique_id']; |
|
| 6 | - if($asset_classname){ |
|
| 5 | + $uid = $data['key'] . $data['unique_id']; |
|
| 6 | + if ($asset_classname) { |
|
| 7 | 7 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
| 8 | 8 | $nameMeta = "assetInjectionform[{$asset_classname}][{$data['unique_id']}][_meta_][{$data['key']}]"; |
| 9 | - }else{ |
|
| 9 | + }else { |
|
| 10 | 10 | $name = $data['key']; |
| 11 | 11 | $nameMeta = "_meta_[{$data['key']}]"; |
| 12 | 12 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | if($asset_classname){ |
| 7 | 7 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
| 8 | 8 | $nameMeta = "assetInjectionform[{$asset_classname}][{$data['unique_id']}][_meta_][{$data['key']}]"; |
| 9 | - }else{ |
|
| 9 | + } else{ |
|
| 10 | 10 | $name = $data['key']; |
| 11 | 11 | $nameMeta = "_meta_[{$data['key']}]"; |
| 12 | 12 | } |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | {{ $datastore->render('content') }} |
| 10 | 10 | |
| 11 | 11 | |
| 12 | - <?php if($children):?> |
|
| 12 | + <?php if ($children):?> |
|
| 13 | 13 | <nav> |
| 14 | 14 | <div class="nav nav-tabs" id="asset-tab" role="tablist"> |
| 15 | - <?php foreach($children as $idx => $child): ?> |
|
| 16 | - <a class="nav-item nav-link<?php echo $idx === 0 ?' active' : '';?>" id="child-{{ $idx }}-tab" data-toggle="tab" href="#asset-{{ $idx }}" role="tab" aria-controls="asset-{{ $idx }}" aria-selected="true">{{ $child->prop('title') }}</a> |
|
| 15 | + <?php foreach ($children as $idx => $child): ?> |
|
| 16 | + <a class="nav-item nav-link<?php echo $idx === 0 ? ' active' : ''; ?>" id="child-{{ $idx }}-tab" data-toggle="tab" href="#asset-{{ $idx }}" role="tab" aria-controls="asset-{{ $idx }}" aria-selected="true">{{ $child->prop('title') }}</a> |
|
| 17 | 17 | <?php endforeach; ?> |
| 18 | 18 | |
| 19 | 19 | </div> |
| 20 | 20 | </nav> |
| 21 | 21 | <div class="tab-content" id="asset-tabContent"> |
| 22 | - <?php foreach($children as $idx => $child): ?> |
|
| 22 | + <?php foreach ($children as $idx => $child): ?> |
|
| 23 | 23 | <div class="tab-pane fade<?php echo $idx === 0 ? ' show active' : ''; ?>" id="asset-{{ $idx }}" role="tabpanel" aria-labelledby="asset-{{ $idx }}-tab"> |
| 24 | 24 | {{ $child->prop('content')}} |
| 25 | 25 | </div> |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | public function parent() |
| 22 | - { |
|
| 23 | - return $this->belongsTo(DatastoreModel::class, 'datastore2_id'); |
|
| 22 | + { |
|
| 23 | + return $this->belongsTo(DatastoreModel::class, 'datastore2_id'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function page() |
@@ -29,15 +29,15 @@ |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
| 32 | - public function datastore(){ |
|
| 32 | + public function datastore() { |
|
| 33 | 33 | return $this->belongsTo(DatastoreModel::class, 'datastore_id'); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function getItemAttribute(){ |
|
| 36 | + public function getItemAttribute() { |
|
| 37 | 37 | return $this->datastore->datastore; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function prop($key){ |
|
| 40 | + public function prop($key) { |
|
| 41 | 41 | return $this->item->prop($key); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | 'asset' |
| 20 | 20 | ]; |
| 21 | 21 | |
| 22 | - public function getDatastoreAttribute(){ |
|
| 22 | + public function getDatastoreAttribute() { |
|
| 23 | 23 | return $this->id ? Datastore::getAssetById($this->asset) : null; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -11,37 +11,37 @@ |
||
| 11 | 11 | { |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @return string |
|
| 15 | - */ |
|
| 16 | - public function getEditButtonAttribute() |
|
| 17 | - { |
|
| 18 | - return '<a href="'.route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]).'" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.edit').'" class="btn btn-primary"><i class="fas fa-edit"></i></a>'; |
|
| 14 | + * @return string |
|
| 15 | + */ |
|
| 16 | + public function getEditButtonAttribute() |
|
| 17 | + { |
|
| 18 | + return '<a href="'.route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]).'" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.edit').'" class="btn btn-primary"><i class="fas fa-edit"></i></a>'; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * @return string |
|
| 23 | - */ |
|
| 24 | - public function getDeleteButtonAttribute() |
|
| 25 | - { |
|
| 22 | + * @return string |
|
| 23 | + */ |
|
| 24 | + public function getDeleteButtonAttribute() |
|
| 25 | + { |
|
| 26 | 26 | |
| 27 | - return '<a href="'.route('admin.ams.content.destroy', $this).'" |
|
| 27 | + return '<a href="'.route('admin.ams.content.destroy', $this).'" |
|
| 28 | 28 | data-method="delete" |
| 29 | 29 | data-trans-button-cancel="'.__('buttons.general.cancel').'" |
| 30 | 30 | data-trans-button-confirm="'.__('buttons.general.crud.delete').'" |
| 31 | 31 | data-trans-title="'.__('strings.backend.general.are_you_sure').'" |
| 32 | 32 | class="btn btn-danger"><i class="fas fa-trash" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.delete').'"></i></a> '; |
| 33 | 33 | |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @return string |
|
| 38 | - */ |
|
| 39 | - public function getActionButtonsAttribute() |
|
| 40 | - { |
|
| 36 | + /** |
|
| 37 | + * @return string |
|
| 38 | + */ |
|
| 39 | + public function getActionButtonsAttribute() |
|
| 40 | + { |
|
| 41 | 41 | |
| 42 | 42 | if($this->id) |
| 43 | 43 | { |
| 44 | - return '<div class="btn-group" role="group" aria-label="'.__('labels.backend.access.users.user_actions').'"> |
|
| 44 | + return '<div class="btn-group" role="group" aria-label="'.__('labels.backend.access.users.user_actions').'"> |
|
| 45 | 45 | '.$this->edit_button.' |
| 46 | 46 | '.$this->delete_button.' |
| 47 | 47 | </div>'; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function getEditButtonAttribute() |
| 17 | 17 | { |
| 18 | - return '<a href="'.route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]).'" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.edit').'" class="btn btn-primary"><i class="fas fa-edit"></i></a>'; |
|
| 18 | + return '<a href="' . route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]) . '" data-toggle="tooltip" data-placement="top" title="' . __('buttons.general.crud.edit') . '" class="btn btn-primary"><i class="fas fa-edit"></i></a>'; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | public function getDeleteButtonAttribute() |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - return '<a href="'.route('admin.ams.content.destroy', $this).'" |
|
| 27 | + return '<a href="' . route('admin.ams.content.destroy', $this) . '" |
|
| 28 | 28 | data-method="delete" |
| 29 | - data-trans-button-cancel="'.__('buttons.general.cancel').'" |
|
| 30 | - data-trans-button-confirm="'.__('buttons.general.crud.delete').'" |
|
| 31 | - data-trans-title="'.__('strings.backend.general.are_you_sure').'" |
|
| 32 | - class="btn btn-danger"><i class="fas fa-trash" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.delete').'"></i></a> '; |
|
| 29 | + data-trans-button-cancel="'.__('buttons.general.cancel') . '" |
|
| 30 | + data-trans-button-confirm="'.__('buttons.general.crud.delete') . '" |
|
| 31 | + data-trans-title="'.__('strings.backend.general.are_you_sure') . '" |
|
| 32 | + class="btn btn-danger"><i class="fas fa-trash" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.delete') . '"></i></a> '; |
|
| 33 | 33 | |
| 34 | 34 | } |
| 35 | 35 | |
@@ -39,16 +39,16 @@ discard block |
||
| 39 | 39 | public function getActionButtonsAttribute() |
| 40 | 40 | { |
| 41 | 41 | |
| 42 | - if($this->id) |
|
| 42 | + if ($this->id) |
|
| 43 | 43 | { |
| 44 | - return '<div class="btn-group" role="group" aria-label="'.__('labels.backend.access.users.user_actions').'"> |
|
| 45 | - '.$this->edit_button.' |
|
| 46 | - '.$this->delete_button.' |
|
| 44 | + return '<div class="btn-group" role="group" aria-label="' . __('labels.backend.access.users.user_actions') . '"> |
|
| 45 | + '.$this->edit_button . ' |
|
| 46 | + '.$this->delete_button . ' |
|
| 47 | 47 | </div>'; |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function getContentPathAttribute(){ |
|
| 51 | + public function getContentPathAttribute() { |
|
| 52 | 52 | return Helpers::getPath($this->type); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -59,20 +59,20 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | }*/ |
| 61 | 61 | |
| 62 | - public function getDatastoreAttribute(){ |
|
| 63 | - if($this->id){ |
|
| 62 | + public function getDatastoreAttribute() { |
|
| 63 | + if ($this->id) { |
|
| 64 | 64 | return DatastoreFactory::getAsset($this->type, $this->id); |
| 65 | 65 | } |
| 66 | - if($this->type){ |
|
| 66 | + if ($this->type) { |
|
| 67 | 67 | return DatastoreFactory::dispence($this->type); |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function getRouteAttribute(){ |
|
| 71 | + public function getRouteAttribute() { |
|
| 72 | 72 | return $this->type ? Helpers::callStatic($this->type, 'route', [$this]) : null; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function routeChild($parentSlug){ |
|
| 75 | + public function routeChild($parentSlug) { |
|
| 76 | 76 | return $this->type ? Helpers::callStatic($this->type, 'route', [$this, $parentSlug]) : null; |
| 77 | 77 | |
| 78 | 78 | } |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | protected $table = 'datastore'; |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @var array |
|
| 21 | - */ |
|
| 22 | - protected $dates = [ |
|
| 23 | - 'start_date', |
|
| 20 | + * @var array |
|
| 21 | + */ |
|
| 22 | + protected $dates = [ |
|
| 23 | + 'start_date', |
|
| 24 | 24 | 'end_date', |
| 25 | 25 | 'updated_at', |
| 26 | 26 | 'created_at' |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | public function properties() |
| 31 | - { |
|
| 32 | - return $this->hasMany(Datastore::class); |
|
| 33 | - } |
|
| 31 | + { |
|
| 32 | + return $this->hasMany(Datastore::class); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | public function assets() |
| 36 | 36 | { |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * The has Many Relationship |
|
| 57 | - * |
|
| 58 | - * @var array |
|
| 59 | - */ |
|
| 60 | - public function comments() |
|
| 61 | - { |
|
| 62 | - return $this->hasMany(DatastoreComments::class)->whereNull('parent_id'); |
|
| 63 | - } |
|
| 56 | + * The has Many Relationship |
|
| 57 | + * |
|
| 58 | + * @var array |
|
| 59 | + */ |
|
| 60 | + public function comments() |
|
| 61 | + { |
|
| 62 | + return $this->hasMany(DatastoreComments::class)->whereNull('parent_id'); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | |
@@ -42,11 +42,11 @@ |
||
| 42 | 42 | return $this->hasOne(DatastorePages::class, 'asset'); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function items(){ |
|
| 45 | + public function items() { |
|
| 46 | 46 | return $this->hasMany(DatastoreDatastore::class, 'datastore2_id', 'id'); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function parents(){ |
|
| 49 | + public function parents() { |
|
| 50 | 50 | return $this->hasManyThrough(self::class, DatastoreDatastore::class, 'datastore_id', 'id', 'id', 'datastore2_id'); |
| 51 | 51 | |
| 52 | 52 | } |
@@ -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 |