I just made a module and menu about user data. In the controller, i made a laravel query to insert into my database table inside hook_before_add function. The problem is, after I hit the save button, the controller insert 2 records. Is it possible to use only my query to insert? Because All I need to do is to use my own laravel query to insert into my table because I need encrypt the password field with my custom encryption function(my company's standard password encryption) there. Can anyone help me, please?
public function hook_before_add(&$postdata) {
//Your code here
$password = Request::get('password');
DB::table('user_personal')->insert([
'email'=> Request::get('email'),
'password'=> '',//$this->myencryptionfunction($password),
'fullname'=> Request::get('fullname'),
'phone'=> Request::get('phone'),
'company'=> Request::get('company'),
'status'=> Request::get('status'),
'created_at'=> now()
]);
//return Route::get('/admin/users');
return Route::redirect('/admin/users', true);
}