コード例 #1
0
ファイル: routes.php プロジェクト: alkzzz/tiunlam-laravel5
<?php

use contoh\Profil;
use contoh\About;
use contoh\KategoriArtikel;
#ViewShare
if (Schema::hasTable('profil') and Schema::hasTable('about') and Schema::hasTable('kategori_artikel')) {
    View::share('daftarprofil', Profil::oldest()->get());
    View::share('aboutlist', About::oldest()->get());
    View::share('kategori_artikel', KategoriArtikel::oldest()->get());
}
$bahasa = Request::segment(1);
if (in_array($bahasa, Config::get('app.bahasa'))) {
    App::setLocale($bahasa);
} else {
    $bahasa = 'id';
}
#RouteGroup MultiLanguage
Route::group(['prefix' => $bahasa], function () {
    Route::get('/', ['as' => 'home', 'uses' => 'HomepageController@index']);
    #Search
    Route::post('search', ['as' => 'search', 'uses' => 'HomepageController@search']);
    Route::get('search/{cari}', ['as' => 'searchresults', 'uses' => 'HomepageController@searchresults']);
    #AdminHome
    Route::get('home', ['as' => 'admin-homepage', 'uses' => 'AdminController@homepage']);
    #Profil
    #Showprofil - ID
    Route::get('profil/{slug}', ['as' => 'showprofil_id', 'uses' => 'ProfilController@showprofil_id']);
    #Showprofil - EN
    Route::get('about/{slug}', ['as' => 'showprofil_en', 'uses' => 'ProfilController@showprofil_en']);
    #Berita