1. Go to this page and download the library: Download twom/laravel-setting 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/ */
// string
Setting::set("profile.notification.email", true);
// array
Setting::set([
"profile" => [
"notification" => [
"sms" => true // or any value
]
],
]);
// get string
Setting::get("profile.notification.email", "default");
// result should be an array
Setting::get("profile");
namespace App;
use Illuminate\Database\Eloquent\Model;
use Twom\Setting\Support\Settingable;
class Post extends Model
{
use Settingable;
public $timestamps = false;
protected $fillable = [
'title', // and another fields
];
}
$post = Post::find(1);
// Just like normaliza
$post->setSetting("key", "value");
$post->getSetting("key", "default");
$post->forgetSetting("key");
$post->getAllSetting();
php
'providers' => [
// for laravel 5.8 and below
\Twom\Taggable\SettingServiceProvider::class,
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.