Я хочу добавить товар из админ-панели и показать его на личиночном сайте. За вышеуказанной работой я следил. Но после отправки формы отображается пустое окно. Кто-нибудь может найти ошибку?
ProductController:
public function store(Request $request)
{
$image = new Image();
$this->validate($request, [
'name' => 'required',
'price' => 'required'
]);
$image->name = $request->name;
$image->description = $request->description;
$image->price = $request->price;
$image->imageurl = $request->imageurl;
if($request->hasFile('product_image')) {
$file = Input::file('product_image');
//getting timestamp
$timestamp = str_replace([' ', ':'], '-', Carbon::now()->toDateTimeString());
$name = $timestamp. '-' .$file->getClientOriginalName();
$image->filePath = $name;
$file->move(public_path().'/assets/productimage/', $name);
}
$image->save();
return redirect('admin/products');
}
Product.php(модель):
class Product extends Model
{
protected $table ='products';
protected $fillable = [
'name',
'description',
'price',
'imageurl',
'product_image'
];
}
new.blade.php(view):
Подробнее здесь: https://stackoverflow.com/questions/359 ... -laravel-5