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


PHP Company::find方法代码示例

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


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

示例1: create

 public function create()
 {
     $data['title'] = "Create Vpn";
     $data['company'] = Company::find($id);
     $data['company']->company_id = $data['company']->id;
     return view('equipment/create', $data);
 }
开发者ID:pinkynrg,项目名称:convergence2.0,代码行数:7,代码来源:VpnsController.php

示例2: operatorsOnline

 static function operatorsOnline($company_id)
 {
     $response = 0;
     $department_admin_ids = CompanyDepartmentAdmins::where('company_id', $company_id)->lists('user_id');
     $company = Company::find($company_id);
     $user = User::find($company->user_id);
     if ($user->is_online == 1) {
         return 1;
     } else {
         foreach ($department_admin_ids as $admin_id) {
             if ($response == 0) {
                 $user = User::find($admin_id);
                 if ($user->is_online == 1) {
                     return 1;
                 } else {
                     $department_admin = DepartmentAdmins::where('user_id', $admin_id)->first();
                     if (!empty($department_admin)) {
                         $operators_ids = OperatorsDepartment::where('department_id', $department_admin->department_id)->lists('user_id');
                         foreach ($operators_ids as $operators_id) {
                             if (sizeof(User::where('id', $operators_id)->get()) > 0) {
                                 $user = User::find($operators_id);
                                 if ($user->is_online == 1) {
                                     return 1;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $response;
 }
开发者ID:noikiy,项目名称:Xenon-Support-Center,代码行数:33,代码来源:Company.php

示例3: getViewCompany

 public function getViewCompany($company_id)
 {
     $sql = "SELECT al.*, wrk.date_hired, wrk.date_finished, occ.title\n\t\t\t\tFROM alumni AS al\n\t\t\t\tINNER JOIN work_experience AS wrk\n\t\t\t\tON wrk.alumni_id = al.id\n\t\t\t\tINNER JOIN company AS com\n\t\t\t\tON com.id = wrk.company_id\n\t\t\t\tINNER JOIN occupation AS occ\n\t\t\t\tON occ.id = wrk.occupation_id\n\t\t\t\tWHERE com.id = ?";
     $company = Company::find($company_id);
     $employees = DB::select($sql, array($company_id));
     return View::make('admin.view_company')->with('company', $company)->with('employees', $employees);
 }
开发者ID:patocjurel,项目名称:capstone-project,代码行数:7,代码来源:AdminController.php

示例4: all

 public function all()
 {
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $company = Company::where('id', $department->company_id)->first();
         $messages = CannedMessages::where('company_id', $company->id)->where('department_id', $department->id)->orderBy('id', 'desc')->get();
     } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
         $department_admin = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $company = Company::where('id', $department->company_id)->first();
         $messages = CannedMessages::where('company_id', $company->id)->where('department_id', $department->id)->where('operator_id', Auth::user()->id)->orderBy('id', 'desc')->get();
     } else {
         $messages = CannedMessages::orderBy('id', 'desc')->get();
     }
     foreach ($messages as $message) {
         $operator = User::find($message->operator_id);
         $department = Department::find($message->department_id);
         $company = Company::find($message->company_id);
         $message->operator = $operator;
         $message->department = $department;
         $message->company = $company;
     }
     $this->data['messages'] = $messages;
     return View::make('canned_messages.all', $this->data);
 }
开发者ID:noikiy,项目名称:Xenon-Support-Center,代码行数:26,代码来源:CannedMessagesController.php

示例5: addUser

 /**
  * Create a new User instance.
  *
  * @param  Object  $request
  * @return Response
  */
 public static function addUser()
 {
     $app = \Slim\Slim::getInstance();
     $request = (object) $app->request->post();
     //validate input
     $validata = $app->validata;
     $validator = $validata::key('email', $validata::email()->notEmpty())->key('first_name', $validata::stringType()->notEmpty())->key('last_name', $validata::stringType()->notEmpty())->key('password', $validata::stringType()->notEmpty())->key('company', $validata::intVal())->key('city', $validata::stringType()->notEmpty())->key('province', $validata::stringType()->notEmpty())->key('zip_code', $validata::stringType()->notEmpty())->key('address', $validata::stringType()->notEmpty());
     $errors = array();
     try {
         $validator->assert((array) $request);
     } catch (\InvalidArgumentException $e) {
         $errors = $e->findMessages(array('email' => '{{name}} must be a valid email', 'first_name' => '{{name}} is required', 'last_name' => '{{name}} is required', 'password' => 'Password is required', 'company' => 'Company is required', 'city' => 'City is required', 'province' => 'State/Province is required', 'address' => 'Address is required', 'zip_code' => 'Zipcode is required'));
     }
     if ($validator->validate((array) $request)) {
         if (!PasswordController::isValid($request->password, $request->email)) {
             $app->halt('400', json_encode("Password Formart Wrong"));
         }
         if (!Company::find($request->company)) {
             $app->halt('400', json_encode("Company does not exist"));
         }
         if (self::isExist($request->email)) {
             $app->response->setStatus(400);
             return json_encode("Email already taken");
         }
         $user = new User();
         //$user->name = $request->name;
         $user->email = $request->email;
         $user->password = PasswordController::encryptPassword($request->password);
         $user->first_name = $request->first_name;
         $user->last_name = $request->last_name;
         if (isset($request->phone)) {
             $user->phone = $request->phone;
         }
         $user->city = $request->city;
         $user->address = $request->address;
         $user->province = $request->province;
         $user->zip_code = $request->zip_code;
         $user->country = $request->country;
         $user->active = 0;
         $user->save();
         $app->response->setStatus(200);
         //send confirm email
         if ($user->id) {
             $user->companies()->attach($request->company);
             $link = WEBSITELINK . '/' . self::$active_api . openssl_encrypt($user->id, 'AES-256-CBC', self::$pass, 0, self::$iv);
             EmailController::newUserConfirmation($user->id, $request->password, $link);
         }
         return $user->id;
     } else {
         $app->response->setStatus(400);
         $return = [];
         foreach (array_values($errors) as $key => $error) {
             if ($error != "") {
                 array_push($return, array("code" => $key, "data" => $error));
             }
         }
         return json_encode($return);
     }
 }
开发者ID:aanyun,项目名称:PHP-Sample-Code,代码行数:65,代码来源:UserController.php

示例6: apiAll

 public static function apiAll()
 {
     if (!Auth::user()->isAdmin()) {
         return [Company::find(Auth::user()["company_id"])];
     } else {
         return Company::all();
     }
 }
开发者ID:alternativex,项目名称:Backend-app,代码行数:8,代码来源:Company.php

示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $company = Company::find($id);
     $input = Input::all();
     $company->update($input);
     $company->save();
     return Redirect::to('admins/companies');
 }
开发者ID:hilmysyarif,项目名称:erp,代码行数:14,代码来源:AdminsCompanyController.php

示例8: dashboard

 public function dashboard($companies)
 {
     if (!Auth::check() or $companies != Auth::user()->company_id) {
         return Redirect::home();
     }
     $company = Company::find($companies);
     $products = $company->products;
     $products->load('orders');
     return View::make('companies.dashboard', compact('products'));
 }
开发者ID:hilmysyarif,项目名称:erp,代码行数:10,代码来源:CompaniesController.php

示例9: update

 public function update()
 {
     $company = User::find(Auth::user()->id)->company;
     $company = Company::find($company->id);
     $input = Input::all();
     $company->company_name = $input['company_name'];
     $company->company_address = $input['company_address'];
     $company->save();
     return Redirect::action('company.index');
 }
开发者ID:s2885117,项目名称:geoinfo,代码行数:10,代码来源:CompanyController.php

示例10: testSave

 public function testSave()
 {
     $c = new Company();
     $c->name = 'Model Persister Company 2';
     $c->save();
     $this->assertNotNull($c->id);
     $c->name = 'Model Persister Company 2 updated';
     $c->save();
     $c2 = Company::find($c->id);
     $this->assertEquals($c2->name, 'Model Persister Company 2 updated');
 }
开发者ID:scandio,项目名称:troba,代码行数:11,代码来源:ModelPersistersTest.php

示例11: 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

示例12: getList

 public function getList()
 {
     if (!empty($_REQUEST['uid'])) {
         $uid = (int) $_REQUEST['uid'];
         $where = array(array('uid', '=', $uid));
         $companyClass = new Company();
         $companyList = $companyClass->find($where);
         foreach ($companyList as $k => $company) {
             $companyList[$k] = $this->parse($company);
         }
         return $companyList;
     }
 }
开发者ID:AugustoAngeletti,项目名称:erepublik,代码行数:13,代码来源:company.php

示例13: initialize

 public function initialize()
 {
     // Company
     $company = new Select('companyid', Company::find(), array('using' => array('id', 'name')));
     $company->setLabel('Empresa');
     $this->add($company);
     $number = new Text('name');
     $number->setLabel('Número de Torre');
     $number->addValidators(array(new PresenceOf(array('message' => 'Debe ingresar un numero de torre'))));
     $this->add($number);
     //añadimos un botón de tipo submit
     $submit = $this->add(new Submit('save', array('class' => 'btn btn-success')));
 }
开发者ID:andresfranco,项目名称:Phalcontest,代码行数:13,代码来源:TowerForm.php

示例14: sendInvoice

 public function sendInvoice($invoice_id, $company_id)
 {
     $contact = Company::find((int) $company_id);
     if ($contact) {
         $put_url = '/sales_invoices/' . $invoice_id . '/send_invoice.json';
         $put_data = '{email:' . $contact->email . '}';
         try {
             $this->patchRequest($put_url, $put_data);
         } catch (Exception $e) {
             error_log($e->getMessage());
             die;
         }
     }
 }
开发者ID:strikles,项目名称:php,代码行数:14,代码来源:integrationMoneyBirdController2.php

示例15: testFind

 public function testFind()
 {
     $cq = EQM::queryByPrimary(Company::class, 2);
     $cm = Company::find(2);
     $this->assertEquals($cq->id, $cm->id);
     $this->assertEquals($cq->name, $cm->name);
     $pq = EQM::queryByPrimary(Project::class, '2_2_PROJECT');
     $pm = Project::find('2_2_PROJECT');
     $this->assertEquals($pq->id, $pm->id);
     $this->assertEquals($pq->name, $pm->name);
     $paq = EQM::queryByPrimary(ProjectActivity::class, ['id' => 100, 'projectId' => '2_2_PROJECT']);
     $pam = ProjectActivity::find(['id' => 100, 'projectId' => '2_2_PROJECT']);
     $this->assertEquals($paq->id, $pam->id);
     $this->assertEquals($paq->name, $pam->name);
 }
开发者ID:scandio,项目名称:troba,代码行数:15,代码来源:ModelFindersTest.php


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