app/helpers.php dosyasını oluştur.
yukarıdaki fonksiyonu içine yapıştır.
app\Providers içinde HelperServiceProvider.php dosyasını oluştur ve içine bunları yaz:
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class HelperServiceProvider extends ServiceProvider {
public function boot() {
//
}
public function register() {
require_once(app_path() . '/helpers.php');
}
}
config/app.php içinde bu class'ı providers'a ekle:
App\Providers\HelperServiceProvider::class,
Ben artık bu yöntemi kullanıyorum.
Sitedeki makalemi de bu şekilde güncelleyeceğim.