My form:
<form action="{{route('settings.update')}}" method="POST">
@csrf
<div class="col-sm-3">
<div class="form-group">
<label for="avatar">Upload a new one:</label>
<input type="file" id="pic" name="pic"/>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Upload avatar</button>
</div>
</form>
My Controller:
public function update_settings($request)
{
$this->validate($request, [
'pic' => 'required|image'
]);
$path = $request->image->store('/img/');
Auth::user()->image = $path;
return view('pages.settings');
}
The error:
Too few arguments to function App\Http\Controllers\PagesController::update_settings(), 0 passed and exactly 1 expected
I am passing only the image file in the $request, but for some reason the controller doesn't see it, what am I doing incorrectly?