<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth;
use App\Models\Master;

class MasterController extends Controller
{
    //Getting all masters
	public function fetchrequired(Request $request){
        $user=Auth::user();
        $master = Master::where('rolledback',0);

        if($request['search']!=null && isset($request['search'])){
            $master = $master->where('label','LIKE', '%' . $request['search'] . '%');
        }

        // if($request['software_option']!=null && isset($request['software_option'])){
        //     $master = $master->where('software_option','LIKE', '%' . $request['software_option'] . '%');
        // }

        $master = $master->get();
        
        return response()->json(
            [
                'success' => true,
                'message' => 'Success',
                'data' => $master
            ]
        );
    }
}
