Is it okay to send Request $request object between the functions?
My Request $request object consists of around 20 inputs. At first in 'store' function, I save about 10 inputs. Then I pass this $request object to another function where I save remaining inputs. The purpose behind second function is so that I can use this function for another route if only next 10 fields are to be stored.
I know that the $request object is very large, consuming so much memory. So it is good to send the $request object function to function when considered space complexity and time complexity?
//My Controller
class MyController extends Controller{
public function store(Request $request){
//save 10 inputs
$this->saveTasks($request);
}
public function saveTasks(Request $request){
//save remaining 10 inputs
}
}
// routes/web.php
Route::post('store', 'MyController@store');
Route::post('store_tasks', 'MyController@saveTasks');
Thanks in advance :)