Skip to content

Commit

Permalink
updated paginated data
Browse files Browse the repository at this point in the history
  • Loading branch information
kominitisystem committed Apr 29, 2024
1 parent c1e2a74 commit d367580
Show file tree
Hide file tree
Showing 2 changed files with 502 additions and 515 deletions.
10 changes: 7 additions & 3 deletions app/Http/Controllers/Api/CompanyStackController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ class CompanyStackController extends Controller

public function index(Request $req, Company $company)
{
$companies = $company::FetchAllClientDetails()->get();

//if larvel had an "orWithWhereHAs" 🙂
$companies = $company::FetchAllClientDetails();

//if laravel had an "orWithWhereHAs" 🙂

if ($companies->exists() > 0) {

$companies = $companies->paginate(20);

if ($companies->count() > 0) {
return CompanyResource::collection($companies);
} else {
return response()->json(['message' => 'No Results found'], 200);
Expand Down
Loading

0 comments on commit d367580

Please sign in to comment.