public function data()
    {
        $ratings = RatingTotalModel::with([
            'rateable' => function ($query) {
                $query->with(['ratings', 'ratingTotal'])->select(['id', 'title', 'slug']);
            }])->get();

        $ratings = $ratings->filter(function ($value, $key) {
            return isset($value->rateable);
        });

        $resource = (new RatingTransformer())->transformCollection($ratings);

        return DataTables::of(collect($this->serializeToArray($resource)))
            ->rawColumns(['actions'])
            ->make();
    }
public function data()
    {
        $ratings = RatingTotalModel::with([
            'rateable' => function ($query) {
                $query->with(['ratings', 'ratingTotal'])->select(['id', 'title', 'slug']);
            }])->get();

        $ratings = $ratings->filter(function ($value, $key) {
            return isset($value->rateable);
        });

        $resource = (new RatingTransformer())->transformCollection($ratings);

        return DataTables::of(collect($this->serializeToArray($resource)))
            ->rawColumns(['actions'])
            ->make();
    }
public function data ( ) { $ ratings = RatingTotalModel :: with ( [ 'rateable' => function ( $ query ) { $ query -> with ( [ 'ratings' , 'ratingTotal' ] ) -> select ( [ 'id' , 'title' , 'slug' ] ) ; } ] ) -> get ( ) ; $ ratings = $ ratings -> filter ( function ( $ value , $ key ) { return isset ( $ value -> rateable ) ; } ) ; $ resource = ( new RatingTransformer ( ) ) -> transformCollection ( $ ratings ) ; return DataTables :: of ( collect ( $ this -> serializeToArray ( $ resource ) ) ) -> rawColumns ( [ 'actions' ] ) -> make ( ) ; }
DataTables ServerSide.

@return mixed

@throws \Exception|\Throwable
DataTables ServerSide .