public function getMethod(Request $request, Builder $htmlBuilder) { if ($request->ajax()) { return Datatables::of(User::select(['id', 'name', 'email', 'created_at', 'updated_at']))->make(true); } $html = $htmlBuilder->addColumn(['data' => 'id', 'name' => 'id', 'title' => 'Id'])->addColumn(['data' => 'name', 'name' => 'name', 'title' => 'Name'])->addColumn(['data' => 'email', 'name' => 'email', 'title' => 'Email'])->addColumn(['data' => 'created_at', 'name' => 'created_at', 'title' => 'Created At'])->addColumn(['data' => 'updated_at', 'name' => 'updated_at', 'title' => 'Updated At']); return view('datatables.html.method', compact('html')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { if ($request->ajax()) { return Datatables::of(User::select(['id', 'first_name', 'last_name', 'email', 'created_at', 'updated_at']))->addColumn('action', function ($user) { $url = URL::route('administration.users.edit', $user->id); return '<button class="btn btn-xs btn-info" onclick="getData(' . $user->id . ')">Edit</button>'; })->make(true); } // Build your DataTable Html $html = $this->htmlBuilder->addColumn(['data' => 'id', 'name' => 'id', 'title' => 'Id'])->addColumn(['data' => 'first_name', 'name' => 'first_name', 'title' => 'First Name'])->addColumn(['data' => 'last_name', 'name' => 'last_name', 'title' => 'Last Name'])->addColumn(['data' => 'email', 'name' => 'email', 'title' => 'Email'])->addColumn(['data' => 'created_at', 'name' => 'created_at', 'title' => 'Created At'])->addColumn(['data' => 'updated_at', 'name' => 'updated_at', 'title' => 'Updated At'])->addColumn(['data' => 'action', 'name' => 'action', 'title' => 'Action', 'orderable' => false, 'searchable' => false]); return view('Administration.Views.users.lists', ['form' => \View::make('Administration.Views.forms.userForm', ['route' => ['route' => ['administration.users.store'], 'files' => true]])], compact('html')); }
/** * @param Request $request * @return $this */ public function index(Request $request) { if ($request->ajax()) { return Datatables::of(Role::select(['id', 'name', 'display_name', 'description']))->addColumn('actions', function ($role) { return $this->getButtons($role); })->make(true); } $html = $this->htmlBuilder->addColumn(['data' => 'id', 'name' => 'id', 'title' => 'Id'])->addColumn(['data' => 'display_name', 'name' => 'display_name', 'title' => 'Nombre'])->addColumn(['data' => 'description', 'name' => 'description', 'title' => 'Descripción'])->addColumn(['data' => 'actions', 'name' => 'actions', 'title' => '', 'orderable' => false]); return view('users::roles.index')->with('html', $html); }
public function home(Request $request) { if ($request->ajax()) { $customers = Customer::select('*'); return Datatables::of($customers)->editColumn('name', '<a href="/customer/{{$id}}/show">{{ $name }}</a>')->editColumn('business', function ($customer) { return $customer->getLabelForBusiness(); })->editColumn('reputation', function ($customer) { return $customer->getLabelForReputation(); })->setRowId('id')->make(true); } $html = $this->htmlBuilder->addColumn(['data' => 'id', 'name' => 'id', 'title' => '#'])->addColumn(['data' => 'customer_id', 'name' => 'customer_id', 'title' => 'Kundnr'])->addColumn(['data' => 'name', 'name' => 'name', 'title' => 'Namn'])->addColumn(['data' => 'telephone_number', 'name' => 'telephone_number', 'title' => 'Telefonnr'])->addColumn(['data' => 'business', 'name' => 'business', 'title' => 'Typ'])->addColumn(['data' => 'reputation', 'name' => 'reputation', 'title' => 'Omdöme']); return view('customer.customer', compact('html')); }
/** * Строит таблицу. * * @return void */ private function build() { foreach ($this->getTableColumns() as $column) { $this->html->addColumn($column); } $this->setBuilt(); }
public function archive(Request $request) { if ($request->ajax()) { $orders = Order::select('*')->whereStatus("3")->with("customer")->get(); return Datatables::of($orders)->editColumn('order_id', function ($order) { return '<a href="/order/' . $order->id . '/show">' . $order->order_id . '</a>'; })->editColumn('name', function ($order) { return '<a href="/customer/' . $order->customer->id . '/show">' . $order->customer->name . '</a>'; })->editColumn('started_at', function ($order) { return $order->startedAt(); })->editColumn('finished_at', function ($order) { return $order->finishedAt(); })->make(true); } $html = $this->htmlBuilder->addColumn(['data' => 'order_id', 'name' => 'order_id', 'title' => 'Ordernr'])->addColumn(['data' => 'name', 'name' => 'name', 'title' => 'Kund'])->addColumn(['data' => 'started_at', 'name' => 'started_at', 'title' => 'Påbörjad'])->addColumn(['data' => 'finished_at', 'name' => 'finished_at', 'title' => 'Avslutad']); return view('archive.archive', compact('html')); }
/** * Lists the flows for the module * @param Request $request * @return \BladeView|bool|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) { if ($request->ajax()) { return Datatables::of(Flow::select(['id', 'name', 'description', 'active'])->where('module', 'tasks'))->addColumn('actions', function ($flow) { return $this->getButtons($flow); })->addColumn('activePresented', function ($flow) { return $flow->activePresented; })->make(true); } $html = $this->htmlBuilder->addColumn(['data' => 'id', 'name' => 'id', 'title' => 'Id'])->addColumn(['data' => 'name', 'name' => 'name', 'title' => 'Nombre'])->addColumn(['data' => 'description', 'name' => 'description', 'title' => 'Descripción'])->addColumn(['data' => 'activePresented', 'name' => 'activePresented', 'title' => 'Activo'])->addColumn(['data' => 'actions', 'name' => 'actions', 'title' => '']); return view('tasks::config.index', compact('html')); }