Skip to content

Commit 36bafb9

Browse files
committed
added subtitle to category
1 parent 36cb6a8 commit 36bafb9

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

database/migrations/create_starter_kit_table.php.stub

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class CreateStarterKitTable extends Migration
1212
$table->id();
1313
$table->string('name', 128);
1414
$table->string('slug', 128)->unique();
15+
$table->string('subtitle')->nullable();
1516
$table->text('description')->nullable();
1617
$table->integer('sort')->default(0);
1718
$table->unsignedInteger('parent_id')->nullable()->default(null)->index();

resources/views/admin/category/categoryForm.blade.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
<input name="name" type="text" class="form-control @error('name') is-invalid @enderror"
3131
placeholder="{{__('Category name')}}" value="{{old('name',$ccat->name??null)}}"/>
3232
</div>
33+
<div class="col-md-8 mt-3">
34+
<label for="subtitle">
35+
{{__('Subtitle')}}
36+
</label>
37+
<input name="subtitle" type="text" class="form-control @error('subtitle') is-invalid @enderror"
38+
placeholder="{{__('Subtitle')}}" value="{{old('subtitle',$ccat->subtitle??null)}}"/>
39+
</div>
3340
<div class="col-md-8 mt-3">
3441
<label for="parent">
3542
{{__('Category Parent')}}

src/Controllers/Admin/CategoryController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function createOrUpdate(Category $cat, CategorySaveRequest $request)
2323
$cat->name = $request->input('name');
2424
$cat->slug = \StarterKit::slug($request->input('name'));
2525
$cat->description = $request->input('description');
26+
$cat->subtitle = $request->input('subtitle');
2627
$cat->parent_id = $request->input('parent') == '' ? null : $request->input('parent');
2728
$cat->save();
2829

src/Models/Category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Category extends Model
4141
{
4242
use SoftDeletes,HasTranslations;
4343

44-
public $translatable = ['name','description'];
44+
public $translatable = ['name','description','subtitle'];
4545
public function posts()
4646
{
4747
return $this->belongsToMany(Post::class);

0 commit comments

Comments
 (0)