set() публичный статический Метод

Set a setting (no pun) value.
public static set ( string | array $key, mixed $value = null )
$key string | array The key of the setting, or an associative array of settings, in which case $value will be discarded.
$value mixed
Пример #1
0
 public function testGet()
 {
     Setting::set('foo', 'bar');
     Setting::set('bar', ['baz' => 'qux']);
     $this->assertEquals('bar', Setting::get('foo'));
     $this->assertEquals(['baz' => 'qux'], Setting::get('bar'));
 }
Пример #2
0
 /**
  * Save the application settings.
  *
  * @param SettingRequest $request
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function store(SettingRequest $request)
 {
     // For right now there's only one setting to be saved
     Setting::set('media_path', rtrim(trim($request->input('media_path')), '/'));
     // In a next version we should opt for a "MediaPathChanged" event,
     // but let's just do this async now.
     Media::sync();
     return response()->json();
 }
Пример #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Setting::set('media_path', '');
 }