public function getPaginateDeleted($paginateCount) { // sorting query parameter $givenSortCol = Input::get('sort'); $givenSortDesc = Input::get('desc'); $givenSortAsc = Input::get('asc'); // validate and handle sorting data $sortData = Utility::getSortData($givenSortCol, $givenSortDesc, $givenSortAsc); // Query Url in paginated manner $urls = Url::orderBy($sortData->sortCol, $sortData->sortType)->onlyTrashed()->paginate($paginateCount); // Add attribute 'time' as Human readable time( elapsed or remaining) foreach ($urls as $key => $value) { $value['time'] = $value['created_at']->diffForHumans(Carbon::now()); } // Build the response object $res = new \stdClass(); $res->count = $urls->count(); $res->status = "Success"; $res->data = $urls; // Send response Object as json string return response()->json($res, 200); }