<?php

namespace App\Http\Controllers\Shop;

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

use App\Repositories\Shop\Customers;
use Illuminate\Support\Facades\Auth;

class CustomerController extends Controller
{
    public function profile($id = false)
    {
        $data = Customers::editProfile($id);

        return view('Shop.Customers.profile', $data);
    }

    public function modalProfile($id = false)
    {
        $data['customer'] = Customers::get($id);

        return view('Shop.Customers.partials.registration', $data);
    }

    public function edit()
    {
        $id = Auth::id();
        $data['customer'] = Customers::edit($id);

        return view('Shop.Customers.edit', $data);
    }

    public function storeProfileAjax(Request $request)
    {
        $data = $request->all();
        $customer = Customers::store($data);

        return response()->json(['error' => 0]);
    }

    public function store(Request $request)
    {
        $data = $request->all();
        dump($data);
        exit;
        $customer = Customers::storeFull($data);
        
        return response()->json(['error' => 0]);
    }
}
