@@ -9,36 +9,36 @@ |
||
| 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 | - { |
|
| 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 | 30 | $user = config('auth.providers.users.model'); |
| 31 | - return $this->belongsTo($user); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * The has Many Relationship |
|
| 36 | - * |
|
| 37 | - * @var array |
|
| 38 | - */ |
|
| 39 | - public function replies() |
|
| 40 | - { |
|
| 41 | - return $this->hasMany(DatastoreComments::class, 'parent_id'); |
|
| 42 | - } |
|
| 31 | + return $this->belongsTo($user); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * The has Many Relationship |
|
| 36 | + * |
|
| 37 | + * @var array |
|
| 38 | + */ |
|
| 39 | + public function replies() |
|
| 40 | + { |
|
| 41 | + return $this->hasMany(DatastoreComments::class, 'parent_id'); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -5,8 +5,8 @@ discard block |
||
| 5 | 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | 6 | use Phpsa\Datastore\Models\Datastore as DatastoreModel; |
| 7 | 7 | /** |
| 8 | - * @property Object $item |
|
| 9 | - */ |
|
| 8 | + * @property Object $item |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | class DatastoreDatastore extends Model |
| 12 | 12 | { |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | public function parent() |
| 26 | - { |
|
| 27 | - return $this->belongsTo(DatastoreModel::class, 'datastore2_id'); |
|
| 26 | + { |
|
| 27 | + return $this->belongsTo(DatastoreModel::class, 'datastore2_id'); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function page() |
@@ -33,11 +33,11 @@ |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
| 36 | - public function datastore(){ |
|
| 36 | + public function datastore() { |
|
| 37 | 37 | return $this->belongsTo(DatastoreModel::class, 'datastore_id'); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function getItemAttribute(){ |
|
| 40 | + public function getItemAttribute() { |
|
| 41 | 41 | return $this->datastore->datastore; |
| 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 ? DatastoreCore::getAssetById($this->asset) : null; |
| 24 | 24 | } |
| 25 | 25 | |