예제 #1
0
 public static function setFieldData()
 {
     $fieldData = array();
     $system = new System();
     $arr = $system->getFillable();
     foreach ($arr as $v) {
         $fieldData[$v] = Input::get($v);
     }
     unset($arr);
     unset($system);
     return $fieldData;
 }
예제 #2
0
 public static function saveValue($date = [])
 {
     if (is_array($date)) {
         foreach ($date as $key => $value) {
             $key = strip_tags($key);
             $option = System::where('key', $key)->first();
             if (!$option) {
                 $option = new System();
             }
             $option->key = $key;
             $option->value = strip_tags($value);
             $option->save();
         }
     }
 }
예제 #3
0
 public static function view($view, $data = array())
 {
     $key_system = 'system_info';
     if (Cache::has($key_system)) {
         $system = Cache::get($key_system);
     } else {
         $system = System::getValue();
         $expiresAt = Carbon::now()->addMinutes(60 * 24);
         Cache::add($key_system, $system, $expiresAt);
     }
     $key_type = 'categories_info';
     if (Cache::store('category')->has($key_type)) {
         $types = Cache::store('category')->get($key_type);
     } else {
         $types = Category::where('parent_id', 0)->isNavShow()->sortByDesc('sort')->get();
         $expiresAt = Carbon::now()->addMinutes(60);
         Cache::store('category')->put($key_type, $types, $expiresAt);
     }
     if (!isset($system['theme'])) {
         $system['theme'] = '';
     }
     $theme = $system['theme'] == '' ? 'time' : $system['theme'];
     $data['theme'] = $theme;
     $data['system'] = $system;
     $data['types'] = $types;
     return view($theme . '/' . $view, $data);
 }
예제 #4
0
 public function store()
 {
     $input = Request::only(['title', 'keywords', 'description', 'copyright', 'record', 'is_open', 'qq', 'wechat', 'wechatcode', 'weibo', 'theme', 'subtitle']);
     $input['is_open'] = $input['is_open'] ? 1 : 0;
     System::saveValue($input);
     $system = System::getValue();
     $message = '参数设置成功!';
     return Theme::view('admin.system.index', compact('system', 'message'));
 }
예제 #5
0
 public static function view($view, $data = array())
 {
     $system = System::getValue();
     if (!isset($system['theme'])) {
         $system['theme'] = '';
     }
     $theme = $system['theme'] == '' ? 'time' : $system['theme'];
     $data['theme'] = $theme;
     $data['system'] = $system;
     return view($theme . '/' . $view, $data);
 }
예제 #6
0
 public function postStore()
 {
     $system = Request::get('system');
     if (!empty($system)) {
         foreach ($system as $K => $v) {
             System::where('system_name', '=', $K)->update(['system_value' => $v]);
         }
         Notification::success('保存成功');
         return redirect()->back();
     }
     Notification::success('保存失败');
     return redirect()->back();
 }
예제 #7
0
 public function run()
 {
     $system = ['title' => '时光CMS', 'keywords' => 'laravel,php,bootstrap,time,cms', 'description' => '时光CMS,基于laravel5.1的开源CMS系统。时光流逝那些朦胧的回忆,只留下最值得珍惜的瞬间。', 'copyright' => '© obday.com', 'record' => '', 'is_open' => 1, 'qq' => '402227052', 'wechat' => 'lakche', 'weibo' => '332121900', 'theme' => 'time', 'subtitle' => '时光如水'];
     System::saveValue($system);
 }