mercredi 27 juillet 2016

How to query db by uri id in laraval through user auth?

I'm just finished the intermediate laraval tutorial here: http://ift.tt/24a86XT and am trying to push on a bit.

While I can fetch all the tasks via auth'd user id with:

    public function index(Request $request)
    {
    $tasks = $request->user()->tasks()->get();

    return view('tasks', [
        'tasks' => $tasks,
    ]);
    }

I want to create a view function... how, if I create a link to /task/7 to I query the info about the task with id 7 (for example) & send it to the view?

Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire