<?php

/*
|--------------------------------------------------------------------------
| Module Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for this module.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::group(['prefix' => Config::get('app.api_path').'/chat', 'middleware' => ['web', 'auth']], function () {
    Route::resource('messages', \App\Modules\Chat\controllers\api\v1\MessagesControllerREST::class, ['names' => [
        'index' => 'chat.messages.index',
        'create' => 'chat.messages.create',
        'store' => 'chat.messages.store',
        'show' => 'chat.messages.show',
        'edit' => 'chat.messages.edit',
        'update' => 'chat.messages.update',
        'destroy' => 'chat.messages.destroy',
    ]]);
    Route::post('channels/leave/{id}', [\App\Modules\Chat\controllers\api\v1\ChannelsControllerREST::class, 'leave']);
    Route::resource('channels', \App\Modules\Chat\controllers\api\v1\ChannelsControllerREST::class, ['names' => [
        'index' => 'chat.channels.index',
        'create' => 'chat.channels.create',
        'store' => 'chat.channels.store',
        'show' => 'chat.channels.show',
        'edit' => 'chat.channels.edit',
        'update' => 'chat.channels.update',
        'destroy' => 'chat.channels.destroy',
    ]]);
});

/*
|--------------------------------------------------------------------------
| Pages rendered on the server
|--------------------------------------------------------------------------
|
| This group routes are pages rendered on the server.
| All the pages require the user to be authentificated.
|
*/

Route::group(['middleware' => ['web', 'auth']], function () {

});
