<?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('{slug}/{email}', 'EventPageController@action');
  $app->get('find/{slug}/', 'EventPageController@findevent');
  $app->get('search/', 'HomeController@checkUser');
  $app->get('qrscan/{slug}/{email}/{invcode}/', 'EventPageController@qrscan');

});

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

 
  $app->get('detail/{slug}', 'EventPageController@detail');

});

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

 
  $app->get('detail/{slug}', 'EventPageController@download');
  $app->get('detail/{slug}/pdf', 'EventPageController@downloadpdf');

});

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('attendancelist', 'HomeController@attendancelist')->name('guest');
    Route::get('guest/save', 'HomeController@addguest')->name('guest');
    Route::get('attendance/{id}/{eventid}', 'HomeController@attendance')->name('scanattendance');
    Route::get('goodies/{id}/{eventid}', 'HomeController@goodies')->name('scangoodies');
    Route::get('registration/{id}/{eventid}', 'HomeController@registration')->name('scanregistration');
    Route::get('eventattendance/{id}/{eventid}', 'HomeController@eventattendance')->name('scaneventattendance');
    Route::get('lunch/{id}/{eventid}', 'HomeController@lunch')->name('scanlunch');

    });