Validate avatar upload on settings page
MODIFY
app/Http/Controllers/SettingsController.php
app/Http/Controllers/SettingsController.php
@@ -19,7 +19,10 @@ class SettingsController extends Controller {
}
public function store(Request $request) {
- // TODO VALIDATE
+ $request->validate([
+ 'avatar' => 'nullable|mimes:jpeg,jpg,png,gif'
+ // TODO VALIDATE OTHER FIELDS
+ ]);
$user = Auth::user();

MODIFY
resources/views/settings.blade.php
resources/views/settings.blade.php
<div>You don't have an avatar</div>
@endif
<input type="file" name="avatar" />
+ @include('partials.validation_error', ['payload' => 'avatar'])
</div>
<div class="input input--small">
<label>Name</label>

Validate avatar upload on settings page