storage url o'zgartirildi
This commit is contained in:
@@ -40,14 +40,14 @@ class Update extends FormRequest
|
||||
return Str::slug($this->get('name')['uz']);
|
||||
}
|
||||
|
||||
public function getImage(Category $category): string
|
||||
public function getImage(Category $category): ?string
|
||||
{
|
||||
if ($this->hasFile('image')) {
|
||||
Storage::delete($category->image);
|
||||
return (string) $this->file('image')->store('uploads/categories');
|
||||
} else {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
return $category->image;
|
||||
}
|
||||
|
||||
public function getFilterPower()
|
||||
|
||||
@@ -22,7 +22,8 @@ class Store extends FormRequest
|
||||
return [
|
||||
'title' => 'array',
|
||||
'title.*' => 'required',
|
||||
'published' => 'required',
|
||||
'published' => 'nullable',
|
||||
'products' => 'nullable|array',
|
||||
//'category_id' => 'required'
|
||||
];
|
||||
}
|
||||
@@ -40,7 +41,7 @@ class Store extends FormRequest
|
||||
*/
|
||||
public function getPublished(): bool
|
||||
{
|
||||
return $this->get('published');
|
||||
return filter_var($this->get('published', false), FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +50,8 @@ class Store extends FormRequest
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
if ($this->get('category_id')) {
|
||||
$this->get('category_id');
|
||||
if ($this->get('category_id') && $this->get('category_id') != 0) {
|
||||
return $this->get('category_id');
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -22,7 +22,8 @@ class Update extends FormRequest
|
||||
return [
|
||||
'title' => 'array',
|
||||
'title.*' => 'required',
|
||||
'published' => 'required',
|
||||
'published' => 'nullable',
|
||||
'products' => 'nullable|array',
|
||||
//'category_id' => 'required',
|
||||
];
|
||||
}
|
||||
@@ -40,14 +41,14 @@ class Update extends FormRequest
|
||||
*/
|
||||
public function getPublished(): bool
|
||||
{
|
||||
return $this->get('published');
|
||||
return filter_var($this->get('published', false), FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
|
||||
public function getCategory()
|
||||
{
|
||||
if ($this->get('category_id')) {
|
||||
$this->get('category_id');
|
||||
if ($this->get('category_id') && $this->get('category_id') != 0) {
|
||||
return $this->get('category_id');
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user