<?php

namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Client;
use Carbon\Carbon; 
use DateTimeZone;
use Illuminate\Support\Facades\Mail;

class OpencallController extends Controller {


    public function upc(Request $request) {
        // $res = DB::select("select ku.name from discography_api_report ju JOIN users ku ON ju.uid = ku.uid where ju.upc = '". $request->input('upc') ."'");
        $upc_full = $request->input('upc'); // e.g., "5054316069362 - Avalanche , LFO Monsta"

        $upc = explode(' - ', $upc_full)[0];

        $res = DB::select("select artist_name as name from discography_api_report where upc = '". $upc ."'");
        return response()->json($res);
    }
   

}
