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


PHP Setting::getSettings方法代码示例

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


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

示例1: show_custom_css

 public function show_custom_css()
 {
     $custom_css = Setting::getSettings()->custom_css;
     $custom_css = e($custom_css);
     // Needed for modifying the bootstrap nav :(
     $custom_css = str_ireplace('script', 'SCRIPTS-NOT-ALLOWED-HERE', $custom_css);
     $custom_css = str_replace('>', '>', $custom_css);
     return $custom_css;
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:9,代码来源:Setting.php

示例2: isFullMultipleCompanySupportEnabled

 private static function isFullMultipleCompanySupportEnabled()
 {
     $settings = Setting::getSettings();
     // NOTE: this can happen when seeding the database
     if (is_null($settings)) {
         return false;
     } else {
         return $settings->full_multiple_companies_support == 1;
     }
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:10,代码来源:Company.php

示例3: getEula

 public function getEula()
 {
     $Parsedown = new \Parsedown();
     if ($this->category->eula_text) {
         return $Parsedown->text(e($this->category->eula_text));
     } elseif (Setting::getSettings()->default_eula_text && $this->category->use_default_eula == '1') {
         return $Parsedown->text(e(Setting::getSettings()->default_eula_text));
     } else {
         return null;
     }
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:11,代码来源:Accessory.php

示例4: getRawConfig

 /**
  * Returns the raw configuration array
  *
  * @return array
  */
 public function getRawConfig()
 {
     if ($this->data === null) {
         if ($this->cache instanceof Cache) {
             $data = $this->cache->get($this->cacheKey);
             if ($data === false) {
                 $data = $this->model->getSettings();
                 $this->cache->set($this->cacheKey, $data);
             }
         } else {
             $data = $this->model->getSettings();
         }
         $this->data = $data;
     }
     return $this->data;
 }
开发者ID:ramialcheikh,项目名称:quickforms,代码行数:21,代码来源:Settings.php

示例5: handle

 /**
  * Handle the locale for the user, default to settings otherwise
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (Schema::hasTable('settings')) {
         // User's preference
         if ($request->user() && $request->user()->locale) {
             \App::setLocale($request->user()->locale);
             // App setting preference
         } elseif (Setting::getSettings() && Setting::getSettings()->locale != '') {
             \App::setLocale(Setting::getSettings()->locale);
             // Default app setting
         } else {
             \App::setLocale(config('app.locale'));
         }
     }
     \App::setLocale(config('app.locale'));
     return $next($request);
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:25,代码来源:CheckLocale.php

示例6: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if (Setting::getSettings()->alert_email != '' && Setting::getSettings()->alerts_enabled == 1) {
         $data['data'] = Helper::checkLowInventory();
         $data['count'] = count($data['data']);
         if (count($data['data']) > 0) {
             \Mail::send('emails.low-inventory', $data, function ($m) {
                 $m->to(explode(',', Setting::getSettings()->alert_email), Setting::getSettings()->site_name);
                 $m->subject('Low Inventory Report');
             });
         }
     } else {
         if (Setting::getSettings()->alert_email == '') {
             echo "Could not send email. No alert email configured in settings. \n";
         } elseif (Setting::getSettings()->alerts_enabled != 1) {
             echo "Alerts are disabled in the settings. No mail will be sent. \n";
         }
     }
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:24,代码来源:SendInventoryAlerts.php

示例7: getRequestAsset

 public function getRequestAsset($assetId = null)
 {
     $user = Auth::user();
     // Check if the asset exists and is requestable
     if (is_null($asset = Asset::RequestableAssets()->find($assetId))) {
         // Redirect to the asset management page
         return redirect()->route('requestable-assets')->with('error', trans('admin/hardware/message.does_not_exist_or_not_requestable'));
     } elseif (!Company::isCurrentUserHasAccess($asset)) {
         return redirect()->route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
     } else {
         $logaction = new Actionlog();
         $logaction->asset_id = $data['asset_id'] = $asset->id;
         $logaction->asset_type = $data['asset_type'] = 'hardware';
         $logaction->created_at = $data['requested_date'] = date("Y-m-d h:i:s");
         if ($user->location_id) {
             $logaction->location_id = $user->location_id;
         }
         $logaction->user_id = $data['user_id'] = Auth::user()->id;
         $log = $logaction->logaction('requested');
         $data['requested_by'] = $user->fullName();
         $data['asset_name'] = $asset->showAssetName();
         $settings = Setting::getSettings();
         if ($settings->alert_email != '' && $settings->alerts_enabled == '1' && !config('app.lock_passwords')) {
             Mail::send('emails.asset-requested', $data, function ($m) use($user, $settings) {
                 $m->to(explode(',', $settings->alert_email), $settings->site_name);
                 $m->subject('Asset Requested');
             });
         }
         if ($settings->slack_endpoint) {
             $slack_settings = ['username' => $settings->botname, 'channel' => $settings->slack_channel, 'link_names' => true];
             $client = new \Maknz\Slack\Client($settings->slack_endpoint, $slack_settings);
             try {
                 $client->attach(['color' => 'good', 'fields' => [['title' => 'REQUESTED:', 'value' => strtoupper($logaction->asset_type) . ' asset <' . config('app.url') . '/hardware/' . $asset->id . '/view' . '|' . $asset->showAssetName() . '> requested by <' . config('app.url') . '/hardware/' . $asset->id . '/view' . '|' . Auth::user()->fullName() . '>.']]])->send('Asset Requested');
             } catch (Exception $e) {
             }
         }
         return redirect()->route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.success'));
     }
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:39,代码来源:ViewAssetsController.php

示例8: postCheckin

 /**
  * Validates and stores the license checkin action.
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @see LicensesController::getCheckin() method that provides the form view
  * @since [v1.0]
  * @param int $seatId
  * @param string $backto
  * @return Redirect
  */
 public function postCheckin($seatId = null, $backto = null)
 {
     // Check if the asset exists
     if (is_null($licenseseat = LicenseSeat::find($seatId))) {
         // Redirect to the asset management page with error
         return redirect()->to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
     }
     $license = License::find($licenseseat->license_id);
     if (!Company::isCurrentUserHasAccess($license)) {
         return redirect()->to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
     }
     if (!$license->reassignable) {
         // Not allowed to checkin
         Session::flash('error', 'License not reassignable.');
         return redirect()->back()->withInput();
     }
     // Declare the rules for the form validation
     $rules = array('note' => 'string', 'notes' => 'string');
     // Create a new validator instance from our validation rules
     $validator = Validator::make(Input::all(), $rules);
     // If validation fails, we'll exit the operation now.
     if ($validator->fails()) {
         // Ooops.. something went wrong
         return redirect()->back()->withInput()->withErrors($validator);
     }
     $return_to = $licenseseat->assigned_to;
     $logaction = new Actionlog();
     $logaction->checkedout_to = $licenseseat->assigned_to;
     // Update the asset data
     $licenseseat->assigned_to = null;
     $licenseseat->asset_id = null;
     $user = Auth::user();
     // Was the asset updated?
     if ($licenseseat->save()) {
         $logaction->asset_id = $licenseseat->license_id;
         $logaction->location_id = null;
         $logaction->asset_type = 'software';
         $logaction->note = e(Input::get('note'));
         $logaction->user_id = $user->id;
         $settings = Setting::getSettings();
         if ($settings->slack_endpoint) {
             $slack_settings = ['username' => $settings->botname, 'channel' => $settings->slack_channel, 'link_names' => true];
             $client = new \Maknz\Slack\Client($settings->slack_endpoint, $slack_settings);
             try {
                 $client->attach(['color' => 'good', 'fields' => [['title' => 'Checked In:', 'value' => strtoupper($logaction->asset_type) . ' <' . config('app.url') . '/admin/licenses/' . $license->id . '/view' . '|' . $license->name . '> checked in by <' . config('app.url') . '/admin/users/' . $user->id . '/view' . '|' . $user->fullName() . '>.'], ['title' => 'Note:', 'value' => e($logaction->note)]]])->send('License Checked In');
             } catch (Exception $e) {
             }
         }
         $log = $logaction->logaction('checkin from');
         if ($backto == 'user') {
             return redirect()->to("admin/users/" . $return_to . '/view')->with('success', trans('admin/licenses/message.checkin.success'));
         } else {
             return redirect()->to("admin/licenses/" . $licenseseat->license_id . "/view")->with('success', trans('admin/licenses/message.checkin.success'));
         }
     }
     // Redirect to the license page with error
     return redirect()->to("admin/licenses")->with('error', trans('admin/licenses/message.checkin.error'));
 }
开发者ID:jbirdkerr,项目名称:snipe-it,代码行数:68,代码来源:LicensesController.php

示例9: postBulkEdit

 /**
  * Display the bulk edit page.
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @param  int  $assetId
  * @since [v2.0]
  * @return View
  */
 public function postBulkEdit($assets = null)
 {
     if (!Company::isCurrentUserAuthorized()) {
         return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
     } elseif (!Input::has('edit_asset')) {
         return redirect()->back()->with('error', 'No assets selected');
     } else {
         $asset_raw_array = Input::get('edit_asset');
         foreach ($asset_raw_array as $asset_id => $value) {
             $asset_ids[] = $asset_id;
         }
     }
     if (Input::has('bulk_actions')) {
         // Create labels
         if (Input::get('bulk_actions') == 'labels') {
             $settings = Setting::getSettings();
             $assets = Asset::find($asset_ids);
             $count = 0;
             return View::make('hardware/labels')->with('assets', $assets)->with('settings', $settings)->with('count', $count)->with('settings', $settings);
         } elseif (Input::get('bulk_actions') == 'delete') {
             $assets = Asset::with('assigneduser', 'assetloc')->find($asset_ids);
             return View::make('hardware/bulk-delete')->with('assets', $assets);
             // Bulk edit
         } elseif (Input::get('bulk_actions') == 'edit') {
             $assets = Input::get('edit_asset');
             $supplier_list = Helper::suppliersList();
             $statuslabel_list = Helper::statusLabelList();
             $location_list = Helper::locationsList();
             $models_list = Helper::modelList();
             $companies_list = array('' => '') + array('clear' => trans('general.remove_company')) + Helper::companyList();
             return View::make('hardware/bulk')->with('assets', $assets)->with('supplier_list', $supplier_list)->with('statuslabel_list', $statuslabel_list)->with('location_list', $location_list)->with('models_list', $models_list)->with('companies_list', $companies_list);
         }
     } else {
         return redirect()->back()->with('error', 'No action selected');
     }
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:44,代码来源:AssetsController.php

示例10: postCheckout

 /**
  * Saves the checkout information
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @see ConsumablesController::getCheckout() method that returns the form.
  * @since [v1.0]
  * @param int $consumableId
  * @return Redirect
  */
 public function postCheckout($consumableId)
 {
     // Check if the consumable exists
     if (is_null($consumable = Consumable::find($consumableId))) {
         // Redirect to the consumable management page with error
         return redirect()->to('consumables')->with('error', trans('admin/consumables/message.not_found'));
     } elseif (!Company::isCurrentUserHasAccess($consumable)) {
         return redirect()->to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
     }
     $admin_user = Auth::user();
     $assigned_to = e(Input::get('assigned_to'));
     // Check if the user exists
     if (is_null($user = User::find($assigned_to))) {
         // Redirect to the consumable management page with error
         return redirect()->to('admin/consumables')->with('error', trans('admin/consumables/message.user_does_not_exist'));
     }
     // Update the consumable data
     $consumable->assigned_to = e(Input::get('assigned_to'));
     $consumable->users()->attach($consumable->id, array('consumable_id' => $consumable->id, 'user_id' => $admin_user->id, 'assigned_to' => e(Input::get('assigned_to'))));
     $logaction = new Actionlog();
     $logaction->consumable_id = $consumable->id;
     $logaction->checkedout_to = $consumable->assigned_to;
     $logaction->asset_type = 'consumable';
     $logaction->asset_id = 0;
     $logaction->location_id = $user->location_id;
     $logaction->user_id = Auth::user()->id;
     $logaction->note = e(Input::get('note'));
     $settings = Setting::getSettings();
     if ($settings->slack_endpoint) {
         $slack_settings = ['username' => $settings->botname, 'channel' => $settings->slack_channel, 'link_names' => true];
         $client = new \Maknz\Slack\Client($settings->slack_endpoint, $slack_settings);
         try {
             $client->attach(['color' => 'good', 'fields' => [['title' => 'Checked Out:', 'value' => strtoupper($logaction->asset_type) . ' <' . config('app.url') . '/admin/consumables/' . $consumable->id . '/view' . '|' . $consumable->name . '> checked out to <' . config('app.url') . '/admin/users/' . $user->id . '/view|' . $user->fullName() . '> by <' . config('app.url') . '/admin/users/' . $admin_user->id . '/view' . '|' . $admin_user->fullName() . '>.'], ['title' => 'Note:', 'value' => e($logaction->note)]]])->send('Consumable Checked Out');
         } catch (Exception $e) {
         }
     }
     $log = $logaction->logaction('checkout');
     $consumable_user = DB::table('consumables_users')->where('assigned_to', '=', $consumable->assigned_to)->where('consumable_id', '=', $consumable->id)->first();
     $data['log_id'] = $logaction->id;
     $data['eula'] = $consumable->getEula();
     $data['first_name'] = $user->first_name;
     $data['item_name'] = $consumable->name;
     $data['checkout_date'] = $logaction->created_at;
     $data['note'] = $logaction->note;
     $data['require_acceptance'] = $consumable->requireAcceptance();
     if ($consumable->requireAcceptance() == '1' || $consumable->getEula()) {
         Mail::send('emails.accept-asset', $data, function ($m) use($user) {
             $m->to($user->email, $user->first_name . ' ' . $user->last_name);
             $m->subject('Confirm consumable delivery');
         });
     }
     // Redirect to the new consumable page
     return redirect()->to("admin/consumables")->with('success', trans('admin/consumables/message.checkout.success'));
 }
开发者ID:jbirdkerr,项目名称:snipe-it,代码行数:63,代码来源:ConsumablesController.php

示例11: createOrFetchUser

 /**
  * Finds the user matching given data, or creates a new one if there is no match
  *
  * @author Daniel Melzter
  * @since 3.0
  * @param $row array
  * @return User Model w/ matching name
  * @internal param string $user_username Username extracted from CSV
  * @internal param string $user_email Email extracted from CSV
  * @internal param string $first_name
  * @internal param string $last_name
  */
 public function createOrFetchUser($row)
 {
     $user_name = $this->array_smart_fetch($row, "name");
     $user_email = $this->array_smart_fetch($row, "email");
     $user_username = $this->array_smart_fetch($row, "username");
     // A number was given instead of a name
     if (is_numeric($user_name)) {
         $this->log('User ' . $user_name . ' is not a name - assume this user already exists');
         $user_username = '';
         $first_name = '';
         $last_name = '';
         // No name was given
     } elseif (empty($user_name)) {
         $this->log('No user data provided - skipping user creation, just adding asset');
         $first_name = '';
         $last_name = '';
         //$user_username = '';
     } else {
         $user_email_array = User::generateFormattedNameFromFullName(Setting::getSettings()->email_format, $user_name);
         $first_name = $user_email_array['first_name'];
         $last_name = $user_email_array['last_name'];
         if ($user_email == '') {
             $user_email = $user_email_array['username'] . '@' . Setting::getSettings()->email_domain;
         }
         if ($user_username == '') {
             if ($this->option('username_format') == 'email') {
                 $user_username = $user_email;
             } else {
                 $user_name_array = User::generateFormattedNameFromFullName(Setting::getSettings()->username_format, $user_name);
                 $user_username = $user_name_array['username'];
             }
         }
     }
     $this->log("--- User Data ---");
     $this->log('Full Name: ' . $user_name);
     $this->log('First Name: ' . $first_name);
     $this->log('Last Name: ' . $last_name);
     $this->log('Username: ' . $user_username);
     $this->log('Email: ' . $user_email);
     $this->log('--- End User Data ---');
     if ($this->option('testrun')) {
         return new User();
     }
     if (!empty($user_username)) {
         if ($user = User::MatchEmailOrUsername($user_username, $user_email)->whereNotNull('username')->first()) {
             $this->log('User ' . $user_username . ' already exists');
         } elseif ($first_name != '' && $last_name != '' && $user_username != '') {
             $user = new \App\Models\User();
             $password = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
             $user->first_name = $first_name;
             $user->last_name = $last_name;
             $user->username = $user_username;
             $user->email = $user_email;
             $user->password = bcrypt($password);
             $user->activated = 1;
             if ($user->save()) {
                 $this->log('User ' . $first_name . ' created');
             } else {
                 $this->jsonError('User "' . $first_name . '"', $user->getErrors());
             }
         } else {
             $user = new User();
         }
     } else {
         $user = new User();
     }
     return $user;
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:80,代码来源:ObjectImportCommand.php

示例12: findLdapUsers

 /**
  * Searches LDAP
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @since [v3.0]
  * @param $ldapatttibutes
  * @return array|bool
  */
 static function findLdapUsers()
 {
     $ldapconn = Ldap::connectToLdap();
     $ldap_bind = Ldap::bindAdminToLdap($ldapconn);
     $base_dn = Setting::getSettings()->ldap_basedn;
     $filter = Setting::getSettings()->ldap_filter;
     // Set up LDAP pagination for very large databases
     // @author Richard Hofman
     $page_size = 500;
     $cookie = '';
     $result_set = array();
     $global_count = 0;
     // Perform the search
     do {
         // Paginate (non-critical, if not supported by server)
         ldap_control_paged_result($ldapconn, $page_size, false, $cookie);
         $search_results = ldap_search($ldapconn, $base_dn, '(' . $filter . ')');
         if (!$search_results) {
             return redirect()->route('users')->with('error', trans('admin/users/message.error.ldap_could_not_search') . ldap_error($ldapconn));
         }
         // Get results from page
         $results = ldap_get_entries($ldapconn, $search_results);
         if (!$results) {
             return redirect()->route('users')->with('error', trans('admin/users/message.error.ldap_could_not_get_entries') . ldap_error($ldapconn));
         }
         // Add results to result set
         $global_count += $results['count'];
         $result_set = array_merge($result_set, $results);
         ldap_control_paged_result_response($ldapconn, $search_results, $cookie);
     } while ($cookie !== null && $cookie != '');
     // Clean up after search
     $result_set['count'] = $global_count;
     $results = $result_set;
     ldap_control_paged_result($ldapconn, 0);
     return $results;
 }
开发者ID:jbirdkerr,项目名称:snipe-it,代码行数:44,代码来源:Ldap.php

示例13: checkLowInventory

 /**
  * This nasty little method gets the low inventory info for the
  * alert dropdown
  **/
 public static function checkLowInventory()
 {
     $consumables = Consumable::with('users')->whereNotNull('min_amt')->get();
     $accessories = Accessory::with('users')->whereNotNull('min_amt')->get();
     $components = Component::with('assets')->whereNotNull('min_amt')->get();
     $avail_consumables = 0;
     $items_array = array();
     $all_count = 0;
     foreach ($consumables as $consumable) {
         $avail = $consumable->numRemaining();
         if ($avail < $consumable->min_amt + \App\Models\Setting::getSettings()->alert_threshold) {
             if ($consumable->total_qty > 0) {
                 $percent = number_format($consumable->numRemaining() / $consumable->total_qty * 100, 0);
             } else {
                 $percent = 100;
             }
             $items_array[$all_count]['id'] = $consumable->id;
             $items_array[$all_count]['name'] = $consumable->name;
             $items_array[$all_count]['type'] = 'consumables';
             $items_array[$all_count]['percent'] = $percent;
             $items_array[$all_count]['remaining'] = $consumable->numRemaining();
             $items_array[$all_count]['min_amt'] = $consumable->min_amt;
             $all_count++;
         }
     }
     foreach ($accessories as $accessory) {
         $avail = $accessory->numRemaining();
         if ($avail < $accessory->min_amt + \App\Models\Setting::getSettings()->alert_threshold) {
             if ($accessory->total_qty > 0) {
                 $percent = number_format($accessory->numRemaining() / $accessory->total_qty * 100, 0);
             } else {
                 $percent = 100;
             }
             $items_array[$all_count]['id'] = $accessory->id;
             $items_array[$all_count]['name'] = $accessory->name;
             $items_array[$all_count]['type'] = 'accessories';
             $items_array[$all_count]['percent'] = $percent;
             $items_array[$all_count]['remaining'] = $accessory->numRemaining();
             $items_array[$all_count]['min_amt'] = $accessory->min_amt;
             $all_count++;
         }
     }
     foreach ($components as $component) {
         $avail = $component->numRemaining();
         if ($avail < $component->min_amt + \App\Models\Setting::getSettings()->alert_threshold) {
             if ($component->total_qty > 0) {
                 $percent = number_format($component->numRemaining() / $component->total_qty * 100, 0);
             } else {
                 $percent = 100;
             }
             $items_array[$all_count]['id'] = $component->id;
             $items_array[$all_count]['name'] = $component->name;
             $items_array[$all_count]['type'] = 'components';
             $items_array[$all_count]['percent'] = $percent;
             $items_array[$all_count]['remaining'] = $component->numRemaining();
             $items_array[$all_count]['min_amt'] = $component->min_amt;
             $all_count++;
         }
     }
     return $items_array;
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:65,代码来源:Helper.php

示例14: postCheckout

 /**
  * Validate and store checkout data.
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @see ComponentsController::getCheckout() method that returns the form.
  * @since [v3.0]
  * @param int $componentId
  * @return Redirect
  */
 public function postCheckout(Request $request, $componentId)
 {
     // Check if the component exists
     if (is_null($component = Component::find($componentId))) {
         // Redirect to the component management page with error
         return redirect()->to('components')->with('error', trans('admin/components/message.not_found'));
     } elseif (!Company::isCurrentUserHasAccess($component)) {
         return redirect()->to('admin/components')->with('error', trans('general.insufficient_permissions'));
     }
     $max_to_checkout = $component->numRemaining();
     $validator = Validator::make($request->all(), ["asset_id" => "required", "assigned_qty" => "required|numeric|between:1,{$max_to_checkout}"]);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     $admin_user = Auth::user();
     $asset_id = e(Input::get('asset_id'));
     // Check if the user exists
     if (is_null($asset = Asset::find($asset_id))) {
         // Redirect to the component management page with error
         return redirect()->to('admin/components')->with('error', trans('admin/components/message.asset_does_not_exist'));
     }
     // Update the component data
     $component->asset_id = $asset_id;
     $component->assets()->attach($component->id, array('component_id' => $component->id, 'user_id' => $admin_user->id, 'created_at' => date('Y-m-d h:i:s'), 'assigned_qty' => e(Input::get('assigned_qty')), 'asset_id' => $asset_id));
     $logaction = new Actionlog();
     $logaction->component_id = $component->id;
     $logaction->asset_id = $asset_id;
     $logaction->asset_type = 'component';
     $logaction->location_id = $asset->location_id;
     $logaction->user_id = Auth::user()->id;
     $logaction->note = e(Input::get('note'));
     $settings = Setting::getSettings();
     if ($settings->slack_endpoint) {
         $slack_settings = ['username' => $settings->botname, 'channel' => $settings->slack_channel, 'link_names' => true];
         $client = new \Maknz\Slack\Client($settings->slack_endpoint, $slack_settings);
         try {
             $client->attach(['color' => 'good', 'fields' => [['title' => 'Checked Out:', 'value' => strtoupper($logaction->asset_type) . ' <' . config('app.url') . '/admin/components/' . $component->id . '/view' . '|' . $component->name . '> checked out to <' . config('app.url') . '/hardware/' . $asset->id . '/view|' . $asset->showAssetName() . '> by <' . config('app.url') . '/admin/users/' . $admin_user->id . '/view' . '|' . $admin_user->fullName() . '>.'], ['title' => 'Note:', 'value' => e($logaction->note)]]])->send('Component Checked Out');
         } catch (Exception $e) {
         }
     }
     $log = $logaction->logaction('checkout');
     // Redirect to the new component page
     return redirect()->to("admin/components")->with('success', trans('admin/components/message.checkout.success'));
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:53,代码来源:ComponentsController.php

示例15: generateEmailFromFullName

 public static function generateEmailFromFullName($name)
 {
     $username = User::generateFormattedNameFromFullName(Setting::getSettings()->email_format, $name);
     return $username['username'] . '@' . Setting::getSettings()->email_domain;
 }
开发者ID:stijni,项目名称:snipe-it,代码行数:5,代码来源:User.php


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