本文整理汇总了PHP中app\models\Categories::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Categories::select方法的具体用法?PHP Categories::select怎么用?PHP Categories::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Categories
的用法示例。
在下文中一共展示了Categories::select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
public function getList(Request $request)
{
$table = Categories::select('name_category', 'picture', 'id');
$datatable = Datatables::of($table)->editColumn('picture', '<img src="{{$picture}}" heigth=64" width="64" />')->addColumn('action', function ($table) {
return '<a href="/admpanel/' . self::NAMEC . '/form/' . $table->id . '" class="btn-actions icon icon-pen"></a>
<a href="javascript:;" data-url="/admpanel/' . self::NAMEC . '/delete/' . $table->id . '" class="btn-actions icon icon-trash js-delete-confirm" data-id="' . $table->id . '" ></a>';
});
return $datatable->make(true);
}
示例2: show
function show($id)
{
try {
$category = Categories::select('pu_categories.*', DB::raw('CONCAT("' . asset('') . '", picture) AS picture'))->whereId($id)->first();
if (isset($category)) {
$this->_responseWS->setDataResponse(Response::HTTP_OK, [$category->toArray()], array(), 'ok');
} else {
$this->_responseWS->setDataResponse(Response::HTTP_OK, [], array(), '');
}
} catch (\Exception $exc) {
$this->_responseWS->setDataResponse(Response::HTTP_INTERNAL_SERVER_ERROR, array(), array(), '');
}
$this->_responseWS->response();
}
示例3: show
public function show($id)
{
$cacheTag = ['categories'];
$cacheKey = $id;
$response = Cache::tags($cacheTag)->remember($cacheKey, 60 * 24 * 7, function () use($id) {
$_model = Categories::select(['description', 'image', 'active', 'created_at', 'updated_at'])->where('company_id', config('global.companies.current.id'))->where('id', $id);
if (!config('global.managers.current.id')) {
$_db->where('active', 1);
}
if ($_model->count() > 0) {
return $_model->first()->toArray();
} else {
return false;
}
});
if (!$response) {
Cache::tags($cacheTag)->forget($cacheKey);
return new \Exception("Houve um erro ao localizar registro (id not found)");
}
return $response;
}
示例4: categories
public function categories()
{
$count = Categories::select(\DB::raw('count(id) as total'))->where('company_id', config('global.companies.current.id'))->count();
return $this->jsonResponse(['data' => $count]);
}