本文整理汇总了PHP中Department::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::where方法的具体用法?PHP Department::where怎么用?PHP Department::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Department
的用法示例。
在下文中一共展示了Department::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: account
public function account()
{
$doctor = Doctor::where('user_id', Session::get('user.id'))->first();
$hospital_id = $doctor->department->hospital_id;
$default_department = $doctor->department_id;
$departments = Department::where('hospital_id', $hospital_id)->get();
$render_data = array('name' => $doctor->name, 'photo' => $doctor->photo, 'title' => $doctor->title, 'specialty' => strip_tags($doctor->specialty), 'description' => strip_tags($doctor->description), 'default_department' => $doctor->department_id, 'departments' => $departments, 'top_photo' => Session::get('doctor.photo'));
return View::make('doctor.account', $render_data);
}
示例3: department_list
function department_list($id = null)
{
if ($id) {
$dept = new Department($id);
$list = new Department();
$list->where('parent_id', $id);
$list->order_by('orders', 'asc');
$list->get();
child_personnel(0, $id, $dept->title);
foreach ($list as $key_tmp => $tmp) {
department_list($tmp->id);
}
}
}
示例4: getUniCompany
static function getUniCompany()
{
$company_id = 0;
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_id = $department->company_id;
} 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_id = $department->company_id;
}
return $company_id;
}
示例5: getProfile
public function getProfile()
{
if (Auth::check()) {
$title = "Cambiar Perfil";
$department = Department::all();
$user = User::where('id', '=', Auth::id())->first();
$id = $user->state;
$userDep = Department::where('id', '=', $id)->pluck('nombre');
if (!empty($user) && $user != "" && !is_null($user)) {
return View::make('user.profile')->with('title', $title)->with('user', $user)->with('department', $department)->with('userDep', $userDep);
}
} else {
Session::flash('error', 'Debe iniciar sesión para acceder a esta área');
return Redirect::to('inicio/login');
}
}
示例6: updateAction
/**
* Update the department
*
* @param $id
*/
public function updateAction($id)
{
$department = Department::find($id);
$validation = Validator::make(Input::all(), Department::$rules);
if (!$validation->passes()) {
return Redirect::route('departments.edit', $id)->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
}
/**
* Check name duplicates
*/
if (count(Department::where('name', Input::get('name'))->where('id', '!=', $id)->get())) {
return Redirect::route('departments.edit', $id)->withInput()->with('message', 'This department already exists.');
}
$department->update(Input::all());
$department->save();
return Redirect::route('departments.show', $id);
}
示例7: 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;
}
示例8: store
/**
* Store a newly created resource in storage.
* POST /department
*
* @return Response
*/
public function store()
{
$validator = Validator::make(Input::all(), Department::$rules);
$row = Department::where('id_dept', '=', Input::get('id_dept'));
if ($validator->fails()) {
return Redirect::to('department')->withErrors($validator)->withInput(Input::all());
} else {
if (Department::where('id_dept', '=', Input::get('id_dept'))->exists()) {
$department = Department::find(Input::get('id_dept'));
$department->nm_dept = Input::get('nm_dept');
$department->save();
Session::flash('message', 'Successfully updated Department!');
return Redirect::to('department');
} else {
$department = new Department();
$department->id_dept = Input::get('id_dept');
$department->nm_dept = Input::get('nm_dept');
$department->save();
Session::flash('message', 'Successfully created Department!');
return Redirect::to('department');
}
}
//
}
示例9: ticketsRefresh
public function ticketsRefresh()
{
if (Input::get('company_id', 0) > 0 && Input::get('department_id', 0) > 0) {
$tickets = Tickets::orderBy('priority', 'desc')->where('company_id', Input::get('company_id'))->where('department_id', Input::get('department_id'))->get();
} else {
$tickets = Tickets::orderBy('priority', 'desc')->get();
}
$tickets_arr = [];
foreach ($tickets as $ticket) {
$ticket->customer = User::where('id', $ticket->customer_id)->first();
$ticket->company = Company::where('id', $ticket->company_id)->first();
$ticket->department = Department::where('id', $ticket->department_id)->first();
if ($ticket->operator_id > 0) {
$ticket->operator = User::where('id', $ticket->operator_id)->first();
}
$single_ticket = [];
$single_ticket[] = $ticket->id;
$single_ticket[] = isset($ticket->company) ? $ticket->company->name : trans('msgs.none');
$single_ticket[] = isset($ticket->department) ? $ticket->department->name : trans('msgs.none');
$single_ticket[] = isset($ticket->customer) ? $ticket->customer->name : trans('msgs.none');
$single_ticket[] = isset($ticket->customer) ? $ticket->customer->email : trans('msgs.none');
$single_ticket[] = $ticket->subject;
$single_ticket[] = isset($ticket->operator) ? $ticket->operator->name : trans('msgs.none');
if ($ticket->priority == Tickets::PRIORITY_LOW) {
$single_ticket[] = '<td ><label class="label label-primary" > ' . trans("msgs.low") . ' </label ></td >';
}
if ($ticket->priority == Tickets::PRIORITY_MEDIUM) {
$single_ticket[] = '<td><label class="label label-primary">' . trans("msgs.medium") . '</label></td>';
}
if ($ticket->priority == Tickets::PRIORITY_HIGH) {
$single_ticket[] = '<td><label class="label label-warning">' . trans("msgs.high") . '</label></td>';
}
if ($ticket->priority == Tickets::PRIORITY_URGENT) {
$single_ticket[] = '<td><label class="label label-danger">' . trans("msgs.urgent") . '</label></td>';
}
if ($ticket->status == Tickets::TICKET_NEW) {
$single_ticket[] = '<td><label class="label label-warning">' . trans("msgs.new") . '</label></td>';
}
if ($ticket->status == Tickets::TICKET_PENDING) {
$single_ticket[] = '<td><label class="label label-primary">' . trans("msgs.pending") . '</label></td>';
}
if ($ticket->status == Tickets::TICKET_RESOLVED) {
$single_ticket[] = '<td><label class="label label-success">' . trans("msgs.resolved") . '</label></td>';
}
if (!isset($ticket->operator)) {
$single_ticket[] = '<td><a href="/tickets/read/' . $ticket->thread_id . '" class="btn btn-success btn-sm"> <i class="icon-checkmark4"></i> ' . trans("msgs.accept") . ' </a></td>';
}
if (isset($ticket->operator) && $ticket->operator->id == Auth::user()->id) {
$single_ticket[] = '<td><a href="/tickets/read/' . $ticket->thread_id . '" class="btn btn-success btn-sm"> <i class="icon-checkmark4"></i> ' . trans("msgs.reply") . ' </a></td>';
}
if (isset($ticket->operator) && $ticket->operator->id != Auth::user()->id) {
$single_ticket[] = '<td><a disabled class="btn btn-success btn-sm"> <i class="icon-lock3"></i> ' . trans("msgs.accept") . ' </a></td>';
}
$single_ticket[] = '<td><a href="/tickets/transfer/' . $ticket->id . '" class="btn btn-warning btn-sm"> <i class="icon-share3"></i> ' . trans("msgs.transfer") . ' </a></td>';
$single_ticket[] = '<td><a href="/tickets/delete/' . $ticket->thread_id . '" class="btn btn-danger btn-sm"> <i class="icon-remove3"></i> ' . trans("msgs.delete") . ' </a></td>';
$tickets_arr[] = $single_ticket;
}
return json_encode(['aaData' => $tickets_arr]);
}
示例10: postPropReports
public function postPropReports()
{
$filter = 'go';
$dept = Input::get('deptid');
$category = Input::get('category');
if ($dept == "*") {
$deptpdf = "*";
} else {
$deptpdf = Department::where('id', $dept)->pluck('id');
}
if ($category == "*") {
$categorypdf = "*";
} else {
$categorypdf = PropertyCategory::where('id', $category)->pluck('id');
}
Session::put('deptpdf', $deptpdf);
Session::put('categorypdf', $categorypdf);
$matchThese = array();
if ($dept != "*") {
//If true insert this to variable
$matchThese = array_add($matchThese, 'dept_id', $dept);
/***********Add Array*****************/
//If user chooses from dropdown
if ($category != "*") {
//If true insert this to variable
$matchThese = array_add($matchThese, 'cat_id', $category);
$query = PropertiesUser::where($matchThese)->get();
} else {
//All Categoryy
$query = PropertiesUser::where($matchThese)->get();
}
/***********End Add Array*****************/
} else {
//All Department
/*************Add Array***************/
if ($category != "*") {
//If true insert this to variable
$matchThese = array_add($matchThese, 'cat_id', $category);
$query = PropertiesUser::where($matchThese)->get();
} else {
$query = PropertiesUser::all();
}
/************End Add Array****************/
}
//end of first if statement
$audit = AuditTrail::create(['user_id' => Auth::id(), 'role' => 'Property Management Admin', 'action' => 'filtered the property reports.']);
return View::make('prop.prop-reports')->with('query', $query)->with('filter', $filter);
}
示例11: get_departments_ajax
public function get_departments_ajax()
{
$store_id = Input::get('store_id');
$departments = Department::where('store_id', $store_id)->get();
$first_department = 0;
foreach ($departments as $department) {
$first_department = $department->id;
break;
}
$departments_data = array();
foreach ($departments as $department) {
$data = array();
$data['id'] = $department->id;
$data['name'] = $department->name;
$data['shelves'] = Shelf::where('department_id', $department->id)->get()->toArray();
array_push($departments_data, $data);
}
$response_code = 200;
$response = Response::json($departments_data, $response_code);
return $response;
}
示例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: 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');
}
示例14: online
public function online()
{
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();
$user_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
} else {
$group = Groups::where("name", "operator")->first();
$user_ids = UsersGroups::where("group_id", $group->id)->lists("user_id");
}
if (sizeof($user_ids) > 0) {
$this->data["operators"] = User::whereIn("id", $user_ids)->where("is_online", 1)->get();
} else {
$this->data["operators"] = [];
}
foreach ($this->data["operators"] as $operator) {
$department_id = OperatorsDepartment::where('user_id', $operator->id)->pluck("department_id");
$department = Department::find($department_id);
$company = Company::find($department->company_id);
$operator->department = $department;
$operator->company = $company;
}
$this->data['permissions'] = Permissions::all();
$this->data['departments'] = Department::all();
return View::make('operators.all', $this->data);
}
示例15: getDepartmentCodeById
public function getDepartmentCodeById($depid)
{
$rs = Department::where('department_id', '=', $depid)->get()->toArray();
$code = $rs[0]['department_code'];
return $code;
}