本文整理汇总了PHP中app\models\Company::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::all方法的具体用法?PHP Company::all怎么用?PHP Company::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Company
的用法示例。
在下文中一共展示了Company::all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
if (Session::get('level') == '1' && Session::get('fingerprint') == md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR'])) {
$data = Company::all();
return View::make('company.index', array('data' => $data));
} else {
return Redirect::to('/');
}
}
示例2: create
public function create($id, $tech_number = 1)
{
if (Auth::user()->can('create-service')) {
$data['title'] = $tech_number == 1 ? "Create Service ~ " . $tech_number . " technician" : "Create Service ~ " . $tech_number . " technicians";
$data['companies'] = Company::all();
$data['company_id'] = $id;
$data['contacts'] = CompanyPersonController::API()->all(["where" => ["company_person.company_id|=|" . $id], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]);
$data['technicians'] = CompanyPersonController::API()->all(["where" => ["company_person.company_id|=|" . ELETTRIC80_COMPANY_ID], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]);
$data['divisions'] = Division::orderBy("name")->get();
$data['hotels'] = Hotel::where('company_id', $id)->orderBy("name")->get();
$tech_number = $tech_number < 1 ? 1 : $tech_number;
$tech_number = $tech_number > 5 ? 5 : $tech_number;
$data['technician_number'] = $tech_number;
foreach ($data['hotels'] as &$hotel) {
$hotel['name_address'] = $hotel['name'] . " @ " . $hotel['address'];
}
return view('services/create', $data);
} else {
return redirect()->back()->withErrors(['Access denied to service create page']);
}
}
示例3: EditView
public function EditView($id)
{
if (!is_null($id)) {
if (Auth::check()) {
if (in_array('ADD_EDIT_USER', $this->permission)) {
$user_obj = User::with('getCompany')->find($id);
if (User::isSuperAdmin()) {
$company_obj = Company::all();
$role_obj = Role::get();
} else {
$company_obj = User::with('getCompany')->find(Auth::user()->id);
$role_obj = Role::where('id', '>', 1)->get();
}
return view('user.edit')->with('user_obj', $user_obj)->with('company_obj', $company_obj)->with('role_obj', $role_obj);
}
return \Redirect::back()->withErrors(['success' => false, 'msg' => 'You don\'t have permission']);
}
return Redirect::to(url('user/login'));
}
return \Redirect::back()->withErrors(['success' => false, 'msg' => 'somethings went wrongs']);
}
示例4: getIndex
/**
* Returns view to display listing of companies.
*
* @author [Abdullah Alansari] [<ahimta@gmail.com>]
* @since [v1.8]
* @return View
*/
public function getIndex()
{
return View::make('companies/index')->with('companies', Company::all());
}