<?php
	/**
	 * Rutas para el modulo.
	 */
	
	/**
	 * Se solicita que el usuario este autenticado antes de acceder a las siguientes rutas.
	 */
	Route::group(array('prefix' => 'admin', 'namespace' => 'App\Modules\Backend\Dashboard\Controllers', 'before' => 'auth'), function()
	{
		Route::get('/', function()
		{
		    return Redirect::to('admin/dashboard');
		});


		Route::controller('dashboard', 'DashboardController');
		Route::get('admin/attachments', ['as' => 'attachments.index', 'uses' => 'DashboardController@getAttachments']);
		Route::post('admin/attachments', ['as' => 'attachments.upload', 'uses' => 'DashboardController@uploadAttachments']);
		Route::delete('admin/attachments', ['as' => 'attachments.destroy', 'uses' => 'DashboardController@destroyAttachments']);
	});


	/**
	 * Rutas para el uso de elfinder
	 */
	Route::group(array('before' => 'auth'), function()
    {
        \Route::get('elfinder', 'Barryvdh\Elfinder\ElfinderController@showIndex');
        \Route::any('elfinder/connector', 'Barryvdh\Elfinder\ElfinderController@showConnector');
        \Route::get('elfinder/tinymce', 'Barryvdh\Elfinder\ElfinderController@showTinyMCE4');
    });


	// Solo cuando es un sistema (Sin frontend)
	if(!Config::get('core.with_front_end')) {
		Route::get('/', function()
		{
		    return Redirect::to('/admin/dashboard');
		});
	}