<?php

Route::group(['middleware' => 'auth'], function () {
    Route::group(['middleware' => 'role:admin'], function () {
        Route::group(['namespace' => 'Webprofile', 'prefix' => 'webprofile'], function () {
            Route::resource('user', 'UserController');

            Route::patch('users_status/{id}', 'UserController@status')->name('user.status');
        });

        Route::get('update', 'Webprofile\Backend\UpdateController@index')->name('update');
        Route::post('update', 'Webprofile\Backend\UpdateController@update')->name('update.now');
    });

    Route::group(['middleware' => 'role:admin|editor'], function () {
        Route::group(['namespace' => 'Webprofile\Backend', 'prefix' => 'webprofile'], function () {
            Route::resource('category', 'CategoryController');
            Route::resource('posts', 'PostController');
            Route::resource('pages', 'PageController');
            Route::resource('agendas', 'AgendaController');
            Route::resource('informations', 'InformationController');
            Route::resource('settings', 'SettingController');
            Route::resource('sliders', 'SliderController');
            Route::resource('gallery', 'GalleryController');
            Route::resource('categoriesfile', 'CategoriesFileController');
            Route::resource('file', 'FileController');
            Route::resource('layouts', 'LayoutController');
            Route::resource('autopost', 'AutopostController');

            Route::resource('menu', 'MenuController');
            Route::post('storepage', 'MenuController@storepage')->name('menu.storepage');
            Route::get('menu_up/{id}', 'MenuController@menu_up')->name('menu_up');
            Route::get('menu_down/{id}', 'MenuController@menu_down')->name('menu_down');

            Route::get('settingperson', 'PersonController@index')->name('person.index');
            Route::post('settingperson', 'PersonController@store')->name('person.store');
        });
    });
});
