For a school project I am trying to remove Eloquent from the core of my project (have to work directly with DB, cannot use ORM).
I am now trying to modify the create function of the AuthController, but it does not seem to be updating. (Using XAMPP with PHP7.)
As you can see I tried to replace the User::create default with the DB::insert statement inside of AuthController's create function.
protected function create(array $data)
{
return DB::insert('INSERT INTO users (firstname,lastname,birthday,gender,email,password) values(?,?,?,?,?,?)',
array(
$data['firstname'],
$data['lastname'],
$data['birthday'],
$data['gender'],
$data['email'],
bcrypt($data['password'])
)
);
// OLD FUNCTION BODY:
/*return User::create([
'firstname' => $data['firstname'],
'lastname' => $data['lastname'],
'birthday' => $data['birthday'],
'gender' => $data['gender'],
'email' => $data['email'],
'password' => bcrypt($data['password'])
]);*/
}
But now I keep getting:
FatalThrowableError in AuthController.php line 71: Fatal error: Call to undefined method App\User::create()
I believe that the function needs more than DB::insert, as it says, that it should return a new instance of the User object, but at the moment I cannot even test what this would do as it is still trying to call the old function body. I have even deleted the User::create section alltogether.
Is this a XAMP thing? I had no problem updating and saving other files of this project, but this controller does not make it through it seems like.