MyHomeCollection/routes/web.php

44 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2020-07-23 12:26:10 +02:00
<?php
2020-07-24 13:11:21 +02:00
use Illuminate\Support\Facades\Auth;
2020-07-23 12:26:10 +02:00
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!
|
*/
2020-07-24 13:11:21 +02:00
Route::get('/', static function () {
if (Auth::guest()) {
return redirect(\route('login'));
2020-07-23 14:56:26 +02:00
}
2020-07-24 13:11:21 +02:00
return redirect(\route('home'));
2020-07-23 12:26:10 +02:00
});
2020-07-28 16:21:06 +02:00
Auth::routes(['register' => false]);
Route::feeds();
2020-07-24 13:11:21 +02:00
Route::get('/home', static function () {
if (Auth::guest()) {
return redirect(\route('login'));
}
});
Route::get('/list{lang}', 'PublicController@list')->name('public.list')->where('lang', '(|e)');
2020-07-24 13:11:21 +02:00
Route::get('/{slug}', 'PublicController@show')->name('public.view');
2020-07-23 12:26:10 +02:00
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');
2020-07-23 12:26:10 +02:00
Route::post('/ajax/fetch', 'HomeController@fetch')->name('ajax.fetch');
});