I want to make store eloquent to be more simplified to something like this:
$keyword = Keyword::create([
'keyword' => $request->input('keyword'),
'micro_price' => $request->input('micro_price'),
'macro_price' => $request->input('macro_price'),
'cmd' => $request->input('cmd'),
]);
Instead of this:
$keyword = new Keyword;
$keyword->keyword = $request->input('keyword');
$keyword->micro_price = $request->input('micro_price');
$keyword->macro_price = $request->input('macro_price');
$keyword->cmd = $request->input('cmd');
$keyword->user()->associate(Auth::user());
$keyword->server()->associate($request->input('title'));
$keyword->save();
But there is a problem that I have in keywords database table with 2 foreign keys (server_id and user_id) and I want that my eloquent model assign these 2 foreign keys properly, but I have no idea how to make that in simplified version.
Thanks in advance for help !