Hi i'm new using Laravel and i have a form with a upload file button, but this is optional on my form, if i don't want to upload an image, my app stores one by default (no-image.jpg) and this image is in my storage_path, how i can get this path and assign it to my new record?
I tried this but it doesn't work:
if($request->infopath == null){
$request->infopath = public_path() . "/infopath"."/". 'no-image.jpg';
PreguntaAbierta::create($request->all());
Session::flash('store-success','Datos agregados correctamente!');
return redirect()->route('abierta.index');
}
'SOLUTION'
I finally found a solution , although an unorthodox but it does what I want, but I doubt remains =/ On my view:
@if($pregunta->infopath == null)
<td><img src="infopath/no-image.jpg" alt="" style="width:100px"/></td>
@endif
LOL