Bonjour,
Voila je rencontre un petit problème avec mon code.
Mon controlleur
public function store(Request $request)
{
foreach(Input::file('file') as $file){
$destinationPath = 'assets/image_marque'; // upload path
$title = $file->getClientOriginalName();
$file->move($destinationPath, $title); // uploading file to given path
$marque = New Marque();
$marque->title = $request->get('title');
$marque->infos = $request->get('infos');
$marque->image = $destinationPath.'/'.$title;
$marque->save();
}
return redirect ('marques');
}
la vue
{!! Form::open(array('action' => 'MarqueController@store', 'method' => 'post' )) !!}
<input type="hidden" name="user_id" value="1">
<div class="form-group m-b-20">
<label for="nom">Marque</label>
<input type="text" class="form-control" name='title' >
</div>
<div class="form-group m-b-20">
<label for="image">Image</label>
<input type="file" name="file[]" multiple id="filer_input1" >
</div>
<div class="form-group m-b-20">
<label for="role">Infos</label><br>
<textarea name="infos" rows="7" cols="135"></textarea>
</div>
<button type="submit" class="btn btn-success waves-effect waves-light">Enregistrer et publier</button>
<a href="{{ url('marques')}}" class="btn btn-danger waves-effect waves-light" >Annuler</a>
{!! Form::close() !!}
je rencontre cet erreur
Invalid argument supplied for foreach()