예제 #1
0
파일: BasePresenter.php 프로젝트: vsek/cms
 public function getSetting($name)
 {
     if (is_null($this->setting)) {
         $this->setting = $this->settings->where('id', 1)->fetch();
     }
     return $this->setting[$name];
 }
예제 #2
0
 public function configMail()
 {
     //KONFIGURASI INI SESUAIKAN DENGAN DATABASE KONFIGURASI EMAIL
     $mail = Setting::where('type', 'mail')->lists('value', 'setting');
     $config = array('driver' => $mail['mail_driver'], 'host' => $mail['mail_host'], 'port' => $mail['mail_port'], 'from' => array('address' => $mail['mail_address'], 'name' => $mail['mail_name']), 'encryption' => 'tls', 'username' => $mail['mail_username'], 'password' => $mail['mail_password'], 'sendmail' => '/usr/sbin/sendmail -bs', 'pretend' => false);
     return $config;
 }
예제 #3
0
 public function check(Request $request)
 {
     $id = $request->input('id');
     $name = $request->input('name');
     $state = $request->input('state');
     //dd(empty($id),empty($name),empty($state));
     if (empty($id) && empty($name) && empty($state)) {
         $p = Setting::all();
     } else {
         $p = new Setting();
         if (!empty($id)) {
             $p = $p->where('id', '=', $id);
         }
         if (!empty($name)) {
             $p = $p->where('name', '=', $name);
         }
         if (!empty($state)) {
             $p = $p->where('state', '=', $state);
         }
         $p = $p->get();
     }
     return view('dream.person.setting', ['persons' => $p]);
 }
예제 #4
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request)
 {
     $langs = get_langs();
     foreach ($langs as $lang) {
         $datas = $request->input($lang->code);
         if (is_array($datas) || is_object($datas)) {
             foreach ($datas as $key => $value) {
                 $value = is_array($value) ? serialize($value) : $value;
                 $args = ['lang_id' => $lang->id, 'key' => $key, 'value' => $value];
                 $cond = Setting::where('key', $key)->where('lang_id', $lang->id);
                 if ($cond->count() > 0) {
                     $cond->update(['value' => $value]);
                 } else {
                     $meta = new Setting();
                     $meta->lang_id = $lang->id;
                     $meta->key = $key;
                     $meta->value = $value;
                     $meta->save();
                 }
             }
         }
     }
     return redirect()->back()->with('Mess', 'Cập nhật thành công');
 }
예제 #5
0
 public function actionDefault()
 {
     $this->row = $this->model->where('language_id', $this->webLanguage)->fetch();
 }
예제 #6
0
파일: Helper.php 프로젝트: huudo/bds1
function get_setting($key, $lang_id = null)
{
    $lang_id = $lang_id == null ? default_lang_id() : $lang_id;
    $result = \App\Model\Setting::where('key', $key)->where('lang_id', $lang_id)->get(['value'])->first();
    if (empty($result)) {
        return null;
    } else {
        $value = $result->value;
        $value = is_serialized($value) ? unserialize($value) : $value;
        return $value;
    }
}
예제 #7
0
 public function show($id)
 {
     $j = Setting::find($id);
     return view('dream.s_show', ['j' => $j]);
 }
예제 #8
0
 public function delete($id)
 {
     Setting::find($id)->delete();
     return redirect("/dream/setting1");
 }