예제 #1
0
 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
0
 /**
  * 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
0
 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
0
 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');
 }