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


PHP Company::findOrFail方法代码示例

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


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

示例1: delete

 public function delete($id)
 {
     $company = Company::findOrFail($id);
     $company->delete();
     Session::flash('info', trans('company.delete.success', array('name' => $company->name, 'restoreUrl' => URL::route('company.restore', array('id' => $company->id)))));
     return Redirect::route('company.index');
 }
开发者ID:dbirchak,项目名称:ping,代码行数:7,代码来源:CompanyController.php

示例2: show

 /**
  * Display the specified resource.
  * GET /orders/{id}
  *
  * @param  int $id
  * @return Response
  */
 public function show($company, $order)
 {
     if (is_numeric($order)) {
         $orders = Company::findOrFail($company)->orders->find($order);
         $offers = Offer::where('order_id', '=', $order)->where('provider_id', '=', Auth::user()->provider_id)->get();
         $company = Company::find($company);
         $interval = calculate_time_interval($orders->start_date, $orders->end_date);
         $dates = extract_dates($orders->start_date, $interval);
         $offer_dates = array_pluck($offers, 'date');
     }
     return View::make('orders.show', compact('offer_dates', 'offers', 'orders', 'company', 'interval', 'dates', 'start_at'));
 }
开发者ID:hilmysyarif,项目名称:erp,代码行数:19,代码来源:OrdersController.php

示例3: get_company_name

 function get_company_name($id)
 {
     try {
         $company = Company::findOrFail($id);
     } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         return '未知公司';
     }
     return $company->name;
 }
开发者ID:n0th1n9,项目名称:daizhang,代码行数:9,代码来源:helpers.php

示例4: update

 public function update()
 {
     $id = Input::get('id');
     $name = Input::get('name');
     $description = Input::get('description', '');
     $domain = Input::get('domain');
     $old_logo = Input::get('old_logo');
     if (sizeof(Company::where('name', $name)->where('id', '!=', $id)->get()) > 0) {
         Session::flash('error_msg', trans('msgs.company_already_exists'));
         return Redirect::to('/companies/update/')->withInput();
     }
     if (Config::get('site-config.is_demo') && $id == 1) {
         Session::flash('error_msg', 'Demo : Feature is disabled');
         return Redirect::to('/dashboard');
     }
     if (!$this->companyAddValidator->validate(Input::all())) {
         $messages = Utils::buildMessages($this->companyAddValidator->getValidation()->messages()->all());
         Session::flash('error_msg', $messages);
         return Redirect::to('/companies/update/' . $id)->withInput();
     } else {
         try {
             $company = Company::findOrFail($id);
             $company->name = $name;
             $company->description = $description;
             $company->domain = $domain;
             $company->user_id = Auth::user()->id;
             $company->logo = Input::hasFile('logo') ? Utils::imageUpload(Input::file('logo'), 'companies') : $old_logo;
             $company->save();
             Session::flash('success_msg', trans('msgs.company_updated_success'));
             return Redirect::to('/companies/all')->withInput();
         } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
             Session::flash('error_msg', trans('msgs.unable_to_update_company'));
             return Redirect::to('/companies/update/' . $id)->withInput();
         }
     }
 }
开发者ID:noikiy,项目名称:Xenon-Support-Center,代码行数:36,代码来源:CompaniesController.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $company = \Input::get('company_id');
     $contact = \Input::get('contact_id');
     if ($company) {
         $updateCompany = \Company::findOrFail($company);
         $updateCompany->company_name = \Input::get('company_name');
         $updateCompany->company_address = \Input::get('company_address');
         $updateCompany->company_city = \Input::get('company_city');
         $updateCompany->company_state = \Input::get('company_state');
         $updateCompany->company_pin = \Input::get('company_pin');
         $updateCompany->company_phone = \Input::get('company_land_line');
         $updateCompany->company_alt_phone = \Input::get('company_alt_land_line');
         $updateCompany->company_fax = \Input::get('company_fax');
         $updateCompany->company_website = \Input::get('company_website');
         if ($updateCompany->save()) {
             \Session::flash('success', 'Successfully updated');
             return;
         }
     }
     if ($contact) {
         $uId = \Input::get('user_id');
         $displayname = \Input::get('displayname');
         // user display name update
         $user = \User::findorFail($uId);
         $user->displayname = $displayname;
         // user contact
         //user contact detail
         $updateContact = \UserContact::findOrFail($contact);
         $updateContact->mobile = \Input::get('mobile');
         $updateContact->alt_mobile = \Input::get('alt_mobile');
         $updateContact->alt_email = \Input::get('alt_email');
         if ($updateContact->save() && $user->save()) {
             \Session::flash('success', 'Successfully updated');
             return;
         }
     }
 }
开发者ID:bhoopal10,项目名称:PayrollOriginal,代码行数:44,代码来源:ClientController.php

示例6: postUpdateCompany

 public function postUpdateCompany()
 {
     $company = \Input::get('company');
     $contact = \Input::get('contact');
     $registration = \Input::get('regstration');
     $professionaltax = \Input::get('professionaltax');
     $provident = \Input::get('provident');
     $esi_id = \Input::get('esi_id');
     $incometax = \Input::get('incometax');
     // condition for company
     if ($company) {
         $company_name = \Input::get('company_name');
         $company_address = \Input::get('company_address');
         $company_city = \Input::get('company_city');
         $company_state = \Input::get('company_state');
         $company_pin = \Input::get('company_pin');
         $company_country = \Input::get('company_country');
         $company_phone = \Input::get('company_phone');
         $company_alt_phone = \Input::get('company_alt_phone');
         $company_email = \Input::get('company_email');
         $company_alt_email = \Input::get('company_alt_email');
         $company_website = \Input::get('company_website');
         // update company
         $updateCompany = \Company::findOrFail($company);
         //initailize data
         $updateCompany->company_name = $company_name;
         $updateCompany->company_address = $company_address;
         $updateCompany->company_city = $company_city;
         $updateCompany->company_state = $company_state;
         $updateCompany->company_pin = $company_pin;
         $updateCompany->company_country = $company_country;
         $updateCompany->company_phone = $company_phone;
         $updateCompany->company_alt_phone = $company_alt_phone;
         $updateCompany->company_email = $company_email;
         $updateCompany->company_alt_email = $company_alt_email;
         $updateCompany->company_website = $company_website;
         // final update
         if ($updateCompany->save()) {
             echo "Company detail Successfully updated";
             return;
         } else {
             echo "Updation failed try again";
             return;
         }
     }
     //Condition for Contact
     if ($contact) {
         $primary_contact_person = \Input::get('primary_contact_person');
         $primary_phone = \Input::get('primary_phone');
         $primary_alt_phone = \Input::get('primary_alt_phone');
         $primary_email = \Input::get('primary_email');
         $primary_alt_email = \Input::get('primary_alt_email');
         $secondary_contact_person = \Input::get('secondary_contact_person');
         $secondary_phone = \Input::get('secondary_phone');
         $secondary_alt_phone = \Input::get('secondary_alt_phone');
         $secondary_email = \Input::get('secondary_email');
         $secondary_alt_email = \Input::get('secondary_alt_email');
         // call contact class
         $updateContact = \CompanyContact::findOrFail($contact);
         //initalize values
         $updateContact->primary_contact_person = $primary_contact_person;
         $updateContact->primary_phone = $primary_phone;
         $updateContact->primary_alt_phone = $primary_alt_phone;
         $updateContact->primary_email = $primary_email;
         $updateContact->primary_alt_email = $primary_alt_email;
         $updateContact->secondary_contact_person = $secondary_contact_person;
         $updateContact->secondary_phone = $secondary_phone;
         $updateContact->secondary_alt_phone = $secondary_alt_phone;
         $updateContact->secondary_email = $secondary_email;
         $updateContact->secondary_alt_email = $secondary_alt_email;
         //update contact
         if ($updateContact->save()) {
             echo "Contact updated succssfully";
             return;
         } else {
             echo "Updation failed try again";
             return;
         }
     }
     //condition for registration
     if ($registration) {
         $reg_pan = \Input::get('reg_pan');
         $reg_tan = \Input::get('reg_tan');
         $reg_incorporation_date = implode('-', array_reverse(explode('/', \Input::get('reg_incorporation_date'))));
         $reg_tan_circle = \Input::get('reg_tan_circle');
         $reg_cin = \Input::get('reg_cin');
         //call registration class
         $updateReg = \CompanyRegistration::findOrFail($registration);
         $updateReg->reg_pan = $reg_pan;
         $updateReg->reg_tan = $reg_tan;
         $updateReg->reg_incorporation_date = $reg_incorporation_date;
         $updateReg->reg_tan_circle = $reg_tan_circle;
         $updateReg->reg_cin = $reg_cin;
         //update values
         if ($updateReg->save()) {
             echo "Registration details updated successfully";
             return;
         } else {
             echo "Updation failed try again";
             return;
//.........这里部分代码省略.........
开发者ID:bhoopal10,项目名称:PayrollOriginal,代码行数:101,代码来源:UserController.php


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