<?php

use App\Http\Controllers\Webprofile\Backend\CategoryController;

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|laman'], function () {
        Route::group(['namespace' => 'Webprofile\Backend', 'prefix' => 'webprofile'], function () {
            Route::get('category/{id}/editperbahasa', 'CategoryController@editperbahasa');
            Route::resource('category', 'CategoryController');
            Route::get('posts/{id}/editperbahasa', 'PostController@editperbahasa');
            Route::resource('posts', 'PostController');
            Route::get('pages/{id}/editperbahasa','PageController@editperbahasa');
            Route::resource('pages', 'PageController');
            Route::get('agendas/{id}/editperbahasa', 'AgendaController@editperbahasa');
            Route::resource('agendas', 'AgendaController');
            Route::get('informations/{id}/editperbahasa', 'InformationController@editperbahasa');
            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');
        });
    });
});
