<?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::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('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('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');
        });
    });
});
