ajax()) { $clients = Client::select('clients.*', DB::raw("CONCAT(client_contacts.first_name,' ',client_contacts.last_name) as full_name"), 'client_contacts.email') ->leftJoin('client_contacts', function($leftJoin) { $leftJoin->on('clients.id', '=', 'client_contacts.client_id') ->where('client_contacts.is_primary', '=', true); }); return DataTables::of($clients->get()) ->addColumn('action', function ($client) { return ' Edit'; }) ->addColumn('checkbox', function ($client){ return ''; }) ->rawColumns(['checkbox', 'action']) ->make(true); } $builder->addAction(); $builder->addCheckbox(); $html = $builder->columns([ ['data' => 'checkbox', 'name' => 'checkbox', 'title' => '', 'searchable' => false, 'orderable' => false], ['data' => 'name', 'name' => 'name', 'title' => trans('texts.name'), 'visible'=> true], ['data' => 'full_name', 'name' => 'full_name', 'title' => trans('texts.contact'), 'visible'=> true], ['data' => 'email', 'name' => 'email', 'title' => trans('texts.email'), 'visible'=> true], ['data' => 'created_at', 'name' => 'created_at', 'title' => trans('texts.date_created'), 'visible'=> true], ['data' => 'last_login', 'name' => 'last_login', 'title' => trans('texts.last_login'), 'visible'=> true], ['data' => 'balance', 'name' => 'balance', 'title' => trans('texts.balance'), 'visible'=> true], ['data' => 'action', 'name' => 'action', 'title' => '', 'searchable' => false, 'orderable' => false], ]); return view('client.list', compact('html')); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { // } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { // } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // } }