We have hardcoded the values to be created in the database
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
Link::create([
'url' => 'www.example.com',
'description' => 'lorem upsum',
'user_id' => '7'
]);
return redirect()->route('links.index')
->with('success', 'Subdefined task update successfully');
}
but what you really want to do is make this dynamic using a form.
You need to grab the form request and a helper function.
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
Link::create([
'url' => $request->url,
'description' => $request->url,
'user_id' => auth()->user()->id
]);
return redirect()->route('links.index')
->with('success', 'Subdefined task update successfully');
}
- Log in to post comments