本文整理汇总了PHP中Company::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::count方法的具体用法?PHP Company::count怎么用?PHP Company::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
public function getIndex()
{
$contactsWithoutCompaniesCount = Contact::withoutCompanies()->count();
$contactsByCountries = [];
$rows = Country::with('contacts')->get();
foreach ($rows as $row) {
$obj = new StdClass();
$obj->label = $row->title;
$obj->value = $row->contacts->count();
$contactsByCountries[] = $obj;
}
$contactsByCompanies = [];
$rows = Company::with('contacts')->get();
foreach ($rows as $row) {
$obj = new StdClass();
$obj->label = $row->title;
$obj->value = $row->contacts->count();
$contactsByCompanies[] = $obj;
}
$contactsCount = Contact::count();
$companiesCount = Company::count();
$countriesCount = Country::count();
$data = compact('contactsWithoutCompaniesCount', 'contactsByCompanies', 'contactsByCountries', 'contactsCount', 'companiesCount', 'countriesCount');
return View::make('admin.index', $data);
}
示例2: url
@extends('layouts.admin.default')
@section('content')
<?php
$companyCount = Company::count();
$companies = Company::paginate(10);
$companyEdit = Company::find($id);
$message = Session::get('message');
?>
<div class="page-container">
<div class="row" style="padding-bottom:20px;">
<div class="col-md-2 clearfix">
<aside class="sidebar">
<nav class="sidebar-nav">
<ul id="menu">
<li>
<a href="{{ url('/admin/dashboard') }}">
<span class="sidebar-nav-item-icon fa fa-tachometer fa-lg"></span>
<span class="sidebar-nav-item">Dashboard</span>
</a>
</li>
<li>
<a href="#">
<span class="sidebar-nav-item-icon fa fa-users fa-lg"></span>
<span class="sidebar-nav-item">Employees</span>
示例3: 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');
});
});