just use the helper function
if(request()->hasFile('profilepic'))
https://stackoverflow.com/questions/41961855/user-registration-in-laravel-request-or-array
Hi,
I'm trying to add an image upload field on User's registration.
The RegistrationController's create function seems to take 'array' as an argument instead of 'request' Looks like :
protected function create(array $data)
So here, when i do :
if($data->hasFile('profilepic'))
When the register.blade.php has a simple file input field :
<input type="file" class="form-control @error('profilepic') is-invalid @enderror" name="profilepic" >
It given an error :
Call to a member function hasFile() on array
How can i call hasFile() on this function... and why is the parameter array instead of request here?
Many thanks!
just use the helper function
if(request()->hasFile('profilepic'))
https://stackoverflow.com/questions/41961855/user-registration-in-laravel-request-or-array
Please or to participate in this conversation.