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


PHP Company::where方法代码示例

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


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

示例1: getView

 public function getView($id)
 {
     $company = Company::where("id", $id)->with(['customers' => function ($q) {
         $q->whereNull("user_id");
     }])->first();
     return view("company_profile.company_profile", ["company" => $company, "estimators" => User::where("company_id", $id)->count(), "jobs" => Job::where("company_id", $id)->count(), "customers" => $company->customers->count(), "estimatorz" => User::where("company_id", $id)->get()]);
 }
开发者ID:younggeeks,项目名称:twentyKitonga,代码行数:7,代码来源:CompanyController.php

示例2: store

 /**
  * Update the users profile
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = User::find($request->input('user_id'));
     $user->name = $request->input('name');
     $user->email = $request->input('email');
     $user->username = $request->input('username');
     if ($request->input('password') != '') {
         $user->password = bcrypt($request->input('password'));
     }
     $user->update();
     $company = Company::where('user_id', $request->input('user_id'))->first();
     $company->name = $request->input('company_name');
     $company->description = $request->input('company_description');
     $company->phone = $request->input('company_phone');
     $company->email = $request->input('company_email');
     $company->address1 = $request->input('company_address');
     $company->address2 = $request->input('company_address2');
     $company->city = $request->input('company_city');
     $company->postcode = $request->input('company_postcode');
     if ($request->hasFile('logo')) {
         $file = $request->file('logo');
         $name = Str::random(25) . '.' . $file->getClientOriginalExtension();
         $image = Image::make($request->file('logo')->getRealPath())->resize(210, 113, function ($constraint) {
             $constraint->aspectRatio();
         });
         $image->save(public_path() . '/uploads/' . $name);
         $company->logo = $name;
     }
     $company->update();
     flash()->success('Success', 'Profile updated');
     return back();
 }
开发者ID:wyrover,项目名称:applications,代码行数:39,代码来源:ProfileController.php

示例3: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->bind('article', function ($value) {
         return $this->getArticle()->where('slug', $value)->firstOrFail();
     });
     $router->bind('cong-ty', function ($value) {
         return \App\Company::where('slug', $value)->firstOrFail();
     });
     $router->bind('thiet-ke-thi-cong', function ($value) {
         return $this->designModel->getDesigns()->where('designs.slug', $value)->firstOrFail();
     });
     $router->bind('house', function ($value) {
         return $this->houseModel->getHouses()->where('houses.slug', $value)->firstOrFail();
     });
     $router->bind('company', function ($value) {
         return \App\Company::where('slug', $value)->firstOrFail();
     });
     $router->bind('project', function ($value) {
         return $this->projectModel->getProjects()->where('projects.slug', $value)->firstOrFail();
     });
     $router->model('owner', 'App\\House');
     $router->model('agency', 'App\\House');
     $router->model('message', 'App\\Message');
     parent::boot($router);
 }
开发者ID:khanhpnk,项目名称:sbds,代码行数:31,代码来源:RouteServiceProvider.php

示例4: authenticate

 public function authenticate(Request $request)
 {
     // TODO: authenticate JWT
     $credentials = $request->only('email', 'password');
     // dd($request->all());
     // Validate credentials
     $validator = Validator::make($credentials, ['password' => 'required', 'email' => 'required']);
     if ($validator->fails()) {
         return response()->json(['message' => 'Invalid credentials', 'errors' => $validator->errors()->all()], 422);
     }
     // Get user by email
     $company = Company::where('email', $credentials['email'])->first();
     // Validate Company
     if (!$company) {
         return response()->json(['error' => 'Invalid credentials'], 422);
     }
     // Validate Password
     if (!Hash::check($credentials['password'], $company->password)) {
         return response()->json(['error' => 'Invalid credentials'], 422);
     }
     // Generate Token
     $token = JWTAuth::fromUser($company);
     // Get expiration time
     $objectToken = JWTAuth::setToken($token);
     $expiration = JWTAuth::decode($objectToken->getToken())->get('exp');
     return response()->json(['access_token' => $token, 'token_type' => 'bearer', 'expires_in' => $expiration]);
 }
开发者ID:rafaell-lycan,项目名称:laravel-jobs-api,代码行数:27,代码来源:AuthController.php

示例5: getViewCompany

 public function getViewCompany($id)
 {
     if (Auth::user()->company_id != $id && !$this->entrust->hasRole("super_admin")) {
         return "You are Not Authrized to View Any Other Company's Profile ";
     }
     $company = Company::where("id", $id)->with(["customers"])->first();
     return view("company", ["company" => $company]);
 }
开发者ID:younggeeks,项目名称:twentyKitonga,代码行数:8,代码来源:TestController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //return view('Email.welcome');
     //
     $companies = \App\Company::where('active', 1)->get();
     $periods = \App\Period::where('active', 1)->get();
     return view('Admin.Registry.Company.company', ['companies' => $companies, 'periods' => $periods]);
 }
开发者ID:JJHdez,项目名称:OpenTpmW,代码行数:13,代码来源:RegistryCompaniesController.php

示例7: index

 public function index()
 {
     $data['is_showzhiye'] = Zhiye::where('z_show', '=', '1')->get();
     $data['allzhiye'] = Zhiye::all();
     $data['is_showcompany'] = Company::where('c_show', '=', '1')->get();
     $data['allcompany'] = Company::all();
     $data['alltime'] = Time::all();
     return view('contestRoom.index', $data);
 }
开发者ID:Greasi,项目名称:yizu,代码行数:9,代码来源:ContestRoomController.php

示例8: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request)
 {
     $data = $request->json()->get('data');
     $companyOld = $data[0]['companyOld'];
     $company = $data[0]['company'];
     $companyRec = \App\Company::where('name', $companyOld);
     if ($company != '') {
         $companyRec->update(['name' => $company]);
     }
 }
开发者ID:soniczhangss,项目名称:Ordering-System,代码行数:17,代码来源:CompanyController.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //get all companies using Eloquent all() method
     //$companies = Company::all();
     //since dataset is so large, let's use paginate instead => 100 results / page
     //https://laravel.com/docs/5.1/pagination
     $companies = Company::where('id', '>', 0)->simplePaginate(100);
     //return companies index view (view is in resources/views/companies/index.blade.php)
     return view('companies.index', compact('companies'));
 }
开发者ID:villeglad,项目名称:comex,代码行数:15,代码来源:CompaniesController.php

示例10: getCompany

 public function getCompany($request)
 {
     $company = Company::where('domain', '=', 'http://trapi.com')->first();
     //$id = $company->id;
     /*
      * perform a look up for the company
      * find the id and the layout, styles whatever else we need to render the correct template.
      */
     return $company;
 }
开发者ID:joshnykamp,项目名称:laravel_api,代码行数:10,代码来源:PagesController.php

示例11: alias

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function alias(Request $request)
 {
     if ($request->ajax()) {
         $user = \App\Company::where('alias', $request->get('alias'))->get();
         if ($user->count()) {
             return Response::json(array('msg' => 'true'));
         }
         return Response::json(array('msg' => 'false'));
     }
 }
开发者ID:sahilbhatt92,项目名称:transpt,代码行数:15,代码来源:ValidationController.php

示例12: unique

 /**
  * Check Unique Url
  *
  * @param Request $request
  * @return string Jquery Validation plugin only expect returns value string true or false
  */
 public function unique(Request $request, $id = null)
 {
     if ($request->ajax()) {
         $title = $request->input('title');
         if (is_null($id)) {
             return 0 == Company::where('title', $title)->count() ? 'true' : 'false';
         } else {
             return 0 == Company::where('title', $title)->where('id', '<>', $id)->count() ? 'true' : 'false';
         }
     }
 }
开发者ID:khanhpnk,项目名称:sbds,代码行数:17,代码来源:CompanyController.php

示例13: getCompaniesWithJobs

 public function getCompaniesWithJobs()
 {
     $companies = Company::where('status', 1)->with('category', 'jobs', 'people')->get();
     $companiesWithJobs = [];
     foreach ($companies as $company) {
         if ($company->jobs()->count() > 0) {
             array_push($companiesWithJobs, $company);
         }
     }
     return response()->json($companiesWithJobs);
 }
开发者ID:jakeboyles,项目名称:MadeInCincy,代码行数:11,代码来源:HomeController.php

示例14: doLogin

 public function doLogin()
 {
     $email = Input::get('email');
     $password = Input::get('password');
     $user = CompanyModel::where('email', $email)->where('password', md5($password))->get();
     if (count($user) > 0) {
         Session::set('company_id', $user[0]->id);
         return Redirect::route('project');
     } else {
         $alert['msg'] = 'Email & Password is incorrect';
         $alert['type'] = 'danger';
         return Redirect::route('company.login')->with('alert', $alert);
     }
 }
开发者ID:michaelotto126,项目名称:shokes,代码行数:14,代码来源:AuthController.php

示例15: index

 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index(Route $route)
 {
     $upcomingexhibitionevents = ExhibitionEvent::where('start_time', '>', date("Y-m-d H:i:s"))->take(4)->get();
     $currentlyexhibitionevents = ExhibitionEvent::where('start_time', '<', date("Y-m-d H:i:s"))->where('end_time', '>', date("Y-m-d H:i:s"))->take(4)->get();
     $tracklogins = Tracklogin::where('user_id', '=', Auth::User()->id)->orderBy('created_at', 'desc')->take(2)->get();
     $systemtracks = Systemtrack::where('user_id', '=', Auth::User()->id)->orderBy('created_at', 'desc')->take(5)->get();
     if (Auth::User()->type == 'company') {
         $user = User::find(Auth::User()->id);
         $company = Company::where('user_id', $user->id)->get();
         $company = $company[0];
         $companyId = $company->id;
         $exhibitors = Exhibitor::where('company_id', $companyId)->get();
         //$booths=array();
         $events = array();
         $i = 0;
         foreach ($exhibitors as $exhibitor) {
             $booths = Booth::where('exhibitor_id', $exhibitor->id)->get();
             foreach ($booths as $booth) {
                 $events[$i] = $booth->exhibition_event_id;
                 $i++;
             }
         }
         $events = array_unique($events);
         //var_dump($events); exit();
         $i = 0;
         $exhibitionevents = array();
         foreach ($events as $event) {
             $exhibitionevents[$i] = ExhibitionEvent::find($event);
             $i++;
         }
         // var_dump($exhibitionevents[0]); exit();
         $upcomingcompanyevents = array();
         $currentlycompanyevents = array();
         $finishedcompanyevents = array();
         $i = 0;
         foreach ($exhibitionevents as $exhibitionevent) {
             if ($exhibitionevent->start_time > date("Y-m-d H:i:s")) {
                 $upcomingcompanyevents[$i] = $exhibitionevent;
                 $i++;
             } elseif ($exhibitionevent->start_time < date("Y-m-d H:i:s") && $exhibitionevent->end_time > date("Y-m-d H:i:s")) {
                 $currentlycompanyevents[$i] = $exhibitionevent;
                 $i++;
             } else {
                 $finishedcompanyevents[$i] = $exhibitionevent;
                 $i++;
             }
         }
     }
     return view('home', compact('upcomingexhibitionevents', 'currentlyexhibitionevents', 'tracklogins', 'systemtracks', 'upcomingcompanyevents', 'currentlycompanyevents', 'finishedcompanyevents'));
 }
开发者ID:raniafathy,项目名称:wavexpo,代码行数:55,代码来源:HomeController.php


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