1. Go to this page and download the library: Download grhone/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/ */
grhone / laravel-settings example snippets
'providers' => [
// Other service providers...
Grhone\LaravelSettings\SettingsServiceProvider::class,
],
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Grhone\LaravelSettings\Traits\HasSettings;
class Event extends Model
{
use HasSettings;
public function getWebsiteBannerFilename()
{
// Get the setting with a default value
return $this->getSetting('websiteBannerFilename', 'default_banner.jpg');
}
}
$banner = $event->getSetting('websiteBannerFilename'); // without default value
$banner = $event->getSetting('websiteBannerFilename', 'default_banner.jpg'); // with default value