<?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('/', function () {
    return view('welcome');
});
// Route::get('display', 'displayController@index');


// Route::get('admin/category', 'admin\categoryController@index');
// Route::get('admin/category/create', 'admin\categoryController@create');
// Route::get('admin/category/{id}/edit', 'admin\categoryController@edit');

// Route::get('admin/book', 'admin\bookController@index');
// Route::get('admin/book/create', 'admin\bookController@create');
// Route::get('admin/book/{id}/edit', 'admin\bookController@edit');

// Route::get('admin/media', 'admin\mediaController@index');
// Route::get('admin/media/create', 'admin\mediaController@create');
// Route::get('admin/media/{id}/edit', 'admin\mediaController@edit');

// Route::get('admin/team', 'admin\teamController@index');
// Route::get('admin/team/create', 'admin\teamController@create');
// Route::get('admin/team/{id}/edit', 'admin\teamController@edit');

// Route::get('admin/author', 'admin\authorController@index');
// Route::get('admin/author/create', 'admin\authorController@create');
// Route::get('admin/author/{id}/edit', 'admin\authorController@edit');


Route::group(['prefix' => 'admin', 'namespace' => 'Admin'],  function(){

Route::get('category/delete', 'categoryController@deleteAll')->name('category.deleteAll');
Route::get('category/statusDeactive', 'categoryController@statusDeactive')->name('category.statusDeactive');
Route::get('category/statusActive', 'categoryController@statusActive')->name('category.statusActive');
Route::put('category/{category}/status', 'categoryController@status');
Route::resource('category', 'categoryController');

Route::get('book/delete', 'bookController@deleteAll')->name('book.deleteAll');
Route::get('book/statusDeactive', 'bookController@statusDeactive')->name('book.statusDeactive');
Route::get('book/statusActive', 'bookController@statusActive')->name('book.statusActive');
Route::put('book/{book}/status', 'bookController@status');
Route::resource('book', 'bookController');

Route::get('author/delete', 'authorController@deleteAll')->name('author.deleteAll');
Route::get('author/statusDeactive', 'authorController@statusDeactive')->name('author.statusDeactive');
Route::get('author/statusActive', 'authorController@statusActive')->name('author.statusActive');
Route::put('author/{author}/status', 'authorController@status');
Route::resource('author', 'authorController');

Route::get('media/delete', 'mediaController@deleteAll')->name('media.deleteAll');
Route::get('media/statusDeactive', 'mediaController@statusDeactive')->name('media.statusDeactive');
Route::get('media/statusActive', 'mediaController@statusActive')->name('media.statusActive');
Route::put('media/{media}/status', 'mediaController@status');
Route::resource('media', 'mediaController');

Route::get('team/delete', 'teamController@deleteAll')->name('team.deleteAll');
Route::get('team/statusDeactive', 'teamController@statusDeactive')->name('team.statusDeactive');
Route::get('team/statusActive', 'teamController@statusActive')->name('team.statusActive');
Route::put('team/{team}/status', 'teamController@status');
Route::resource('team', 'teamController');

});

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
Route::get('/logout', 'Auth\LoginController@userLogout')->name('user.logout');

Route::prefix('admin')->group(function() {
    Route::get('register', 'Auth\AdminRegisterController@showRegistrationForm')->name('admin.register');
    Route::post('register', 'Auth\AdminRegisterController@register')->name('admin.register.submit');
    Route::get('login', 'Auth\AdminLoginController@showLoginForm')->name('admin.login');
    Route::post('login', 'Auth\AdminLoginController@login')->name('admin.login.submit');
    Route::get('logout', 'Auth\AdminLoginController@logout')->name('admin.logout');
    Route::get('/', 'AdminController@index')->name('admin.dashboard');
});

// Route::get('admin/category', 'Admin\categoryController@index')->name('category.index');
