PHP code example of crow / laravel-setting-lite
1. Go to this page and download the library: Download crow/laravel-setting-lite 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/ */
crow / laravel-setting-lite example snippets
\Crow\LaravelSettingLite\Providers\SettingServiceProvider::class,
php artisan vendor:publish --provider="Crow\LaravelSettingLite\Providers\SettingServiceProvider" --tag=config
php artisan vendor:publish --provider="Crow\LaravelSettingLite\Providers\SettingServiceProvider" --tag=lang
php artisan setting:publish --tag=migration
php artisan migrate
namespace Database\Seeders;
use Crow\LaravelSettingLite\Enums\SettingTypeEnum;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class SettingTableSeeder extends Seeder
{
public static function data()
{
return [
[
'id' => 1,
'key' => 'set_1',
'type' => SettingTypeEnum::TYPE_LIST->value,
'group' => 'Main',
'is_public' => false,
'options' => json_encode(['v1', 'v2']),
'created_at' => '2021-02-03 15:00:00',
'updated_at' => '2021-02-03 15:00:00',
],
[
'id' => 2,
'key' => 'set_2',
'type' => SettingTypeEnum::TYPE_BOOLEAN->value,
'group' => 'Main',
'is_public' => true,
'created_at' => '2021-02-03 15:00:00',
'updated_at' => '2021-02-03 15:00:00',
],
...
];
}
}
php artisan setting:sync
setting_save('SETTING_KEY', 'NEW VALUE');
return \Crow\LaravelSettingLite\Enums\SettingTypeEnum::values();