app/Http/Controllers/CustomerGroupController.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 (!auth()->user()->can('customer.view')) {
            abort(403, 'Unauthorized action.');
        }
        if (request()->ajax()) {
            $business_id = request()->session()->get('user.business_id');
            $customer_group = CustomerGroup::where('business_id', $business_id)
                                ->select(['name','subscription_cost','subscription_pieces','id']);
            return Datatables::of($customer_group)
                    ->addColumn(
                        'action',
                        '@can("customer.update")
                            <button data-href="{{action(\'CustomerGroupController@edit\', [$id])}}" class="btn btn-xs btn-primary edit_customer_group_button"><i class="glyphicon glyphicon-edit"></i> @lang("messages.edit")</button>
                        &nbsp;
                        @endcan
                        @can("customer.delete")
                            <button {{ $id == 1 ? "disabled" : "" }} data-href="{{action(\'CustomerGroupController@destroy\', [$id])}}" class="btn btn-xs btn-danger delete_customer_group_button"><i class="glyphicon glyphicon-trash"></i> @lang("messages.delete")</button>
                        @endcan'
                    )
                    ->removeColumn('id')
                    ->rawColumns([3])
                    ->make(false);
        }
        return view('customer_group.index');
    }
public function index ( ) { if ( ! auth ( ) -> user ( ) -> can ( 'customer.view' ) ) { abort ( 403 , 'Unauthorized action.' ) ; } if ( request ( ) -> ajax ( ) ) { $ business_id = request ( ) -> session ( ) -> get ( 'user.business_id' ) ; $ customer_group = CustomerGroup :: where ( 'business_id' , $ business_id ) -> select ( [ 'name' , 'subscription_cost' , 'subscription_pieces' , 'id' ] ) ; return Datatables :: of ( $ customer_group ) -> addColumn ( 'action' , '@can("customer.update")
                            <button data-href="{{action(\'CustomerGroupController@edit\', [$id])}}" class="btn btn-xs btn-primary edit_customer_group_button"><i class="glyphicon glyphicon-edit"></i> @lang("messages.edit")</button>
                        &nbsp;
                        @endcan

                        @can("customer.delete")
                            <button {{ $id == 1 ? "disabled" : "" }} data-href="{{action(\'CustomerGroupController@destroy\', [$id])}}" class="btn btn-xs btn-danger delete_customer_group_button"><i class="glyphicon glyphicon-trash"></i> @lang("messages.delete")</button>
                        @endcan' ) -> removeColumn ( 'id' ) -> rawColumns ( [ 3 ] ) -> make ( false ) ; } return view ( 'customer_group.index' ) ; }
Display a listing of the resource.
Display a listing of the resource .