added additional field to category
This commit is contained in:
parent
702ef4410a
commit
f7a89da0c7
|
|
@ -26,6 +26,9 @@ class Category extends JsonResource
|
|||
'meta_keywords' => $this->meta_keywords,
|
||||
'status' => $this->status,
|
||||
'image_url' => $this->image_url,
|
||||
'additional' => is_array($this->resource->additional)
|
||||
? $this->resource->additional
|
||||
: json_decode($this->resource->additional, true),
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAdditionalToCategory extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('categories', function (Blueprint $table) {
|
||||
$table->json('additional')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('categories', function (Blueprint $table) {
|
||||
$table->dropColumn('additional');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,13 @@ class Category extends TranslatableModel implements CategoryContract
|
|||
'meta_keywords',
|
||||
];
|
||||
|
||||
protected $fillable = ['position', 'status', 'display_mode', 'parent_id'];
|
||||
protected $fillable = [
|
||||
'position',
|
||||
'status',
|
||||
'display_mode',
|
||||
'parent_id',
|
||||
'additional',
|
||||
];
|
||||
|
||||
protected $with = ['translations'];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue