本文整理汇总了PHP中Datatable::shouldHandle方法的典型用法代码示例。如果您正苦于以下问题:PHP Datatable::shouldHandle方法的具体用法?PHP Datatable::shouldHandle怎么用?PHP Datatable::shouldHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datatable
的用法示例。
在下文中一共展示了Datatable::shouldHandle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: borrowList
public function borrowList()
{
if (Datatable::shouldHandle()) {
return Datatable::collection(Book::with('author')->orderBy('id', 'desc')->get())->showColumns('id', 'title', 'amount', 'stock')->addColumn('author', function ($model) {
return $model->author->name;
})->addColumn('borrow', function ($model) {
$html = '<a href="' . route('books.borrow', $model->id) . '" class="btn btnn"> <i class="mdi-action-grade"></i> </a>';
return $html;
})->searchColumns('title', 'amount', 'author')->orderColumns('title', 'amount', 'author')->make();
}
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
if (Datatable::shouldHandle()) {
$operator = Sentry::findAllUsersWithAccess('operator');
$operatorCollection = new Illuminate\Database\Eloquent\Collection($operator);
return Datatable::collection($operatorCollection)->addColumn('full_name', function ($model) {
return $model->first_name . ' ' . $model->last_name;
})->showColumns('id', 'email', 'last_login')->searchColumns('full_name', 'email', 'last_login')->orderColumns('full_name', 'email', 'last_login')->make();
}
return View::make('dashboard.admin.manageuser');
}
示例3: index
public function index()
{
$data = Author::all(['id', 'name']);
if (Datatable::shouldHandle()) {
return Datatable::collection($data)->showColumns('id', 'name')->addColumn('1', function ($model) {
$html = '<a href="' . route('admin.authors.edit', $model->id) . '" class="btn btnn"> <i class="mdi-editor-mode-edit"></i> </a>';
return $html;
})->addColumn('2', function ($model) {
$html = Form::open(['route' => ['admin.authors.destroy', $model->id], 'method' => 'delete']);
$html .= '<button class="btn btnn" type="submit"> <i class="mdi-action-delete"></i> </button>';
$html .= Form::close();
return $html;
})->searchColumns('name')->orderColumns('name')->make();
}
return View::make('authors.index')->withTitle('Penulis');
}
示例4: index
public function index()
{
if (Datatable::shouldHandle()) {
return Datatable::collection(Book::with('author')->orderBy('id', 'desc')->get())->showColumns('id', 'title', 'amount')->addColumn('author', function ($model) {
return $model->author->name;
})->addColumn('1', function ($model) {
$html = '<a href="' . route('admin.books.edit', $model->id) . '" class="btn btnn"> <i class="mdi-editor-mode-edit"></i> </a>';
return $html;
})->addColumn('2', function ($model) {
$html = Form::open(['route' => ['admin.books.destroy', $model->id], 'method' => 'delete']);
$html .= '<button class="btn btnn" type="submit"> <i class="mdi-action-delete"></i> </button>';
$html .= Form::close();
return $html;
})->searchColumns('title', 'amount', 'author')->orderColumns('title', 'amount', 'author')->make();
}
return View::make('books.index')->withTitle('Buku');
}