Пример #1
0
 public static function getUserSettings($user_id)
 {
     $default_settings = ['user_id' => $user_id, 'nickname' => Auth::user()->username, 'enable_chat' => 1, 'editor_font' => 'Consolas', 'editor_font_color' => 'Black'];
     if (!Settings::where('user_id', $user_id)->exists()) {
         $settings = Settings::create($default_settings);
     } else {
         $settings = Settings::where('user_id', $user_id)->first();
     }
     return $settings;
 }
 public function run()
 {
     DB::table('settings')->delete();
     Settings::create(['logo' => '', 'title' => 'News Letter', 'subtitle' => 'Latest News Ever!', 'description' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s
                           standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it
                           to make a type specimen book. It has survived not only five centuries, but also the leap into
                           electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of
                           Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus
                           PageMaker including versions of Lorem Ipsum.', 'theme' => '']);
 }
Пример #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function save(Request $request)
 {
     $departments = $request->get('department');
     foreach ($departments as $id => $department) {
         Settings::where('department_id', $id)->delete();
         foreach ($department as $key => $value) {
             Settings::create(['department_id' => $id, 'key' => $key, 'value' => $value]);
         }
     }
     return redirect()->action('Admin\\SettingsController@display')->with('success', 'updated');
 }
Пример #4
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     foreach ($request->input('setting') as $key => $value) {
         $setting = Settings::where('name', $key);
         if ($setting->get()->count() > 0) {
             $setting->first()->update(['name' => $key, 'value' => $value]);
         } else {
             Settings::create(['name' => $key, 'value' => $value]);
         }
     }
     return back()->withSuccess('Settings saved successfully!');
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('settings', function (Blueprint $table) {
         $table->increments('id');
         $table->string('web_name');
         $table->text('description');
         $table->string('keywords');
         $table->string('icp');
         $table->text('stat_code');
         $table->string('copyright');
         $table->string('email');
         $table->timestamps();
     });
     \App\Settings::create(['web_name' => '优禾尚鲜', 'description' => '提供高品质主食', 'keywords' => '优禾尚鲜', 'icp' => '', 'stat_code' => '', 'copyright' => '优禾尚鲜©版权所有', 'email' => '*****@*****.**']);
 }
 public function edit(Request $request)
 {
     $id = 0;
     if (isset($request->id)) {
         $id = $request->id;
     }
     $modelData = new \stdClass();
     if ($id > 0) {
         try {
             $modelData = Settings::findOrFail($id);
         } catch (ModelNotFoundException $e) {
             session()->flash('message', trans('admin_common.Invalid Setting'));
             return redirect(url('admin/settings'));
         }
     }
     /**
      * form is submitted check values and save if needed
      */
     if ($request->isMethod('post')) {
         /**
          * validate data
          */
         $rules = ['setting_value' => 'required'];
         $validator = Validator::make($request->all(), $rules);
         if ($validator->fails()) {
             $this->throwValidationException($request, $validator);
         }
         /**
          * get data from form
          */
         $data = $request->all();
         /**
          * save or update
          */
         if (!isset($modelData->setting_id)) {
             Settings::create($data);
         } else {
             $modelData->update($data);
         }
         /**
          * clear cache, set message, redirect to list
          */
         Cache::flush();
         session()->flash('message', trans('admin_common.Setting saved'));
         return redirect(url('admin/settings'));
     }
     return view('admin.settings.settings_edit', ['modelData' => $modelData]);
 }
Пример #7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Settings::truncate();
     Settings::create(['name' => 'blogtitle', 'value' => 'CODEMAN']);
     Settings::create(['name' => 'contactemail', 'value' => '']);
     Settings::create(['name' => 'github', 'value' => '']);
     Settings::create(['name' => 'twitter', 'value' => '']);
     Settings::create(['name' => 'linkedin', 'value' => '']);
     Settings::create(['name' => 'dateofbirth', 'value' => '']);
     Settings::create(['name' => 'name', 'value' => '']);
     Settings::create(['name' => 'location', 'value' => '']);
     Settings::create(['name' => 'mobile', 'value' => '']);
     Settings::create(['name' => 'email', 'value' => '']);
     Settings::create(['name' => 'website', 'value' => '']);
     Settings::create(['name' => 'resume', 'value' => '']);
     Settings::create(['name' => 'gender', 'value' => '']);
     Settings::create(['name' => 'headercode', 'value' => '']);
 }
Пример #8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     \App\Settings::create(['slider_section' => '1', 'we_are_section' => '1', 'our_team_section' => '1', 'portfolio_section' => '1', 'contact_section' => '1', 'clients_section' => '1', 'quotes_section' => '1']);
     Model::reguard();
 }
Пример #9
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Settings::create(['field' => 'Schedumal_trial', 'value' => '08:00:00']);
     Settings::create(['field' => 'Duration_trial', 'value' => '20']);
 }
Пример #10
0
 /**
  * Store a newly created settings in storage.
  *
  * @param CreateSettingsRequest|Request $request
  */
 public function store(CreateSettingsRequest $request)
 {
     $request = $this->saveFiles($request);
     Settings::create($request->all());
     return redirect()->route('admin.settings.index');
 }