<?php

use Illuminate\Support\Facades\Route;
use App\Category;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/', function(){
    $categories = Category::all();
    return View::make('index')->with('categories', $categories);
});

Route::resource('users', 'UsersController');

Route::get('users-list', 'UsersController@usersList');

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');

Route::resource('leads', 'LeadsController')->middleware('can:edit-users');

Route::get('remalho', 'LeadsController@remalho')->middleware('can:edit-users')->name('leads.remalho');

Route::get('categorias', 'LeadsController@categorias')->middleware('can:edit-users')->name('leads.categorias');

Route::get('remalho-list', 'LeadsController@remalhoList');

Route::get('leads-list', 'LeadsController@leadsList');

Route::resource('myleads', 'MyLeadsController');

Route::get('myleads-list', 'MyLeadsController@myLeads');

Route::post('/designar', 'LeadsController@designar');

Route::get('/relatorios', 'LeadsController@relatorios')->name('leads.relatorios');

Route::post('/relatorio-search', 'LeadsController@search')->name('relatorio.search');

Route::post('subcategory', 'CategoryController@subCategory')->name('subcategory');


