From 33494150db2ca8e8c011cce57d0fb24020543e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Ba=C5=A1i=C4=87?= Date: Tue, 2 Jul 2019 11:09:52 +0200 Subject: [PATCH] Updates readme. Removes global_helpers config option. Helpers need to be manually enabled in the service provider for laravel. --- README.md | 20 ++++++++++++-------- src/Frameworks/Laravel/ServiceProvider.php | 4 ---- src/Frameworks/Laravel/config.php | 6 ------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9c38f10..3b7bf05 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ With Ekko your code could look like this: ```html ``` @@ -105,7 +105,7 @@ What if you are not using Bootstrap, but some other framework or a custom design ```html ``` @@ -137,7 +137,7 @@ php artisan vendor:publish --provider="Laravelista\Ekko\Frameworks\Laravel\Servi Using boolean `true` or `false` is convenient if you need to display some content depending on which page you are in your layout view: ```html -@if(is_active('/about', true)) +@if(Ekko::isActive('/about', true))

Something that is only visible on the `about` page.

@endif ``` @@ -146,7 +146,11 @@ Using boolean `true` or `false` is convenient if you need to display some conten **Global helper functions** as displayed above are disabled by default. To enable them use `Ekko::enableGlobalHelpers();` or `$ekko->enableGlobalHelpers()`. -In Laravel you can set `global_helpers` value to `true` in the config `config/ekko.php` file. +In Laravel add this code to your `app/Providers/AppServiceProvider.php` file in `register` method: + +``` +\Ekko::enableGlobalHelpers(); +``` ## Usage @@ -183,19 +187,19 @@ For arrays of named routes. Supports wildcards. `Ekko::isActiveURL($input, $output = null)` The same as `Ekko::isActive`. -**Backward compatibility.** Use `isActive` and pass it the same array. +**Backward compatibility.** Use `Ekko::isActive` and pass it the same input. `Ekko::areActiveURLs(array $input, $output = null)` The same as `Ekko::isActiveURL`, but accepts only the array of Urls. -**Backward compatibility.** Use `isActive` and pass it the same array. +**Backward compatibility.** Use `Ekko::isActive` and pass it the same array. `Ekko::isActiveMatch($input, $output = null)` The same as `Ekko::isActive`. This method encloses the input with wildcard `*`. Supports string, array and wildcards as input. -**Backward compatibility.** Use `isActive` and pass it the same input, but with wildcard `*` at the desired place. +**Backward compatibility.** Use `Ekko::isActive` and pass it the same input, but with wildcard `*` at the desired place. `Ekko::areActiveMatches(array $input, $output = null)` The same as `Ekko::isActiveMatch`, but accepts only the array of strings. -**Backward compatibility.** Use `isActive` and pass it the same array. +**Backward compatibility.** Use `Ekko::isActive` and pass it the same array. ## Credits diff --git a/src/Frameworks/Laravel/ServiceProvider.php b/src/Frameworks/Laravel/ServiceProvider.php index 634b3ce..f52fdaa 100644 --- a/src/Frameworks/Laravel/ServiceProvider.php +++ b/src/Frameworks/Laravel/ServiceProvider.php @@ -38,10 +38,6 @@ public function register() return $ekko; }); - - if (config('ekko.global_helpers')) { - Ekko::enableGlobalHelpers(); - } } /** diff --git a/src/Frameworks/Laravel/config.php b/src/Frameworks/Laravel/config.php index 26970c9..e9641ed 100644 --- a/src/Frameworks/Laravel/config.php +++ b/src/Frameworks/Laravel/config.php @@ -7,10 +7,4 @@ * is defined when user called. */ 'default_output' => 'active', - - /** - * By default global helper functions are disabled. - * Change this to true to enable them. - */ - 'global_helpers' => false ]; \ No newline at end of file