Argument 1 passed to App\Candidate::fileUpload() must be an instance of Illuminate\Http\Request, instance of Illuminate\Http\UploadedFile given, called in C:\xampp\htdocs\Laravel-voting-system\app\Candidate.php on line 40
please I don't know where am getting it wrong this is where I wrote the fill upload function(candidate.php)
The second image is the downward path of the same folder candidate.php
this my user.php for your view
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password','regno'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function role(){
return $this->belongsTo('App\Role');
}
public function candidate(){
return $this->hasOne('App\Candidate');
}
public function registerVoter($name,$email,$password,$regno){
$newVoter = new User;
$newVoter->name = $name;
$newVoter->email = $email;
$newVoter->password = bcrypt($password);
$newVoter->regno = $regno;
$newVoter->role_id = 2;
$newVoter->save();
}
public static function addCandidate($studentId,$seat,$image){
$user = User::find($studentId);
(new Candidate)->add($user->name,$seat,$user->regno,$user->id,$image,);
}
And my AdminController.php
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password','regno'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function role(){
return $this->belongsTo('App\Role');
}
public function candidate(){
return $this->hasOne('App\Candidate');
}
public function registerVoter($name,$email,$password,$regno){
$newVoter = new User;
$newVoter->name = $name;
$newVoter->email = $email;
$newVoter->password = bcrypt($password);
$newVoter->regno = $regno;
$newVoter->role_id = 2;
$newVoter->save();
}
public static function addCandidate($studentId,$seat,$image){
$user = User::find($studentId);
(new Candidate)->add($user->name,$seat,$user->regno,$user->id,$image,);
}
I really appreciate your efforts, Thanks in Advance.