MyHomeCollection/routes/web.php
2020-07-24 13:11:21 +02:00

42 lines
1.4 KiB
PHP

<?php
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', static function () {
if (Auth::guest()) {
return redirect(\route('login'));
}
return redirect(\route('home'));
});
Auth::routes();
Route::get('/home', static function () {
if (Auth::guest()) {
return redirect(\route('login'));
}
});
Route::get('/{slug}', 'PublicController@show')->name('public.view');
Route::group(['middleware' => ['auth']], static function () {
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/home/add', 'HomeController@add')->name('home.add');
Route::post('/home/add', 'HomeController@store')->name('home.store');
Route::get('/home/{id}', 'HomeController@show')->name('home.show');
Route::get('/home/update/{id}', 'HomeController@update')->name('home.update');
Route::post('/home/update/{id}', 'HomeController@storeupdate')->name('home.store.update');
Route::post('/ajax/fetch', 'HomeController@fetch')->name('ajax.fetch');
});