本文整理汇总了PHP中Company::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::all方法的具体用法?PHP Company::all怎么用?PHP Company::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public static function index()
{
return function ($request, $response) {
$models = Company::all();
$response->json($models->as_array());
};
}
示例2: getMyprofile
public function getMyprofile()
{
$id = Auth::user()->id;
$alumni_id = null;
$sql = "SELECT * FROM alumni WHERE account_id = ?";
$prof = DB::select($sql, array($id));
if ($prof != null) {
$alumni_id = $prof[0]->id;
}
$sql2 = "SELECT * FROM degree WHERE alumni_id = ?";
$deg = DB::select($sql2, array($alumni_id));
$sql3 = "SELECT * FROM work_experience WHERE alumni_id = ?";
$wrk_exp = DB::select($sql3, array($alumni_id));
$sql4 = "SELECT * FROM certificate WHERE alumni_id = ?";
$certificate = DB::select($sql4, array($alumni_id));
// $sql5 = "SELECT * FROM alumni_tracer WHERE alumni_id = ?";
$sql5 = "SELECT at.*, sq.question, sc.choice\n\t\t\t\tFROM alumni_tracer AS at\n\t\t\t\tINNER JOIN survey_questions AS sq\n\t\t\t\tON sq.id = at.question_id\n\t\t\t\tINNER JOIN survey_choices AS sc\n\t\t\t\tON sc.id = at.choice_id\n\t\t\t\tWHERE at.alumni_id = ?\n\t\t\t\tORDER BY at.question_id";
$a_tracer = DB::select($sql5, array($alumni_id));
$dept = Department::all();
$region = Region::all();
$province = Province::all();
$occupation = Occupation::all();
$company = Company::all();
$deg_title = DegreeTitle::all();
$school = School::all();
$jobs = Job::all();
$field = Field::all();
$questions = DB::select("SELECT * FROM survey_questions");
$civil_status = DB::select("SELECT * FROM civil_status");
return View::make('user.profile')->with('company', $company)->with('field', $field)->with('occupation', $occupation)->with('work_exp', $wrk_exp)->with('degree', $deg)->with('a_tracer', $a_tracer)->with('certificate', $certificate)->with('school', $school)->with('deg_title', $deg_title)->with('profile', $prof)->with('dept', $dept)->with('region', $region)->with('province', $province)->with('civil_status', $civil_status)->with('questions', $questions)->with('jobs', $jobs);
}
示例3: 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();
} elseif (\KodeInfo\Utilities\Utils::isCustomer(Auth::user()->id)) {
$company_customer = CompanyCustomers::where('customer_id', Auth::user()->id)->first();
$this->data['company'] = Company::where('id', $company_customer->company_id)->first();
$this->data["operator"] = User::where('id', Auth::user()->id)->first();
$this->data['departments'] = Department::where('company_id', $company_customer->company_id)->get();
} else {
$companies = Company::all();
if (sizeof($companies) > 0) {
$departments = Department::where('company_id', $companies[0]->id)->get();
} else {
$departments = [];
}
$this->data['companies'] = $companies;
$this->data['departments'] = $departments;
}
return View::make('tickets.create', $this->data);
}
示例4: apiAll
public static function apiAll()
{
if (!Auth::user()->isAdmin()) {
return [Company::find(Auth::user()["company_id"])];
} else {
return Company::all();
}
}
示例5: testOptionsForAllCompanies
public function testOptionsForAllCompanies()
{
$options = array('count' => 1);
self::createTestCompany();
self::createTestCompany();
$companies = Company::all($options);
$this->assertSame(1, count($companies));
}
示例6: company
public function company()
{
$ids = DB::table('tblCustCompany')->select('strCustCompanyID')->orderBy('created_at', 'desc')->orderBy('strCustCompanyID', 'desc')->take(1)->get();
$ID = $ids["0"]->strCustCompanyID;
$newID = $this->smartCounter($ID);
$company = Company::all();
$reason = ReasonCompany::all();
$company = DB::table('tblCustCompany')->leftJoin('tblReasonCompany', 'tblCustCompany.strCustCompanyID', '=', 'tblReasonCompany.strInactiveCompanyID')->select('tblCustCompany.*', 'tblReasonCompany.strInactiveCompanyID', 'tblReasonCompany.strInactiveReason')->orderBy('created_at')->get();
return View::make('customerCompany')->with('company', $company)->with('reason', $reason)->with('newID', $newID);
}
示例7: edit
public function edit($id)
{
try {
$this->data["user"] = User::findOrFail($id);
$company_id = CompanyCustomers::where("customer_id", $this->data["user"]->id)->pluck('company_id');
$this->data["user"]->company = Company::find($company_id);
$this->data["countries"] = DB::table("countries")->remember(60)->get();
$this->data["companies"] = Company::all();
$this->data['timezones'] = Config::get("timezones");
return View::make('customers.edit', $this->data);
} catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
Session::flash("error_msg", trans('msgs.customer_not_found'));
return Redirect::to("/customers/all");
}
}
示例8: edit
public function edit($id)
{
$companies = Company::all();
$this->data['operator'] = User::find($id);
$department_id = OperatorsDepartment::where('user_id', $this->data["operator"]->id)->pluck("department_id");
$department = Department::find($department_id);
$this->data['company_id'] = $department->company_id;
$this->data['department_id'] = $department->id;
$permissions_keys = explode(",", $department->permissions);
$permissions = Permissions::whereIn('key', $permissions_keys)->get();
$this->data['permissions'] = $permissions;
$this->data['operator_permissions'] = explode(",", $this->data['operator']->permissions);
$this->data['departments'] = Department::where("company_id", $department->company_id)->get();
$this->data['companies'] = $companies;
$this->data["countries"] = DB::table("countries")->remember(60)->get();
$this->data['timezones'] = Config::get("timezones");
return View::make('operators.edit', $this->data);
}
示例9: edit
public function edit($department_admin_id)
{
$companies = Company::all();
$user = User::find($department_admin_id);
if (sizeof(DepartmentAdmins::where('user_id', $user->id)->get()) > 0) {
$department_id = DepartmentAdmins::where('user_id', $user->id)->pluck("department_id");
} else {
$department_id = 0;
}
$this->data['department_id'] = $department_id;
$this->data['company_id'] = CompanyDepartmentAdmins::where("user_id", $department_admin_id)->pluck("company_id");
$this->data['departments'] = Department::where("company_id", $this->data['company_id'])->get();
$this->data['user'] = $user;
$this->data['user']->company = Company::find($this->data['company_id']);
$this->data['companies'] = $companies;
$this->data["countries"] = DB::table("countries")->remember(60)->get();
$this->data['timezones'] = Config::get("timezones");
return View::make('department_admins.edit', $this->data);
}
示例10: md5
$user->position = $posty['position'];
if (isset($posty['update_pass']) && $posty['update_pass'] != '0') {
$user->encrypted_password = md5($posty['update_pass']);
}
$user->save();
$app->response->setStatus(200);
} else {
$app->response->setStatus(401);
}
});
$app->get('/company', function () use($app) {
//Users are allowed to see companies they belong to.
//Super-Admins see everything.
$all_roles = get_company_membership();
$role_super = $app->jwt->role_super;
$companies = \Company::all();
//index by company ID
if (sizeof($companies) > 0) {
foreach ($companies as $company) {
if ($role_super == 1 || in_array($company->id, $all_roles)) {
$indexed_companies[$company->id] = $company;
}
}
}
$app->response->setStatus(200);
echo json_encode($indexed_companies);
});
$app->post('/company', function () use($app) {
//must be admin or superadmin
$posty = $app->request->post();
$is_admin = in_array($posty['id'], $app->jwt->role_admin);
示例11: postData
/**
* [postData - handle posted data]
* @return [json] [DT compatible object]
*/
public function postData()
{
$Model = $this->modelName;
// Build our Editor instance and process the data coming from _POST
global $db;
$data = Editor::inst($db, 'projects')->fields(Field::inst('projects.id'), Field::inst('projects.company_id'), Field::inst('companies.bedrijfsnaam'), Field::inst('projects.name'), Field::inst('projects.description'), Field::inst('projects.comment'), Field::inst('projects.status'), Field::inst('projects.jira_id'))->leftJoin('companies', 'companies.id', '=', 'projects.company_id')->process($_POST)->data();
$data['companies'] = Company::all(['id AS value', 'bedrijfsnaam AS label']);
return Response::json($data);
}
示例12: all
public function all()
{
$this->data['companies'] = Company::all();
$this->data['permissions'] = Permissions::all();
return View::make('companies.all', $this->data);
}
示例13: transfer
public function transfer($onlineusers_id)
{
$online_users = OnlineUsers::find($onlineusers_id);
$companies = Company::all();
$this->data['operators'] = [];
if (sizeof($companies) > 0) {
$departments = Department::where('company_id', $online_users->company_id)->get();
$department_ids = Department::where('company_id', $online_users->company_id)->lists('id');
if (sizeof($department_ids) > 0) {
$operator_ids = OperatorsDepartment::whereIn('department_id', $department_ids)->lists('user_id');
if (sizeof($operator_ids) > 0) {
$this->data['operators'] = User::whereIn('id', $operator_ids)->get();
}
}
} else {
$departments = [];
}
$this->data['companies'] = $companies;
$this->data['departments'] = $departments;
$this->data['online_users'] = $online_users;
$this->data['company_id'] = $online_users->company_id;
$this->data['department_id'] = $online_users->department_id;
$this->data['customer'] = User::find($online_users->user_id);
return View::make('conversations.transfer', $this->data);
}
示例14: postData
/**
* [postData - handle posted data]
* @return [json] [DT compatible object]
*/
public function postData()
{
$Model = $this->modelName;
//error_log(json_encode($_POST));
// Build our Editor instance and process the data coming from _POST
global $db;
$data = Editor::inst($db, 'worklogs')->fields(Field::inst('worklogs.id'), Field::inst('worklogs.date'), Field::inst('worklogs.company_id'), Field::inst('companies.bedrijfsnaam'), Field::inst('worklogs.project_id'), Field::inst('projects.name'), Field::inst('worklogs.strippenkaarten_id'), Field::inst('worklogs.user_id'), Field::inst('users.username'), Field::inst('worklogs.minutes')->validator('Validate::notEmpty'), Field::inst('worklogs.description'), Field::inst('worklogs.comment'), Field::inst('worklogs.billable')->validator('Validate::boolean'), Field::inst('worklogs.processed')->validator('Validate::boolean'))->leftJoin('users', 'users.id', '=', 'worklogs.user_id')->leftJoin('companies', 'companies.id', '=', 'worklogs.company_id')->leftJoin('projects', 'projects.id', '=', 'worklogs.project_id')->leftJoin('strippenkaarten', 'strippenkaarten.id', '=', 'worklogs.strippenkaarten_id')->process($_POST)->data();
$data['companies'] = Company::all(['id AS value', 'bedrijfsnaam AS label']);
$data['projects'] = Project::all(['id AS value', 'name AS label']);
$data['users'] = User::all(['id AS value', 'username AS label']);
$data['strippenkaarten'] = Strippenkaart::where('expiry_date', '=', null)->get(['id AS value', 'hours AS label']);
return Response::json($data);
}
示例15: index
function index()
{
if (\KodeInfo\Utilities\Utils::isCustomer(Auth::user()->id)) {
return Redirect::to('/tickets/customer/all');
}
$past_hr = \Carbon\Carbon::now()->subHour();
$today = \Carbon\Carbon::now()->subDay();
$this_week = \Carbon\Carbon::now()->subWeek();
$this_month = \Carbon\Carbon::now()->subMonth();
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();
$this->data['tickets_past_hr'] = DB::table('tickets')->where('requested_on', '>', $past_hr)->where('company_id', $company->id)->where('department_id', $department->id)->count();
$this->data['tickets_today'] = DB::table('tickets')->where('requested_on', '>', $today)->where('company_id', $company->id)->where('department_id', $department->id)->count();
$this->data['tickets_this_week'] = DB::table('tickets')->where('requested_on', '>', $this_week)->where('company_id', $company->id)->where('department_id', $department->id)->count();
$this->data['tickets_this_month'] = DB::table('tickets')->where('requested_on', '>', $this_month)->where('company_id', $company->id)->where('department_id', $department->id)->count();
$this->data['tickets_total'] = sizeof(DB::table('tickets')->get());
$department->all_tickets = sizeof(DB::table('tickets')->where('department_id', $department->id)->get());
$department->pending_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_PENDING)->where('department_id', $department->id)->get());
$department->resolved_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_RESOLVED)->where('department_id', $department->id)->get());
$operator_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
if (sizeof($operator_ids) > 0) {
$department->operators_online = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 1)->get());
$department->operators_offline = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 0)->get());
} else {
$department->operators_online = 0;
$department->operators_offline = 0;
}
$this->data['department_stats'] = $department;
} elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
$department_operator = OperatorsDepartment::where('user_id', Auth::user()->id)->first();
$department = Department::where('id', $department_operator->department_id)->first();
$company = Company::where('id', $department->company_id)->first();
$this->data['tickets_past_hr'] = DB::table('tickets')->where('requested_on', '>', $past_hr)->where('company_id', $company->id)->where('department_id', $department->id)->count();
$this->data['tickets_today'] = DB::table('tickets')->where('requested_on', '>', $today)->where('company_id', $company->id)->where('department_id', $department->id)->count();
$this->data['tickets_this_week'] = DB::table('tickets')->where('requested_on', '>', $this_week)->where('company_id', $company->id)->where('department_id', $department->id)->count();
$this->data['tickets_this_month'] = DB::table('tickets')->where('requested_on', '>', $this_month)->where('company_id', $company->id)->where('department_id', $department->id)->count();
$this->data['tickets_total'] = sizeof(DB::table('tickets')->get());
$department->all_tickets = sizeof(DB::table('tickets')->where('department_id', $department->id)->get());
$department->pending_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_PENDING)->where('department_id', $department->id)->get());
$department->resolved_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_RESOLVED)->where('department_id', $department->id)->get());
$operator_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
if (sizeof($operator_ids) > 0) {
$department->operators_online = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 1)->get());
$department->operators_offline = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 0)->get());
} else {
$department->operators_online = 0;
$department->operators_offline = 0;
}
$this->data['department_stats'] = $department;
} else {
$this->data['tickets_past_hr'] = DB::table('tickets')->where('requested_on', '>', $past_hr)->count();
$this->data['tickets_today'] = DB::table('tickets')->where('requested_on', '>', $today)->count();
$this->data['tickets_this_week'] = DB::table('tickets')->where('requested_on', '>', $this_week)->count();
$this->data['tickets_this_month'] = DB::table('tickets')->where('requested_on', '>', $this_month)->count();
$this->data['tickets_total'] = sizeof(DB::table('tickets')->get());
$companies = Company::all();
foreach ($companies as $company) {
$departments = Department::where('company_id', $company->id)->get();
foreach ($departments as $department) {
$department->all_tickets = sizeof(DB::table('tickets')->where('department_id', $department->id)->get());
$department->pending_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_PENDING)->where('department_id', $department->id)->get());
$department->resolved_tickets = sizeof(DB::table('tickets')->where('status', Tickets::TICKET_RESOLVED)->where('department_id', $department->id)->get());
$operator_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
if (sizeof($operator_ids) > 0) {
$department->operators_online = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 1)->get());
$department->operators_offline = sizeof(User::whereIn('id', $operator_ids)->where("is_online", 0)->get());
} else {
$department->operators_online = 0;
$department->operators_offline = 0;
}
}
$company->departments = $departments;
}
$this->data['department_stats'] = $companies;
}
return View::make('index', $this->data);
}