Skip to content

Commit b526e2e

Browse files
committed
update
1 parent b1e8a6e commit b526e2e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/Http/Controllers/Admin/CategoryController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ public function store(Request $request)
8383
$gender_name = "";
8484

8585
if($request->parent_id == null){
86-
$category = new Category;
86+
$category = new Category;
8787
$category->category_name = $request->category_name;
8888
$category->category_url = \Illuminate\Support\Str::slug($request->category_name);
8989

90-
if($request->category_profile){
90+
if($request->category_profile != null){
9191
$file=$request->file('category_profile');
9292
$category->category_profile = $file->store('categories/profile', 'public');
9393
}
@@ -273,4 +273,4 @@ private function deleteCategoryRecursively(Category $category)
273273
// Supprimer la catégorie
274274
$category->delete();
275275
}
276-
}
276+
}

app/Models/Category.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class Category extends Model
1313
{
1414
use HasFactory;
1515

16+
protected $fillable =[
17+
'category_name',
18+
'gender_id'
19+
];
1620
public function products():BelongsToMany{
1721
return $this->belongsToMany(Product::class);
1822
}

0 commit comments

Comments
 (0)