i'm trying to get the last username who update the form using LARAVEL AUDITING but i always end up with this error "Method audits does not exist." but in my database audit already exist and working but i can't make it work in my controller..
Controller: (eg. I'm trying to get the last user who updated the table)
public function show($id, Request $request)
{
//
$leads = Lead::findOrFail($id);
$diff = $request->audits()->with('user')->get()->last();
// show the view and pass the nerd to it
return view('leads.show')->with('leads', $leads)->withDiff($diff);;
}
Blade:
<div> Revision by <strong>{{ $diff->user->name }}</strong></div>
i found the answer by my self i did some mistakes..
Controller:
public function show($id, Request $request)
{
$leads = Lead::findOrFail($id)->audits()->with('user')->get()->last();
return view('leads.show')->with('leads', $leads);
}