jeudi 1 décembre 2016

How to create a method inside of the blade file on Laravel 5.3

I recently started learning Laravel and I am still trying to figure it out. So, please bear in mind this before judging me :)

I am trying to find a way to rewrite this:

<a href=""></a>

with a method, so I wouldn't have to do Client::find() inside of the view.

I tried doing this:

private function getClientName($id) { $clientName = Client::find($id)->name; return view('campaigns.index', compact('clientName')); }

... in the controller and called the method inside of the view, but it didn't work, and I can't think of anything else right now.

Any suggestions? Thanks!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2fQvWmr
via IFTTT

Aucun commentaire:

Enregistrer un commentaire