Best Practices for Custom Helpers in Laravel 5

后端 未结 20 2298
暖寄归人
暖寄归人 2020-11-22 06:40

I would like to create helper functions to avoid repeating code between views in Laravel 5:

view.blade.php

Foo Formated text: {{ fo

20条回答
  •  日久生厌
    2020-11-22 07:34

    Another Way that I used was: 1) created a file in app\FolderName\fileName.php and had this code inside it i.e

    
    

    2) After that in our blade

     $FmyFunctions = new \App\FolderName\classsName;
      echo $is_ok = ($FmyFunctions->libData());
    

    that's it. and it works

提交回复
热议问题