??????????????
<?php

namespace App\Http\Controllers;

use App;
use App\Maintexts;
use App\Saloon;
use App\Artist;
use App\Orders;
use Auth;
use Illuminate\Http\Request;

class BaseController extends Controller
{
    public function getWelcome(Request $request)
    {
        $saloons = Saloon::where('showhide', 'show')->orderBy('name')->get();
        $artists = Artist::where('showhide', 'show')->where('categories','!=', null)->orderBy('order_by')->get();
        $picture = $request->picture;
        if (isset($_GET['calc'])) {
            if ($_GET['calc'] == 'true') {
                $calc = true;
            }
        } else {
            $calc = false;
        }
        return view('welcome__3', compact('saloons', 'artists', 'picture', 'calc'));
    }

    public function getOne($id = null)
    {
        if ($id != null) {
            $url = $id;
        } else {
            $url = 'index';
        }
        $lang = App::getLocale();
        if(!$lang){
            $lang = 'fr';
        }
        $one = Maintexts::where('url', $url)->where('lang',$lang)->first();
        return view('index')->with('one', $one);
    }
    public function getGift(){
        $lang = App::getLocale();
        if(!$lang){
            $lang = 'fr';
        }
        $gift = Maintexts::where('url', 'giftcart')->where('lang',$lang)->first();
        $saloons = Saloon::where('showhide', 'show')->orderBy('name')->get();
        return view('gift', compact('gift', 'saloons'));
    }

    public function postGift(Request $request){
        $order = new Orders;
        $order->price= $request->amount;
        $order->status='pay in full';
        $order->body='gift card';
        $order->user_id = Auth::user()->id;
        $order->saloon_id = $request->saloon_id;
        $order->putdate = date("Y-m-d H:i:s");
        $order->save();
        return redirect('home');
    }

    public function getCookieclear()
    {
        return redirect('/');
    }

    public function getClose(){
        setcookie('close', 'true', time() + 3600*24*60, '/');
        return redirect()->