public function store(Request $request)
{
$this->validate($request, [
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
]);
$article = new Carouseleinfos();
if ($request->hasFile('images')) {
$dir = public_path('/images/carousele');
$extension = strtolower($request->file('images')->getClientOriginalExtension()); // get image extension
$fileName = str_random() . '.' . $extension; // rename image
$request->file('images')->move($dir, $fileName);
$image->images = $fileName;
}
$article->text1 = $request->get('text1');
$article->text2 = $request->get('text2');
$article->images = str_slug($request->get('images'));
$article->textbutton = $request->get('textbutton');
$article->linkbutton = $request->get('linkbutton');
$article->save();
return view('crud_4/index');
}
}
public function store(Request $request) {
$this->validate($request, [
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
]);
$article = new Carouseleinfos();
if ($request->hasFile('images')) {
$dir = public_path('/images/carousele');
$extension = strtolower($request->file('images')->getClientOriginalExtension()); // get image extension
$fileName = str_random() . '.' . $extension; // rename image
$path_image = $dir . $fileName;
$request->file('images')->move($dir, $fileName);
$image->images = $fileName;
}
$article->text1 = $request->get('text1');
$article->text2 = $request->get('text2');
$article->images = str_slug($request->get('images')); // возможно тут сохранить путь к файлу $path_image
$article->textbutton = $request->get('textbutton');
$article->linkbutton = $request->get('linkbutton');
$article->save();
return view('crud_4/index');
}
}