コード例 #1
0
Route::get('/read/{slug}', function ($slug) {
    $data = array("artikel_pilih" => App\Artikel::where('slug', '=', $slug)->get(), "artikel" => App\Artikel::all(), "kategori" => App\Kategori::where('aktif', '=', 'y')->get());
    return View('sativa.readmore')->with('data', $data);
});
/*Route::get('/tag/{kategori}', function($kategori){
	return View('sativa.read_kat')->with(['data' => App\Artikel::where('kategori','=',$kategori)->get(), 
										  'artikel' => App\Artikel::all(),
										  'kategori' => App\Kategori::where('aktif','=','y')->get()]);
});*/
Route::get('/bos', function () {
    return View('sativa.admin.index');
});
Route::get('/bos/artikel', function () {
    $data = array("artikel" => App\Artikel::all(), "kategori" => App\Kategori::all());
    return View('sativa.admin.tambah_artikel')->with('data', $data);
});
Route::get('/bos/kategori', function () {
    $data = App\Kategori::all();
    return View('sativa.admin.tambah_kategori')->with('data', $data);
});
Route::post('/bos/{jenis}', 'BlogController@store');
Route::get('/hapus/{jenis}/{id}', 'BlogController@destroy');
Route::get('/edit/{jenis}/{id}', 'BlogController@edit');
Route::post('/update/{jenis}/{id}', 'BlogController@update');
Route::get('/default', function () {
    return View('sativa.default');
});
/*Route::controller([
		'auth' => 'Auth\AuthController',
		'password' => 'Auth\PasswordController',
]);*/
コード例 #2
0
 public function run()
 {
     App\Kategori::truncate();
     factory(App\Kategori::class, 5)->create();
 }
コード例 #3
0
ファイル: routes.php プロジェクト: ranugoldan/SoWindows
<?php

$router->bind('news', function ($slug) {
    return App\News::whereSlug($slug)->firstOrFail();
});
$router->bind('cat', function ($cat) {
    $kat_id = App\Kategori::where('nama_kategori', $cat)->firstOrFail()->id;
    return $kat_id;
});
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
get('/search', ['as' => 'search', 'uses' => 'HomeController@search']);
get('/admin', ['as' => 'admin', 'uses' => 'AdminController@index']);
get('/admin/login', ['as' => 'admin_login', 'uses' => 'AdminController@login']);
get('/admin/posts', ['as' => 'admin_posts', 'uses' => 'AdminController@posts']);
get('/admin/posts/create', ['as' => 'admin_create', 'uses' => 'AdminController@create']);
get('/admin/posts/{news}/edit', ['as' => 'admin_edit', 'uses' => 'AdminController@edit']);
get('/admin/posts/{news}/delete', ['as' => 'admin_delete', 'uses' => 'AdminController@delete']);
get('/admin/posts/{news}/destroy', ['as' => 'admin_destroy', 'uses' => 'AdminController@destroy']);
post('/admin/post', ['as' => 'admin_store', 'uses' => 'AdminController@store']);
patch('/{news}', ['as' => 'admin_update', 'uses' => 'AdminController@update']);
get('/search', ['as' => 'search', 'uses' => 'HomeController@search']);
get('home', ['as' => 'home', 'uses' => 'HomeController@index']);
get('/category/{cat}', 'HomeController@category');
get('/', ['as' => 'root', 'uses' => 'HomeController@index']);
get('/{news}', ['as' => 'news_path', 'uses' => 'HomeController@show']);
post('/comment', ['as' => 'storeComment', 'uses' => 'HomeController@storeComment']);
//$router->bind('songs', function($slug)
//{
//	return App\Song::where('slug' , $slug)->first();
//});
//$router->resource('songs','SongsController');