本文整理汇总了PHP中Company::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::where方法的具体用法?PHP Company::where怎么用?PHP Company::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEditCompInfo
public function getEditCompInfo($id)
{
$company = \Company::where('user_id', '=', $id)->first();
if ($company) {
return \View::make('admin/user.company_view')->with('company', $company);
}
}
示例2: 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);
}
示例3: home
public function home($id = 0)
{
$param['pageNo'] = 0;
if ($alert = Session::get('alert')) {
$param['alert'] = $alert;
}
$userId = Session::has('user_id') ? Session::get('user_id') : 0;
$prefix = DB::getTablePrefix();
$result = DB::table('store')->join('company', 'store.company_id', '=', 'company.id')->leftJoin(DB::raw('(SELECT * FROM ' . $prefix . 'queue WHERE user_id = ' . $userId . ' AND DATE(created_at) = DATE(NOW()) GROUP BY store_id) AS ' . $prefix . 'queues'), 'store.id', '=', 'queues.store_id')->join('status', 'store.id', '=', 'status.store_id')->leftJoin(DB::raw('(SELECT count(*) as cnt, store_id FROM ' . $prefix . 'agent WHERE is_active = 1 GROUP BY store_id) AS ' . $prefix . 'agt'), 'agt.store_id', '=', 'store.id')->join('company_setting', 'company_setting.company_id', '=', 'company.id')->join('category', 'category.id', '=', 'company.category_id')->join('city', 'city.id', '=', 'company.city_id')->select('store.id', 'store.name as store_name', 'store.address as address', 'company.name as company_name', 'company_setting.waiting_time', 'status.current_queue_no', 'status.last_queue_no', 'agt.cnt', 'queues.queue_no');
if ($id == 0) {
$param['stores'] = $result->paginate(PAGINATION_SIZE);
} else {
$companyIds = array();
$companyIds[] = 0;
$companies = CompanyModel::where('category_id', $id)->get();
foreach ($companies as $company) {
$companyIds[] = $company->id;
}
$param['stores'] = $result->whereIn('store.company_id', $companyIds)->paginate(PAGINATION_SIZE);
}
$param['total'] = StoreModel::count();
$param['category'] = $id;
$param['categories'] = CategoryModel::all();
return View::make('user.store.home')->with($param);
}
示例4: getCompanies
function getCompanies(Cluster $cluster)
{
$companies = Company::where('cluster_id', '=', $cluster->id)->get();
// decode company domains
foreach ($companies as $company) {
$company->domains = json_decode($company->domains);
}
return $companies;
}
示例5: create
public function create()
{
if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
$department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
$this->data['department'] = Department::where('id', $department_admin->department_id)->first();
$this->data["company"] = Company::where('id', $this->data['department']->company_id)->first();
} elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
$department_operator = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
$this->data['department'] = Department::where('id', $department_operator->department_id)->first();
$this->data["company"] = Company::where('id', $this->data['department']->company_id)->first();
} else {
$this->data['companies'] = Company::all();
}
$this->data['timezones'] = Config::get("timezones");
$this->data['countries'] = DB::table('countries')->get();
return View::make('customers.create', $this->data);
}
示例6: getUpdatedFields
static function getUpdatedFields($is_fake = false, $ticket_id = 0, $msg_id = 0)
{
if (!$is_fake) {
$ticket = Tickets::where('id', $ticket_id)->first();
$thread_message = ThreadMessages::where('id', $msg_id)->first();
$ticket_attachment = TicketAttachments::where('message_id', $msg_id)->first();
$customer = User::where('id', $ticket->customer_id)->first();
$operator = User::where('id', $ticket->operator_id)->first();
$company = Company::where('id', $ticket->company_id)->first();
$department = Department::where('id', $ticket->department_id)->first();
$receiver = Input::get('user_id') == $ticket->operator_id ? $customer : $operator;
$mailer_extra = ['ticket_id' => $ticket->id, 'ticket_subject' => $ticket->subject, 'ticket_description' => $ticket->description, 'ticket_status' => $ticket->status, 'ticket_status_txt' => self::resolveStatus($ticket->status), 'ticket_priority' => $ticket->priority, 'ticket_priority_txt' => self::resolveStatus($ticket->priority), 'company_name' => $company->name, 'company_description' => $company->description, 'company_domain' => $company->domain, 'company_logo' => $company->logo, 'department_name' => $department->name, 'has_attachment' => $ticket_attachment->has_attachment, 'attachment_path' => $ticket_attachment->attachment_path, 'updated_message' => $thread_message->message, 'receiver_name' => $receiver->name, 'receiver_email' => $receiver->email];
} else {
$mailer_extra = ['ticket_id' => 1, 'ticket_subject' => "How can i use contact us form", 'ticket_description' => "Hi , Sir how can i use contact us form", 'ticket_status' => 1, 'ticket_status_txt' => self::resolveStatus(1), 'ticket_priority' => 1, 'ticket_priority_txt' => self::resolveStatus(1), 'company_name' => "KODEINFO", 'company_description' => "We are a small and dedicated team of designers/developers. This is our web design and development focused blog.We focus on pushing the boundaries of standards based web technologies.", 'company_domain' => "http://www.kodeinfo.com", 'company_logo' => "http://kodeinfo.com/img/shortlogo.png", 'department_name' => "General Queries", 'has_attachment' => false, 'attachment_path' => "", 'updated_message' => "This is a updated message from customer/operator", 'receiver_name' => "Imran", 'receiver_email' => "shellprog@gmail.com"];
}
return $mailer_extra;
}
示例7: Company
function get_logged_company()
{
if (!$this->is_signed_in()) {
return NULL;
} else {
if ($this->CI->session->userdata('company_id') || $this->CI->session->userdata('institution_id')) {
$c = new Company();
$c->where('id', $this->CI->session->userdata('company_id'))->get();
if ($c->exists()) {
return $c;
} else {
$c = new Institution();
$c->where('id', $this->CI->session->userdata('institution_id'))->get();
if ($c->exists()) {
return $c;
}
}
}
return NULL;
}
}
示例8: create
public function create()
{
if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
$department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
$this->data['department'] = Department::where('id', $department_admin->department_id)->first();
$this->data["company"] = Company::where('id', $this->data['department']->company_id)->first();
$permissions_keys = explode(",", $this->data['department']);
$permissions = Permissions::whereIn('key', $permissions_keys)->get();
$this->data['permissions'] = $permissions;
} elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
$department_operator = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
$this->data['department'] = Department::where('id', $department_operator->department_id)->first();
$this->data["company"] = Company::where('id', $this->data['department']->company_id)->first();
$permissions_keys = explode(",", $this->data['department']);
$permissions = Permissions::whereIn('key', $permissions_keys)->get();
$this->data['permissions'] = $permissions;
} else {
$companies = Company::all();
$this->data['companies'] = $companies;
if (sizeof($companies) > 0) {
$department = Department::where("company_id", $companies[0]->id)->first();
if (empty($department)) {
Session::flash('error_msg', trans('msgs.create_department_before_adding_operators'));
return Redirect::back();
}
$permissions_keys = explode(",", $department->permissions);
$permissions = Permissions::whereIn('key', $permissions_keys)->get();
$this->data['permissions'] = $permissions;
$this->data['departments'] = Department::where("company_id", $companies[0]->id)->get();
} else {
$this->data['permissions'] = [];
$this->data['departments'] = [];
}
}
$this->data["countries"] = DB::table("countries")->remember(60)->get();
$this->data['timezones'] = Config::get("timezones");
return View::make('operators.create', $this->data);
}
示例9: update
/**
* Update the specified resource in storage.
* PUT /contact/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
Input::merge(array_map('trim', Input::all()));
$input = Input::all();
$validation = Validator::make($input, Contact::$rules);
$gettime = time() - 14400;
$datetime_now = date("H:i:s", $gettime);
if (Input::get('fullname') == 'No record found.') {
return Redirect::route('contact.edit')->withInput()->with('class', 'error')->with('message', 'Input proper fullname.');
}
if ($validation->passes()) {
if (Input::get('category') == '1') {
$street = Input::get('street_hid');
$city = Input::get('city_hid');
$province = Input::get('province_hid');
$country = Input::get('country_hid');
$zip_code = Input::get('zip_code_hid');
$street_2 = Input::get('street_2');
$city_2 = Input::get('city_2');
$province_2 = Input::get('province_2');
$country_2 = Input::get('country_2');
$zip_code_2 = Input::get('zip_code_2');
} else {
$street = Input::get('i_street');
$city = Input::get('i_city');
$province = Input::get('i_province');
$country = Input::get('i_country');
$zip_code = Input::get('i_zip_code');
$street_2 = Input::get('street_2');
$city_2 = Input::get('city_2');
$province_2 = Input::get('province_2');
$country_2 = Input::get('country_2');
$zip_code_2 = Input::get('zip_code_2');
}
if ($street == "" || $city == "" || $country == "") {
return Redirect::route('contact.edit', $id)->withInput()->with('class', 'error')->with('message', 'Make sure to fill-up company address.');
}
$contact = Contact::find($id);
if (is_null($contact)) {
return Redirect::route('contact.edit', $id)->withInput()->withErrors($validation)->with('class', 'warning')->with('message', 'Contact information not exist.');
}
$contact->position = Input::get('profession');
$contact->fullname = strtoupper(Input::get('fullname'));
$contact->gender = strtoupper(Input::get('gender'));
$contact->category = Input::get('category');
$contact->company = Input::get('company');
$contact->in_company_position = Input::get('position');
$contact->street = strtoupper($street);
$contact->city = strtoupper($city);
$contact->province = strtoupper($province);
$contact->country = strtoupper($country);
$contact->zip_code = strtoupper($zip_code);
$contact->street_2 = strtoupper($street_2);
$contact->city_2 = strtoupper($city_2);
$contact->province_2 = strtoupper($province_2);
$contact->country_2 = strtoupper($country_2);
$contact->zip_code_2 = strtoupper($zip_code_2);
$contact->contact_number = Input::get('contact_number');
$contact->contact_number2 = Input::get('2nd_contact_number');
$contact->contact_number3 = Input::get('3rd_contact_number');
$contact->status = 1;
// if(Contact::check_ifcontactinfoExist($contact))
// {
// return Redirect::route('contact.edit', $id)
// ->withInput()
// ->withErrors($validation)
// ->with('class', 'warning')
// ->with('message', 'Record was already added by BDO.');
// }
$contactinformation = DB::table('contacts')->select('contacts.*', 'positions.position as cp_position')->join('positions', 'positions.id', '=', 'contacts.position')->where('contacts.id', $id)->first();
$pos = DB::table('positions')->where('id', Input::get('position'))->first();
if ($contactinformation->company != '0') {
$comp = Company::where('id', $contactinformation->company)->first();
$companyname = $comp->company_name;
$new_comp = Company::where('id', Input::get('company'))->first();
$new_companyname = $new_comp->company_name;
} else {
$companyname = 'N/A';
$new_companyname = 'N/A';
}
if (Contact::where('position', Input::get('position'))->where('id', $id)->count() > 0) {
$position = "";
} else {
$position = "POSITION : " . $contactinformation->cp_position . " INTO " . strtoupper($pos->position) . ", ";
}
if (Contact::where('fullname', strtoupper(Input::get('fullname')))->where('id', $id)->count() > 0) {
$fullname = "";
} else {
$fullname = "FULLNAME : " . $contactinformation->fullname . " INTO " . strtoupper(Input::get('fullname')) . ", ";
}
if (Contact::where('gender', strtoupper(Input::get('gender')))->where('id', $id)->count() > 0) {
$gender = "";
} else {
//.........这里部分代码省略.........
示例10: delete
public function delete($company_id)
{
$departments = Department::where('company_id', $company_id)->get();
if (Config::get('site-config.is_demo') && $company_id == 1) {
Session::flash('error_msg', 'Demo : Feature is disabled');
return Redirect::to('/dashboard');
}
foreach ($departments as $department) {
if (!empty($department)) {
$tickets = Tickets::where('department_id', $department->id)->get();
//Delete tickets
foreach ($tickets as $ticket) {
TicketAttachments::where('thread_id', $ticket->id)->delete();
MessageThread::where('id', $ticket->thread_id)->delete();
ThreadMessages::where('thread_id', $ticket->thread_id)->delete();
}
Tickets::where('department_id', $department->id)->delete();
//Delete Chat and Conversations
$online_users = OnlineUsers::where('department_id', $department->id)->get();
foreach ($online_users as $online_user) {
MessageThread::where('id', $online_user->thread_id)->delete();
ThreadMessages::where('thread_id', $online_user->thread_id)->delete();
}
OnlineUsers::where('department_id', $department->id)->delete();
$closed_conversations = ClosedConversations::where('department_id', $department->id)->get();
foreach ($closed_conversations as $closed_conversation) {
MessageThread::where('id', $closed_conversation->thread_id)->delete();
ThreadMessages::where('thread_id', $closed_conversation->thread_id)->delete();
}
ClosedConversations::where('department_id', $department->id)->delete();
$operators = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
if (sizeof($operators) > 0) {
User::whereIn('id', $operators)->delete();
UsersGroups::whereIn('user_id', $operators)->delete();
}
OperatorsDepartment::where('department_id', $department->id)->delete();
$department_admin = DepartmentAdmins::where('department_id', $department->id)->first();
if (!empty($department_admin)) {
UsersGroups::where('user_id', $department_admin->user_id)->delete();
User::where("id", $department_admin->user_id)->delete();
CompanyDepartmentAdmins::where("user_id", $department_admin->user_id)->delete();
CannedMessages::where('operator_id', $operators)->delete();
}
}
DepartmentAdmins::where('department_id', $department->id)->delete();
Department::where('id', $department->id)->delete();
}
$company = Company::where('id', $company_id)->first();
RecentActivities::createActivity("Company <a href='/companies/all'>" . $company->name . "</a> deleted by User Name " . Auth::user()->name . " User ID " . Auth::user()->id);
Company::where('id', $company_id)->delete();
Session::flash('success_msg', trans('msgs.company_deleted_success'));
return Redirect::to('/companies/all');
}
示例11: function
Route::post('admin/companies/add', function () {
$input = Input::get(array('title', 'slug', 'description'));
$validator = new validator($input);
$validator->check('title')->is_max(3, __('companies.title_missing'));
if ($errors = $validator->errors()) {
Input::flash();
Notify::error($errors);
return Response::redirect('admin/companies/add');
}
if (empty($input['slug'])) {
$input['slug'] = $input['title'];
}
$input['slug'] = slug($input['slug']);
$company = Company::create($input);
Extend::process('company', $company->id);
Notify::success(__('companies.created'));
return Response::redirect('admin/companies');
});
Route::get('admin/companies/delete/(:num)', function ($id) {
$total = Company::count();
if ($total == 1) {
Notify::error(__('companies.delete_error'));
return Response::redirect('admin/companies/edit/' . $id);
}
$company = Company::where('id', '<>', $id)->fetch();
Company::find($id)->delete();
Post::where('company', '=', $id)->update(array('company' => $company->id));
Notify::success(__('companies.deleted'));
return Response::redirect('admin/companies');
});
});
示例12: all
public function all()
{
$online_users = OnlineUsers::all();
foreach ($online_users as $user) {
$user->user = User::find($user->user_id);
if ($user->operator_id > 0) {
$user->operator = User::find($user->operator_id);
}
}
if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
$department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
$this->data['department'] = Department::where('id', $department_admin->department_id)->first();
$this->data["company"] = Company::where('id', $this->data['department']->company_id)->first();
} elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
$department_operator = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
$this->data['department'] = Department::where('id', $department_operator->department_id)->first();
$this->data["company"] = Company::where('id', $this->data['department']->company_id)->first();
}
$this->data['online_users'] = $online_users;
return View::make('conversations.all', $this->data);
}
示例13: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//transaction strats
\DB::beginTransaction();
//delete user in user table
$userDel = \User::find($id);
if (!$userDel->delete()) {
\DB::rollback();
return \Redirect::back()->with('error', 'Failed to delete');
}
//delete user from friends table
$friendDel = \Friends::where('child_id', '=', $id)->first();
if (!$friendDel->delete()) {
\DB::rollback();
return \Redirect::back()->with('error', 'Failed to delete');
}
//delete clients company
$companyDel = \Company::where('user_id', '=', $id)->first();
if (!$companyDel->delete()) {
\DB::rollback();
return \Redirect::back()->with('error', 'Failed to delete');
} else {
\DB::commit();
return \Redirect::back()->with('success', 'Successfully deleted');
}
}
示例14: edittask_forcompany
public function edittask_forcompany($id)
{
$pagetitle = 'Edit Task for Company';
$get_company = Company::where('status', '=', 2)->orderBy('company_name', 'asc')->lists('company_name', 'id');
$get_task = Task::orderBy('task', 'asc')->lists('task', 'id');
$get_taskforcompany = DB::table('mytask_forcompany')->where('id', $id)->first();
$getattached = DB::table('attached_forcompany')->where('forcompany_id', $id)->get();
$my_company = Company::where('id', $get_taskforcompany->company_id)->first();
$my_task = Task::where('id', $get_taskforcompany->task_id)->first();
return View::make('task.edit_taskforcompany', compact('pagetitle', 'get_company', 'get_task', 'get_taskforcompany', 'my_company', 'my_task', 'getattached'));
}
示例15: array
function company_get()
{
$filters = $this->get("filter")["filters"];
$page = $this->get("page");
$limit = $this->get("limit");
$sort = $this->get("sort");
$data["results"] = array();
$data["count"] = 0;
$obj = new Company(null, $this->entity);
//Sort
if (!empty($sort) && isset($sort)) {
foreach ($sort as $value) {
$obj->order_by($value["field"], $value["dir"]);
}
}
//Filter
if (!empty($filters) && isset($filters)) {
foreach ($filters as $value) {
$obj->where($value["field"], $value["value"]);
}
}
if (!empty($limit) && !empty($page)) {
$obj->include_related('currency', array('locale', 'rate'), FALSE);
$obj->get_paged_iterated($page, $limit);
$data["count"] = $obj->paged->total_rows;
}
if ($obj->result_count() > 0) {
foreach ($obj as $value) {
//Results
$data["results"][] = array("id" => $value->id, "name" => $value->name, "abbr" => $value->abbr, "currency_id" => $value->currency_id, "locale" => $value->locale, "rate" => $value->rate);
}
}
//Response Data
$this->response($data, 200);
}