<?php

/**
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This file is part of the Core Framework package.
 *
 * (c) Shalom Sam <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Core\Facades\Router;
Router::group(['middleware' => '\\Core\\Middlewares\\csrfProtectionMiddleware'], function () {
    Router::get('/', 'siteController@indexAction', ['data' => ['pageName' => 'demo', 'title' => 'Demo Home Page', 'metas' => ['keywords' => 'test, keywords, for test', 'description' => 'This is a test description', 'author' => 'Shalom Sam']]]);
    Router::get('/about', 'siteController@aboutAction', ['data' => ['pageName' => 'demo', 'title' => 'Demo About Page']]);
    Router::post('/user/register', 'siteController@registerAction');
    Router::post('/user/login', 'siteController@loginAction');
    Router::get('/user/logout', 'siteController@logoutAction');
});
Exemple #2
0
 public function setRoutes()
 {
     Router::get('/basic/func', function () {
         return 'func';
     });
     Router::get('/basic/{id:num}', function ($payload) {
         return $payload['id'];
     });
     Router::post('/post/{id:num}', function ($payload) {
         return $payload['id'];
     });
     Router::put('/put/{id:num}', function ($payload) {
         return $payload['id'];
     });
     Router::delete('/delete/{id:num}', function ($payload) {
         return $payload['id'];
     });
     Router::get('http://somedomain.com/somePath', function () {
         return 'somedomain';
     });
     Router::get('/test/{id:default=1}', 'testController@testId');
     Router::get('/test/{fname}/{id:num:default=1}', 'testController@testName');
     //grouping
     Router::group(['prefix' => '/group'], function () {
         Router::get('/groupTest/{id:default=1}', 'testController@testId');
     });
 }