app/Http/Controllers/CustomerController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        if(request()->wantsJson() || request()->expectsJson()) {
            $customers = Auth::user()->customers()->get();
            return DataTables::of($customers)->addColumn('actions', function($customer){
                return implode("", [
                    '<a href="' . route('customers.show', $customer) . '" class="btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-eye"></i></a>',
                    '<a href="' . route('customers.destroy', $customer) . '" class="deleteDataTableRecord btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-trash"></i></a>',
                ]);
            })->rawColumns(['actions'])->make(true);
        }
        return view('customers.index');
    }
public function index ( ) { if ( request ( ) -> wantsJson ( ) || request ( ) -> expectsJson ( ) ) { $ customers = Auth :: user ( ) -> customers ( ) -> get ( ) ; return DataTables :: of ( $ customers ) -> addColumn ( 'actions' , function ( $ customer ) { return implode ( " " , [ '<a href="' . route ( 'customers.show' , $ customer ) . '" class="btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-eye"></i></a>' , '<a href="' . route ( 'customers.destroy' , $ customer ) . '" class="deleteDataTableRecord btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-trash"></i></a>' , ] ) ; } ) -> rawColumns ( [ 'actions' ] ) -> make ( true ) ; } return view ( 'customers.index' ) ; }
Display a listing of the resource.
Display a listing of the resource .