Changeset View
Changeset View
Standalone View
Standalone View
src/app/Http/Controllers/API/V4/PackagesController.php
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | class PackagesController extends Controller | ||||
* Display a listing of packages. | * Display a listing of packages. | ||||
* | * | ||||
* @return \Illuminate\Http\JsonResponse | * @return \Illuminate\Http\JsonResponse | ||||
*/ | */ | ||||
public function index() | public function index() | ||||
{ | { | ||||
// TODO: Packages should have an 'active' flag too, I guess | // TODO: Packages should have an 'active' flag too, I guess | ||||
$response = []; | $response = []; | ||||
$packages = Package::select()->orderBy('title')->get(); | $packages = Package::withEnvTenantContext()->select()->orderBy('title')->get(); | ||||
foreach ($packages as $package) { | foreach ($packages as $package) { | ||||
$response[] = [ | $response[] = [ | ||||
'id' => $package->id, | 'id' => $package->id, | ||||
'title' => $package->title, | 'title' => $package->title, | ||||
'name' => $package->name, | 'name' => $package->name, | ||||
'description' => $package->description, | 'description' => $package->description, | ||||
'cost' => $package->cost(), | 'cost' => $package->cost(), | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |