<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Resources\RequestAssignmentResouce;
use App\Models\PbgTask;
use Illuminate\Http\Request;

class RequestAssignmentController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index(Request $request)
    {
        $query = PbgTask::query()->orderBy('id', 'desc');
        if($request->has('search') && !empty($request->get("search"))){
            $query->where('name', 'LIKE', '%'.$request->get('search').'%')
            ->orWhere('registration_number', 'LIKE', '%'.$request->get('search').'%');
        }
        return RequestAssignmentResouce::collection($query->paginate());
    }

    /**
     * Store a newly created resource in storage.
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     */
    public function show(string $id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     */
    public function update(Request $request, string $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     */
    public function destroy(string $id)
    {
        //
    }
}
