I have a form that will send data like title, demo, text. These fields can be inserted by the user but I have user_id in the table that should automatically be inserted by the framework itself. I don't want to create <input type='hidden' name='user_id' value='{{Auth::user()->id}}'> because it is NOT safe at all. How can I fill up user_id automatically when a user has to fill the form?
Controller
public function store(Request $request)
{
//TODO: ADD user_id to this data and insert into tbl
$v_data = $request->validate([
'title' => 'required|min:5',
'demo' => 'required',
'text' => 'required',
'category' => 'required|numeric',
]);
Post::create($v_data);
return redirect()->back();
}