本文整理汇总了PHP中app\models\Company::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::getName方法的具体用法?PHP Company::getName怎么用?PHP Company::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Company
的用法示例。
在下文中一共展示了Company::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDataView
/**
* Get the asset information to present to the model view detail page
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v2.0]
* @param int $modelId
* @return String JSON
*/
public function getDataView($modelID)
{
$assets = Asset::where('model_id', '=', $modelID)->with('company');
if (Input::has('search')) {
$assets = $assets->TextSearch(e(Input::get('search')));
}
if (Input::has('offset')) {
$offset = e(Input::get('offset'));
} else {
$offset = 0;
}
if (Input::has('limit')) {
$limit = e(Input::get('limit'));
} else {
$limit = 50;
}
$allowed_columns = ['name', 'serial', 'asset_tag'];
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array(Input::get('sort'), $allowed_columns) ? e(Input::get('sort')) : 'created_at';
$assets = $assets->orderBy($sort, $order);
$assetsCount = $assets->count();
$assets = $assets->skip($offset)->take($limit)->get();
$rows = array();
foreach ($assets as $asset) {
$actions = '';
if ($asset->assetstatus) {
if ($asset->assetstatus->deployable != 0) {
if ($asset->assigned_to != '' && $asset->assigned_to > 0) {
$actions = '<a href="' . route('checkin/hardware', $asset->id) . '" class="btn btn-primary btn-sm">' . trans('general.checkin') . '</a>';
} else {
$actions = '<a href="' . route('checkout/hardware', $asset->id) . '" class="btn btn-info btn-sm">' . trans('general.checkout') . '</a>';
}
}
}
$rows[] = array('id' => $asset->id, 'name' => (string) link_to('/hardware/' . $asset->id . '/view', $asset->showAssetName()), 'asset_tag' => (string) link_to('hardware/' . $asset->id . '/view', $asset->asset_tag), 'serial' => $asset->serial, 'assigned_to' => $asset->assigned_to ? (string) link_to('/admin/users/' . $asset->assigned_to . '/view', $asset->assigneduser->fullName()) : '', 'actions' => $actions, 'companyName' => Company::getName($asset));
}
$data = array('total' => $assetsCount, 'rows' => $rows);
return $data;
}
示例2: getDataViewComponent
public function getDataViewComponent($categoryID)
{
$category = Category::with('accessories.company')->find($categoryID);
$category_assets = $category->components;
if (Input::has('search')) {
$category_assets = $category_assets->TextSearch(e(Input::get('search')));
}
if (Input::has('offset')) {
$offset = e(Input::get('offset'));
} else {
$offset = 0;
}
if (Input::has('limit')) {
$limit = e(Input::get('limit'));
} else {
$limit = 50;
}
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
$allowed_columns = ['id', 'name', 'serial', 'asset_tag'];
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
$count = $category_assets->count();
$rows = array();
foreach ($category_assets as $asset) {
$actions = '';
$inout = '';
if ($asset->deleted_at == '') {
$actions = '<div style=" white-space: nowrap;"><a href="' . route('update/component', $asset->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/component', $asset->id) . '" data-content="' . trans('admin/hardware/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($asset->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
}
$rows[] = array('id' => $asset->id, 'name' => (string) link_to_route('view/accessory', $asset->name, [$asset->id]), 'actions' => $actions, 'companyName' => Company::getName($asset));
}
$data = array('total' => $count, 'rows' => $rows);
return $data;
}
示例3: getDataView
/**
* Generates the JSON used to display the manufacturer detail.
* This JSON returns data on all of the assets with the specified
* manufacturer ID number.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ManufacturersController::getView()
* @param int $manufacturerId
* @since [v1.0]
* @return String JSON
*/
public function getDataView($manufacturerId)
{
$manufacturer = Manufacturer::with('assets.company')->find($manufacturerId);
$manufacturer_assets = $manufacturer->assets;
if (Input::has('search')) {
$manufacturer_assets = $manufacturer_assets->TextSearch(e(Input::get('search')));
}
if (Input::has('offset')) {
$offset = e(Input::get('offset'));
} else {
$offset = 0;
}
if (Input::has('limit')) {
$limit = e(Input::get('limit'));
} else {
$limit = 50;
}
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
$allowed_columns = ['id', 'name', 'serial', 'asset_tag'];
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
$count = $manufacturer_assets->count();
$rows = array();
foreach ($manufacturer_assets as $asset) {
$actions = '';
if ($asset->deleted_at == '') {
$actions = '<div style=" white-space: nowrap;"><a href="' . route('clone/hardware', $asset->id) . '" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="' . route('update/hardware', $asset->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/hardware', $asset->id) . '" data-content="' . trans('admin/hardware/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($asset->asset_tag) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
} elseif ($asset->deleted_at != '') {
$actions = '<a href="' . route('restore/hardware', $asset->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
}
if ($asset->assetstatus) {
if ($asset->assetstatus->deployable != 0) {
if ($asset->assigned_to != '' && $asset->assigned_to > 0) {
$inout = '<a href="' . route('checkin/hardware', $asset->id) . '" class="btn btn-primary btn-sm">' . trans('general.checkin') . '</a>';
} else {
$inout = '<a href="' . route('checkout/hardware', $asset->id) . '" class="btn btn-info btn-sm">' . trans('general.checkout') . '</a>';
}
}
}
$row = array('id' => $asset->id, 'name' => (string) link_to('/hardware/' . $asset->id . '/view', e($asset->showAssetName())), 'model' => e($asset->model->name), 'asset_tag' => e($asset->asset_tag), 'serial' => e($asset->serial), 'assigned_to' => $asset->assigneduser ? (string) link_to('/admin/users/' . $asset->assigneduser->id . '/view', e($asset->assigneduser->fullName())) : '', 'actions' => $actions, 'companyName' => e(Company::getName($asset)));
if (isset($inout)) {
$row['change'] = $inout;
}
$rows[] = $row;
}
$data = array('total' => $count, 'rows' => $rows);
return $data;
}