<?php

namespace App\Http\Controllers\SourceTypes;

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

class SourceTypeStoresOverviewController extends Controller
{

    /**
     *
     * SourceTypeStoresOverviewController constructor.
     */
    public function __construct()
    {
        $this->middleware('auth');
    }

    /**
     *
     * @param Request $request
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index(Request $request)
    {
        $sourceTypeStores = SourceTypeStore::all();

        $alert = '';

        if (!is_null($request->del) && $request->del == 0) {
            $alert = 'errorDelete';
        } elseif ($request->del == 1) {
            $alert = 'successDelete';
        }

        return view('source-types.source-type-stores-overview', ['sourceTypeStores'=>$sourceTypeStores, 'alert'=>$alert]);
    }
}
