PHP code example of cwsps154 / laravel-settings
1. Go to this page and download the library: Download cwsps154/laravel-settings library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cwsps154 / laravel-settings example snippets
bash
php artisan vendor:publish
bash
php artisan vendor:publish --tag=config --tag=components --tag=views --tag=migrations
bash
public function boot()
{
if (!app()->runningInConsole()) {
$settings = cache()->remember(
'settings',
3600,
fn() => Setting::all()->keyBy('key')
);
View::share('settings', $settings);
}
}