1👍
✅
if I understand your question correctly. I think you can do something like this.
public function details($id) {
if (request()->wantsJson()) {
return json_encode(Entry::getDetails($id));
}
return view('Entry.detail');
}
Is it what you want?
Source:stackexchange.com