本文整理汇总了PHP中app\models\Company::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::where方法的具体用法?PHP Company::where怎么用?PHP Company::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Company
的用法示例。
在下文中一共展示了Company::where方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$person = DB::table('people')->where('first_name', 'James')->where('last_name', 'Sample')->first();
$company = Company::where('name', 'Sample Company')->first();
$group_type = GroupType::where('name', 'employee')->first();
$group = Group::where('name', 'e80-helpdesk')->first();
if (isset($person)) {
CompanyPerson::create(['person_id' => $person->id, 'company_id' => $company->id, 'group_type_id' => $group_type->id, 'group_id' => $group->id]);
}
}
示例2: companyList
/**
* A list of companies this company has authority over
* ie company has authority over itself + child companies
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function companyList($status = '')
{
if ($status != '') {
$collection = Company::where('status', $status)->where('parent_company', $this->id)->orWhere('id', $this->id)->get();
} else {
$collection = Company::where('parent_company', $this->id)->orWhere('id', $this->id)->get();
}
return $collection;
}
示例3: updateLogo
/**
* Update the photo on user model resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function updateLogo(CompanyRequest $request, $slug)
{
$company = Company::where(compact('slug'))->firstOrFail();
// Check authorisation and throw 404 if not
if (!Auth::user()->allowedTo('edit', 'company', $company)) {
return view('errors/404');
}
$file = $request->file('logo');
$path = "filebank/company/" . $company->id;
$name = "logo." . strtolower($file->getClientOriginalExtension());
$path_name = $path . '/' . $name;
$file->move($path, $name);
Image::make(url($path_name))->fit(740)->save($path_name);
$company->logo_profile = $path_name;
$company->save();
Toastr::success("Saved changes");
return redirect('/company/' . $company->slug . '/settings/logo');
}
示例4: newcompanies
public function newcompanies(Request $request)
{
$companies = \App\Models\Company::where('created_at', '>', '2016-08-27 12:00:00')->orderBy('created_at', 'DESC')->get();
return view('pages/newcompanies', compact('companies'));
}
示例5: fire
//.........这里部分代码省略.........
$user_email_array = User::generateFormattedNameFromFullName($this->option('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'] . '@' . config('app.domain');
}
if ($user_username == '') {
if ($this->option('username_format') == 'email') {
$user_username = $user_email;
} else {
$user_name_array = User::generateFormattedNameFromFullName($this->option('username_format'), $user_name);
$user_username = $user_name_array['username'];
}
}
}
$this->comment('Full Name: ' . $user_name);
$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 = '';
示例6: getCompanies
/**
* Get Companies options for 'select' dropdown in Vuejs format
*/
public function getCompanies(Request $request, $company_id, $trade_id, $site_id)
{
$company_list = Auth::user()->company->companyList('1')->pluck('id')->toArray();
if ($company_id == 'match-trade' || $trade_id == 'match-trade') {
//if ($trade_id == 'match-trade')
// All authorised companies that have the given trade_id
$companies = Company::select(['companys.id', 'companys.name'])->join('company_trade', 'companys.id', '=', 'company_trade.company_id')->where('companys.status', '1')->where('company_trade.trade_id', $trade_id)->whereIn('companys.id', $company_list)->orderBy('name')->get();
} else {
if ($company_id == 'all') {
// All authorised companies
$companies = Company::where('status', '1')->whereIn('id', $company_list)->orderBy('name')->get();
} else {
// All authorised companies except the given company_id
$companies = Company::where('status', '1')->whereIn('id', $company_list)->where('id', '<>', $company_id)->orderBy('name')->get();
}
}
// Unique array of companies currently on planner for given site_id
$companiesOnPlanner = SitePlanner::distinct()->select('entity_id')->where('site_id', $site_id)->where('entity_type', 'c')->groupBy('entity_id')->lists('entity_id')->toArray();
$array = [];
$array[] = ['value' => '', 'text' => 'Select company'];
if ($company_id == 'match-trade') {
$array[] = ['value' => 'gen', 'text' => 'Unassigned (Generic)'];
}
// Create array in specific Vuejs 'select' format.
foreach ($companies as $company) {
$text = $company->name;
if (in_array($company->id, $companiesOnPlanner)) {
$text = '<b>' . $company->name . '</b>';
}
$array[] = ['value' => $company->id, 'text' => $text, 'name' => $company->name];
}
return $array;
}
示例7: onInformationStore
/**
* Function Store
* to Save/Update Brand From Brand Form
* @Request @Name,@Code etc
*
* @return json
*/
public function onInformationStore(\App\Http\Requests\InformationRequest $request)
{
$filename = "";
if ($request->file('image') != null) {
$file = $request->file('image');
$filename = $file->getClientOriginalName();
$upload = $file->move(base_path() . '/public/uploads/informations/', $filename);
}
$informations = new \App\Models\Information();
if ($request->has('id')) {
$informations = $informations->where('id', $request->get('id'))->first();
$informations->updated_at = date('Y-m-d H:i:s');
$informations->updated_by = Auth::user()->id;
//delete information exists
\App\Models\InformationCompany::where('information_id', $request->get('id'))->delete();
} else {
$informations->created_at = date('Y-m-d H:i:s');
$informations->created_by = Auth::user()->id;
}
if ($filename != "") {
$informations->name = $filename;
$informations->mime = $file->getClientMimeType();
}
$informations->description = $request->get('description');
$informations->active = $request->get('active') ? $request->get('active') : 0;
$informations->save();
//Com Files
$company = $request->get('companies');
$company_selected = count($company);
if ($company_selected > 0) {
$company_access = "";
for ($i = 0; $i < $company_selected; $i++) {
if (isset($company[$i])) {
$info_company = new \App\Models\InformationCompany();
$info_company->company_id = $company[$i];
$info_company->information_id = $informations->id;
$info_company->save();
//Search User
$company_info = \App\Models\Company::where('id', $company[$i])->first();
if ($i > 0) {
$company_access .= ',';
}
if ($company_info) {
$company_access .= $company_info->_id;
}
}
}
$info = \App\Models\Information::where('id', $informations->id)->first();
$info->company_access = $company_access;
$info->save();
}
if ($informations) {
$param['message'] = Lang::get('info.inserted');
$param['error'] = false;
} else {
$param['message'] = Lang::get('message.file error') . " Error" . $company_selected;
$param['error'] = true;
}
return json_encode($param);
}
示例8: index
public function index()
{
$company = Company::where('id', '>=', '1')->orderBy('id', 'desc')->paginate(5);
return view('company.index', compact('company'));
}
示例9: profile
public function profile($id = null)
{
$adc = ConsortiumGlobal::where('id', '1')->first();
$atas = Ata::where('active', 1)->get();
$disassemblers = Disassembler::lists('name', 'id');
$user = Auth::user();
$types = ProjectType::lists('type', 'id');
$company = Company::where('id', $user->company_id)->first();
if ($id) {
$project = Project::find($id);
} else {
$project = Project::create(['creator_id' => $user->id, 'company_id' => $user->company_id, 'directory_path' => $company->company . '/' . date('Y') . '/']);
}
return view('projects.profile', compact('adc', 'atas', 'company', 'disassemblers', 'project', 'types', 'user'));
}
示例10: onDelete
/**
* Function Remove
* Process Delete the Brand Data
*
* @return \Illuminate\Http\JsonResponse
*/
public function onDelete()
{
$id = Input::get('id');
$Model = \App\Models\Company::select(['id'])->where('id', $id)->first();
if ($Model) {
\App\Models\Company::where('id', $id)->delete();
$param['message'] = Lang::get('info.has deleted');
$param['error'] = false;
} else {
$param['message'] = Lang::get('info.has error');
$param['error'] = true;
}
return json_encode($param);
}
示例11: edit
public function edit($id)
{
if (Auth::user()->can('update-ticket')) {
$data['ticket'] = self::API()->find(['id' => $id]);
$temp = DB::table("ticket_links")->where("ticket_id", "=", $id)->get();
foreach ($temp as $elem) {
$links[] = $elem->linked_ticket_id;
}
$data['ticket']['linked_tickets_id'] = isset($links) ? implode(",", $links) : '';
$data['companies'] = Company::where('id', '!=', ELETTRIC80_COMPANY_ID)->orderBy('name')->get();
$data['priorities'] = Priority::orderBy('id', 'desc')->get();
$data['divisions'] = Division::orderBy('name')->get();
$data['job_types'] = JobType::orderBy('name')->get();
$data['levels'] = Level::orderBy('name')->get();
$data['assignees'] = CompanyPersonController::API()->all(["where" => ["companies.id|=|" . ELETTRIC80_COMPANY_ID], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]);
$data['companies'] = CompaniesController::API()->all(['where' => ['companies.id|!=|' . ELETTRIC80_COMPANY_ID], 'order' => ['companies.name|ASC'], 'paginate' => 'false']);
$data['tags'] = "";
foreach ($data['ticket']->tags as $tag) {
$data['tags'] .= $tag->name . ",";
}
$is_draft = $data['ticket']->status_id == TICKET_DRAFT_STATUS_ID ? true : false;
$data['title'] = "Edit Ticket #" . $id;
return view('tickets/edit', $data);
} else {
return redirect()->back()->withErrors(['Access denied to tickets edit page']);
}
}
示例12: company
public function company()
{
$company = Company::where('status', 'Y')->orderBy('id', 'desc')->paginate(5);
$data = ['company' => $company];
return view('order.company', compact('data'));
}