Exemple #1
0
 public function getSetting($name)
 {
     if (is_null($this->setting)) {
         $this->setting = $this->settings->where('id', 1)->fetch();
     }
     return $this->setting[$name];
 }
 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;
 }
 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]);
 }
Exemple #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');
 }
Exemple #5
0
 public function actionDefault()
 {
     $this->row = $this->model->where('language_id', $this->webLanguage)->fetch();
 }
Exemple #6
0
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;
    }
}
 public function show($id)
 {
     $j = Setting::find($id);
     return view('dream.s_show', ['j' => $j]);
 }
 public function delete($id)
 {
     Setting::find($id)->delete();
     return redirect("/dream/setting1");
 }