I have a function to execute some database input then send notification to a user, the problem is when i execute the send notification to a user is taking some time, i need this process to run in background but i don't know how to do it, here is my code:
public function execute(){
$data = $this->insertToDatabase();
$this->sendNotification($data); //this function takes a lot of time
return $data;
}