<?php

namespace App\Http\Controllers\API\Sales\Visiting;

use App\Http\Controllers\Controller;
use App\OutletClient;
use App\VisitingOutlet;
use Illuminate\Http\Request;

class IndexController extends Controller
{
    public function createVisiting(Request $request)
    {
        $idOutlet = OutletClient::where('name', $request->name)->first()->id;

        $visiting = new VisitingOutlet();
        $visiting->outlet_id = $idOutlet;
        $visiting->date_visiting = $request->dateVisit;
        $visiting->description = $request->description;
        $visiting->save();

        return response('Data kunjungan berhasil disimpan!', 200);
    }
}
