I have 3 boards
Users table fields: id,
processes table fields: id, user_id ("user_id" is related to the users table)
Histories table fields: id, processes_id ("processes_id" is related to the processes table)
users has many processes(processes)
processes has many histories
histories has a single processes(process)
what I want to do is:
Fetch the data
history
that is related toprocesses-user_id
the logged in user
I bring the processes in the following way in the controller:
$processes = Auth::user()->processes;
return view('processes.index', compact('processes'));
But with stories I couldn't
Here the dd of the answer
This is what appears to me when I put $data
First you need to have the models of your 3 entities respectively:
Models
Now:
where
to search for equalityuser_id
with the variable that stores the id of the current sessionProposal
We use
use
to pass the variable$user
to the context of the function that will use it