X

Create New Item

File Folder

X

Search Results

File "PlanController.php"

Full path: /home/orbitecv/orbite-school.orbit.et/app/Http/Controllers/Api/PlanController.php
File size: 731 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Edit   Back

<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Resources\PlanResource;
use App\Models\Plan;
use App\Repositories\PlanRepository;
use Illuminate\Http\Request;

class PlanController extends Controller
{
    public function index()
    {
        $plans = PlanRepository::query()->where('is_active', true)->get();

        if (is_null($plans) || $plans->isEmpty()) {
            return $this->json('banner fetch successfully', null, 200);
        }

        return $this->json('plan fetch succesfully', PlanResource::collection($plans), 200);
    }

    public function show(Plan $plan)
    {
        return $this->json('plan fetch successfully', PlanResource::make($plan), 200);
    }
}