当前位置: 首页>>代码示例>>PHP>>正文


PHP Setting::first方法代码示例

本文整理汇总了PHP中Setting::first方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::first方法的具体用法?PHP Setting::first怎么用?PHP Setting::first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Setting的用法示例。


在下文中一共展示了Setting::first方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save_settings

 public function save_settings()
 {
     $input = Input::all();
     $settings = Setting::first();
     $demo_mode = Input::get('demo_mode');
     $enable_https = Input::get('enable_https');
     if (empty($demo_mode)) {
         $input['demo_mode'] = 0;
     }
     if (empty($enable_https)) {
         $input['enable_https'] = 0;
     }
     if (Input::hasFile('logo')) {
         $input['logo'] = ImageHandler::uploadImage(Input::file('logo'), 'settings');
     } else {
         $input['logo'] = $settings->logo;
     }
     if (Input::hasFile('favicon')) {
         $input['favicon'] = ImageHandler::uploadImage(Input::file('favicon'), 'settings');
     } else {
         $input['favicon'] = $settings->favicon;
     }
     $settings->update($input);
     return Redirect::to('admin/settings')->with(array('note' => 'Successfully Updated Site Settings!', 'note_type' => 'success'));
 }
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:25,代码来源:AdminSettingsController.php

示例2: __construct

 public function __construct(Setting $settings = null, Portfolio $portfolio = null, Filesystem $filesystem = null)
 {
     $this->settings = $settings == null ? Setting::first() : $settings;
     $this->portfolio = $portfolio == null ? Portfolio::all() : $portfolio;
     $this->filesystem = $filesystem == null ? new Filesystem() : $filesystem;
     \View::share('settings', $this->settings);
 }
开发者ID:jboz62,项目名称:cms,代码行数:7,代码来源:BaseController.php

示例3: login

 public function login()
 {
     // get login POST data
     $email_login = array('email' => Input::get('email'), 'password' => Input::get('password'));
     $username_login = array('username' => Input::get('email'), 'password' => Input::get('password'));
     if (Auth::attempt($email_login) || Auth::attempt($username_login)) {
         //dd(Auth::user());
         if (Auth::user()->subscribed() || (Auth::user()->role == 'admin' || Auth::user()->role == 'demo')) {
             $redirect = Input::get('redirect', 'false') ? Input::get('redirect') : '/';
             if (Auth::user()->role == 'demo' && Setting::first()->demo_mode != 1) {
                 Auth::logout();
                 return Redirect::to($redirect)->with(array('note' => 'Sorry, Demo Mode has been disabled', 'note_type' => 'error'));
             } else {
                 return Redirect::to($redirect)->with(array('note' => 'You have been successfully logged in.', 'note_type' => 'success'));
             }
         } else {
             $username = Auth::user()->username;
             return Redirect::to('user/' . $username . '/renew_subscription')->with(array('note' => 'Uh oh, looks like you don\'t have an active subscription, please renew to gain access to all content', 'note_type' => 'error'));
         }
     } else {
         $redirect = Input::get('redirect', false) ? '?redirect=' . Input::get('redirect') : '';
         // auth failure! redirect to login with errors
         return Redirect::to('login' . $redirect)->with(array('note' => 'Invalid login, please try again.', 'note_type' => 'error'));
     }
 }
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:25,代码来源:ThemeAuthController.php

示例4: __construct

 private function __construct()
 {
     $setting = Setting::first();
     if ($setting) {
         self::$google_api_key = $setting->api_key;
     }
 }
开发者ID:Hounge,项目名称:Android_Push_Server,代码行数:7,代码来源:GCM.php

示例5: settings_form

 public function settings_form()
 {
     $settings = Setting::first();
     $user = Auth::user();
     $data = array('settings' => $settings, 'admin_user' => $user);
     return View::make('admin.settings.index', $data);
 }
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:7,代码来源:AdminController.php

示例6: simpan_jadwal

 public function simpan_jadwal()
 {
     if (Request::ajax()) {
         $setting = Setting::first();
         $hari = Input::get('hari');
         $guru = Input::get('guru');
         $rombel = Input::get('rombel');
         $jam = Input::get('jam');
         $mapel = Input::get('mapel');
         $cek = DB::table('jadwal')->where('kd_rombel', '=', $rombel)->where('hari', '=', $hari)->where('jam_ke', '=', $jam)->count();
         if ($cek > 0) {
             echo "error";
         } else {
             //cek apakah guru ini sudah mengajar ditempat lain atau belum
             $cekguru = DB::table('jadwal')->where('kd_rombel', 'like', $setting->dari_tahun . '-' . $setting->sampai_tahun . "%")->where('id_guru', '=', $guru)->where('hari', '=', $hari)->where('jam_ke', '=', $jam)->where('kd_mapel', '=', $mapel)->count();
             if ($cekguru > 0) {
                 echo "error2";
             } else {
                 $jadwal = new Jadwal();
                 $jadwal->kd_rombel = Input::get('rombel');
                 $jadwal->hari = Input::get('hari');
                 $jadwal->jam_ke = Input::get('jam');
                 $jadwal->id_guru = Input::get('guru');
                 $jadwal->kd_mapel = Input::get('mapel');
                 $jadwal->save();
                 echo "sukses";
             }
         }
     }
 }
开发者ID:jamalapriadi,项目名称:sia,代码行数:30,代码来源:JadwalController.php

示例7: subscribers

 public function subscribers()
 {
     $user = Sentry::getUser();
     $subscribers = Subscriber::orderBy('first_name', 'asc')->get();
     $sitename = Setting::first()->pluck('sitename');
     return View::make('dashboard.subscribers', array('user' => $user, 'subscribers' => $subscribers, 'sitename' => $sitename));
 }
开发者ID:shinichi81,项目名称:Laravel4-Newsletter-Application,代码行数:7,代码来源:SubscriberController.php

示例8: activate

 public function activate($slug)
 {
     $settings = Setting::first();
     $settings->theme = $slug;
     $settings->save();
     return Redirect::to('admin/themes')->with(array('note' => 'Successfully Activated ' . ucfirst($slug) . ' Theme', 'note_type' => 'success'));
 }
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:7,代码来源:AdminThemesController.php

示例9: add_db_data

 public function add_db_data()
 {
     if (Request::ajax()) {
         try {
             $settings = Setting::first();
             if ($settings) {
                 return Redirect::to('/');
             } else {
                 throw new Exception('settings not set, first install the script');
             }
         } catch (Exception $e) {
             try {
                 $this->add_all_tables();
                 $this->insert_settings();
                 $this->insert_categories();
                 if (Input::get('preloaded_data') == 'true') {
                     $this->insert_media();
                 }
                 $this->upgrade();
                 echo true;
             } catch (Exception $e) {
                 echo false;
             }
         }
     } else {
         echo false;
     }
 }
开发者ID:nvq247,项目名称:Kxexnxh,代码行数:28,代码来源:InstallController.php

示例10: settings

 public function settings()
 {
     $user = Sentry::getUser();
     if (Input::get('email') == $user->email) {
         $rules = array('first_name' => 'required|alpha_num|max:128', 'last_name' => 'required|alpha_num|max:128', 'email' => 'required|email|max:255', 'password' => 'required|min:7|confirmed', 'sitename' => 'required|max:50');
     } else {
         $rules = array('first_name' => 'required|alpha_num|max:128', 'last_name' => 'required|alpha_num|max:128', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|min:7|confirmed', 'sitename' => 'required|max:50');
     }
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Response::json($validator->messages());
     } else {
         $setting = Setting::first();
         $setting->sitename = Input::get('sitename');
         $setting->save();
         $user = User::find($user->id);
         $user->first_name = Input::get('first_name');
         $user->last_name = Input::get('last_name');
         $user->email = Input::get('email');
         $user->password = Input::get('password');
         $user->save();
         $feedback = array('success' => 'Settings successfully saved.');
         return Response::json($feedback);
     }
 }
开发者ID:shinichi81,项目名称:Laravel4-Newsletter-Application,代码行数:25,代码来源:SettingController.php

示例11: create

 function create()
 {
     if ($_POST) {
         unset($_POST['send']);
         $_POST['datetime'] = time();
         $_POST = array_map('htmlspecialchars', $_POST);
         unset($_POST['files']);
         $project = Project::create($_POST);
         $new_project_reference = $_POST['reference'] + 1;
         $project_reference = Setting::first();
         $project_reference->update_attributes(array('project_reference' => $new_project_reference));
         if (!$project) {
             $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_create_project_error'));
         } else {
             $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_create_project_success'));
             $project_last = Project::last();
             $sql = "INSERT INTO `project_has_workers` (`project_id`, `user_id`) VALUES (" . $project_last->id . ", " . $this->user->id . ")";
             $query = $this->db->query($sql);
         }
         redirect('projects');
     } else {
         $this->view_data['companies'] = Company::find('all', array('conditions' => array('inactive=?', '0')));
         $this->view_data['next_reference'] = Project::last();
         $this->theme_view = 'modal';
         $this->view_data['title'] = $this->lang->line('application_create_project');
         $this->view_data['form_action'] = 'projects/create';
         $this->content_view = 'projects/_project';
     }
 }
开发者ID:timclifford,项目名称:freelance-manager,代码行数:29,代码来源:projects.php

示例12: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $mengajar = Mengajar::find($id);
     $guru = Guru::all();
     $mapel = Mapel::all();
     $setting = Setting::first();
     return View::make('mengajar.edit')->with('mengajar', $mengajar)->with('guru', $guru)->with('mapel', $mapel)->with('setting', $setting);
 }
开发者ID:jamalapriadi,项目名称:sia,代码行数:14,代码来源:MengajarController.php

示例13: __construct

 function __construct()
 {
     parent::__construct();
     $this->view_data['core_settings'] = Setting::first();
     if ($this->input->cookie('language') != "") {
         $language = $this->input->cookie('language');
     } else {
         if (isset($this->view_data['language'])) {
             $language = $this->view_data['language'];
         } else {
             if (!empty($this->view_data['core_settings']->language)) {
                 $language = $this->view_data['core_settings']->language;
             } else {
                 $language = "english";
             }
         }
     }
     $this->lang->load('application', $language);
     $this->lang->load('messages', $language);
     $this->lang->load('event', $language);
     $this->user = $this->session->userdata('user_id') ? User::find_by_id($this->session->userdata('user_id')) : FALSE;
     $this->client = $this->session->userdata('client_id') ? Client::find_by_id($this->session->userdata('client_id')) : FALSE;
     if ($this->client) {
         $this->theme_view = 'application_client';
     }
     $this->view_data['datetime'] = date('Y-m-d H:i', time());
     $this->view_data['sticky'] = Project::all(array('conditions' => 'sticky = 1'));
     $this->view_data['quotations_new'] = Quote::find_by_sql("select count(id) as amount from quotations where status='New'");
     if ($this->user || $this->client) {
         $access = $this->user ? $this->user->access : $this->client->access;
         $access = explode(",", $access);
         if ($this->user) {
             $this->view_data['menu'] = Module::find('all', array('order' => 'sort asc', 'conditions' => array('id in (?) AND type = ?', $access, 'main')));
             $this->view_data['widgets'] = Module::find('all', array('conditions' => array('id in (?) AND type = ?', $access, 'widget')));
         } else {
             $this->view_data['menu'] = Module::find('all', array('order' => 'sort asc', 'conditions' => array('id in (?) AND type = ?', $access, 'client')));
         }
         if ($this->user) {
             $update = User::find($this->user->id);
         } else {
             $update = Client::find($this->client->id);
         }
         $update->last_active = time();
         $update->save();
         if ($this->user) {
             $this->view_data['user_online'] = User::all(array('conditions' => array('last_active+(30 * 60) > ? AND status = ?', time(), "active")));
             $this->view_data['client_online'] = Client::all(array('conditions' => array('last_active+(30 * 60) > ? AND inactive = ?', time(), "0")));
         }
         $email = $this->user ? 'u' . $this->user->id : 'c' . $this->client->id;
         $this->view_data['messages_new'] = Privatemessage::find_by_sql("select count(id) as amount from privatemessages where `status`='New' AND recipient = '" . $email . "'");
         $this->view_data['tickets_new'] = Ticket::find_by_sql("select count(id) as amount from tickets where `status`='New'");
     }
     /*$this->load->database();
     		$sql = "select * FROM templates WHERE type='notes'";
     		$query = $this->db->query($sql); */
     $this->view_data["note_templates"] = "";
     //$query->result();
 }
开发者ID:pratikbgit,项目名称:freelancerKit,代码行数:58,代码来源:MY_Controller.php

示例14: create

 function create()
 {
     if ($_POST) {
         $config['upload_path'] = './files/media/';
         $config['encrypt_name'] = TRUE;
         $config['allowed_types'] = '*';
         $this->load->library('upload', $config);
         $this->load->helper('notification');
         unset($_POST['userfile']);
         unset($_POST['file-name']);
         unset($_POST['send']);
         unset($_POST['_wysihtml5_mode']);
         unset($_POST['files']);
         $settings = Setting::first();
         $client = Client::find_by_id($this->client->id);
         $user = User::find_by_id($settings->ticket_default_owner);
         $_POST['from'] = $client->firstname . ' ' . $client->lastname . ' - ' . $client->email;
         $_POST['company_id'] = $client->company->id;
         $_POST['client_id'] = $client->id;
         $_POST['user_id'] = $settings->ticket_default_owner;
         $_POST['queue_id'] = $settings->ticket_default_queue;
         $_POST['type_id'] = $settings->ticket_default_type;
         $_POST['status'] = $settings->ticket_default_status;
         $_POST['created'] = time();
         $_POST['subject'] = htmlspecialchars($_POST['subject']);
         $ticket_reference = Setting::first();
         $_POST['reference'] = $ticket_reference->ticket_reference;
         $ticket = Ticket::create($_POST);
         $new_ticket_reference = $_POST['reference'] + 1;
         $ticket_reference->update_attributes(array('ticket_reference' => $new_ticket_reference));
         if (!$this->upload->do_upload()) {
             $error = $this->upload->display_errors('', ' ');
             $this->session->set_flashdata('message', 'error:' . $error);
         } else {
             $data = array('upload_data' => $this->upload->data());
             $attributes = array('ticket_id' => $ticket->id, 'filename' => $data['upload_data']['orig_name'], 'savename' => $data['upload_data']['file_name']);
             $attachment = TicketHasAttachment::create($attributes);
         }
         if (!$ticket) {
             $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_create_ticket_error'));
             redirect('ctickets');
         } else {
             $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_create_ticket_success'));
             if (isset($user->email) && isset($ticket->reference)) {
                 send_ticket_notification($user->email, '[Ticket#' . $ticket->reference . '] - ' . $_POST['subject'], $_POST['text'], $ticket->id);
             }
             if (isset($client->email) && isset($ticket->reference)) {
                 send_ticket_notification($client->email, '[Ticket#' . $ticket->reference . '] - ' . $_POST['subject'], $_POST['text'], $ticket->id);
             }
             redirect('ctickets/view/' . $ticket->id);
         }
     } else {
         $this->theme_view = 'modal';
         $this->view_data['title'] = $this->lang->line('application_create_ticket');
         $this->view_data['form_action'] = 'ctickets/create';
         $this->content_view = 'tickets/client_views/_ticket';
     }
 }
开发者ID:imranweb7,项目名称:msitc-erp,代码行数:58,代码来源:ctickets.php

示例15: getSettings

 public function getSettings()
 {
     $settings = Setting::first($this->public_settings);
     // Include the Uploads URL
     $settings['uploads_dir'] = Config::get('site.uploads_dir');
     // Include Site URL
     $settings['url'] = URL::to('/');
     return Response::json($settings);
 }
开发者ID:phanhung0906,项目名称:demo1,代码行数:9,代码来源:ApiController.php


注:本文中的Setting::first方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。