<?php

/*
|--------------------------------------------------------------------------
| 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('/set-cookie/{name}/{value}', function() {
    $response = new Illuminate\Http\Response('try');
    $response->withCookie(cookie()->forever($name, $value)); // this will last five years

    return $response;
});

Route::get('/get-cookie', function() {
   dd(Cookie::get('invitation')); // showing you different ways to set / get the cookie
});

Route::get('/', function () {

    return view('welcome');
});

Route::group(['prefix' => 'invite/'], function ($ints){

	// $router->controller('/','ApplicationController');
	$ints->get('/accept', 'InvitationController@postAccept');

});





Route::group(
[
  'prefix' => 'event/'
],
function($app) {

	$app->get('{slug}/', 'EventPageController@index');
  $app->get('find/{slug}/', 'EventPageController@findevent');
	$app->get('detail/{slug}', 'EventPageController@detail');
  $app->get('qrscan/{slug}/{email}/{invcode}/', 'EventPageController@qrscan');

});

Route::group(
  [
    'middleware' => ['auth']
  ],
  function() {
    Route::get('home', 'HomeController@index')->name('home');
    Route::get('manage', 'HomeController@manageevent')->name('manage');
    Route::get('manage/{id}/', 'HomeController@editevent')->name('show');
    Route::get('guest', 'HomeController@manageguest')->name('guest');
    Route::get('attendance/{id}/', 'HomeController@attendance')->name('scan');

    });