Description
actually issue is that when hr registered new employee when i submit this record it will give error like this "Illuminate\Database\Grammar::parameterize(): Argument #1 ($values) must be of type array, string given, called in F:\loyaloid-main\vendor\laravel\framework\src\Illuminate\Database\Query\Grammars\Grammar.php on line 1047" at $user=new User;
$user->username = $this->_request->username;
$user->email =$this->_request->email;
// $user->password=$hashedPassword;
$user->save(); at this line i am facing issue i also attached screen shot please sir i try a lot of solution but no one work please help me
View Code
public function store()
{
// $password = Str::random(8);
// $hashedPassword = Hash::make($password);
$user=new User;
$user->username = $this->_request->username;
$user->email =$this->_request->email;
// $user->password=$hashedPassword;
$user->save();
$data = $this->_request->except(['_token', 'username', 'email', 'save_button']);
$data['user_id'] = $user->id;
$this->_dealHrUser->forceFill($data);
$this->_dealHrUser->save();
return redirect()->back()->with('success', 'Employee created successfully');
}
The above code is fine, after saving the employee you are passing it as a string instead of an array, see the below code.
~~~
$this->_dealHrUser->forceFill($data); // error is there
~~~
I am not sure that the what dealHrUser function does but problem in these lines, because it's accepting as an array and you are passing it string, so dd your data that what it's returning.
If still not solved update your post with full controller code.
0 Likes 0 Comments