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


PHP Company::getErrors方法代码示例

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


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

示例1: postCreate

 /**
  * Save data from new company form.
  *
  * @author [Abdullah Alansari] [<ahimta@gmail.com>]
  * @since [v1.8]
  * @return Redirect
  */
 public function postCreate()
 {
     $company = new Company();
     $company->name = e(Input::get('name'));
     if ($company->save()) {
         return redirect()->to('admin/settings/companies')->with('success', trans('admin/companies/message.create.success'));
     } else {
         return redirect()->back()->withInput()->withErrors($company->getErrors());
     }
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:17,代码来源:CompaniesController.php

示例2: fire


//.........这里部分代码省略.........
         $this->comment('First Name: ' . $first_name);
         $this->comment('Last Name: ' . $last_name);
         $this->comment('Username: ' . $user_username);
         $this->comment('Email: ' . $user_email);
         $this->comment('Category Name: ' . $user_asset_category);
         $this->comment('Item: ' . $user_asset_name);
         $this->comment('Manufacturer ID: ' . $user_asset_mfgr);
         $this->comment('Model No: ' . $user_asset_modelno);
         $this->comment('Serial No: ' . $user_asset_serial);
         $this->comment('Asset Tag: ' . $user_asset_tag);
         $this->comment('Location: ' . $user_asset_location);
         $this->comment('Purchase Date: ' . $user_asset_purchase_date);
         $this->comment('Purchase Cost: ' . $user_asset_purchase_cost);
         $this->comment('Notes: ' . $user_asset_notes);
         $this->comment('Company Name: ' . $user_asset_company_name);
         $this->comment('------------- Action Summary ----------------');
         if ($user_username != '') {
             if ($user = User::MatchEmailOrUsername($user_username, $user_email)->whereNotNull('username')->first()) {
                 $this->comment('User ' . $user_username . ' already exists');
             } else {
                 $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->permissions = '{user":1}';
                 $user->password = bcrypt($password);
                 $user->activated = 1;
                 if ($user->save()) {
                     $this->comment('User ' . $first_name . ' created');
                 } else {
                     $this->error('ERROR CREATING User ' . $first_name . ' ' . $last_name);
                     $this->error($user->getErrors());
                 }
             }
         } else {
             $user = new User();
         }
         // Check for the location match and create it if it doesn't exist
         if ($location = Location::where('name', e($user_asset_location))->first()) {
             $this->comment('Location ' . $user_asset_location . ' already exists');
         } else {
             $location = new Location();
             if ($user_asset_location != '') {
                 $location->name = e($user_asset_location);
                 $location->address = '';
                 $location->city = '';
                 $location->state = '';
                 $location->country = '';
                 $location->user_id = 1;
                 if (!$this->option('testrun') == 'true') {
                     if ($location->save()) {
                         $this->comment('Location ' . $user_asset_location . ' was created');
                     } else {
                         $this->error('Something went wrong! Location ' . $user_asset_location . ' was NOT created');
                         $this->error($location->getErrors());
                     }
                 } else {
                     $this->comment('Location ' . $user_asset_location . ' was (not) created - test run only');
                 }
             } else {
                 $this->comment('No location given, so none created.');
             }
         }
         if (e($user_asset_category) == '') {
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:67,代码来源:AssetImportCommand.php


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