word-salad/routes/web.php

29 lines
837 B
PHP
Raw Normal View History

2024-02-04 23:36:46 +00:00
<?php
use App\Models\Article;
2024-02-04 23:36:46 +00: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 and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/', function () {
return view('home');
2024-02-04 23:36:46 +00:00
});
Route::get('/test-insert', function () {
return view('test-insert');
})->name('test-insert');
Route::get('/recent-articles', function () {
$all_articles = Article::where('published_at', '<', now())->limit(10)->get();
return view('all-articles', ['all_articles' => $all_articles]);
})->name('recent-articles');