1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 13:24:03 +00:00
laravel-tips/routes/web.php
2021-04-09 18:53:27 +02:00

37 lines
1.1 KiB
PHP

<?php
use App\Models\Thread;
use App\Models\Tip;
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::middleware('static')->group(function () {
Route::get('/', function () {
return view('tips.index', ['tips' => Tip::all()]);
})->name('tip.index');
Route::get('/threads/{thread}/{link}', function (Thread $thread, string $link) {
return redirect($thread->links[$link]['url']);
})->name('thread.link');
Route::get('/threads/{thread}', function (Thread $thread) {
return view('threads.show', [
'thread' => $thread,
'tips' => $thread->tips,
]);
})->name('thread.show');
Route::get('/{tip}', function (Tip $tip) {
return view('tips.show', compact('tip'));
})->name('tip.show');
});