Files
karudhaas/routes/web.php

51 lines
1.5 KiB
PHP

<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Article;
use App\Source;
use App\Http\Controllers\ArticlesController;
use App\Http\Controllers\TopicsController;
use App\Http\Controllers\SourcesController;
use App\Http\Controllers\MylistController;
use App\Topic;
/*
|--------------------------------------------------------------------------
| 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('/', function(){
return view('home');
});
Route::get('/article/{article:id}', [ArticlesController::class,'show'])->name('articles.show');
Route::get('/topic/{topic:slug}', [TopicsController::class,'show'])->name('topics.show');
Route::get('/source/{source:slug}', [SourcesController::class,'show'])->name('sources.show');
Route::get('/mylist', [MylistController::class, 'index'])->name('mylist.index');
Route::post('/mylist/{article:id}', [MylistController::class, 'store'])->name('mylist.store');
Route::get('/about', function(){
return view('pages.about', [
'sources' => Source::all(),
'total_topics' => Topic::count(),
'total_articles' => Article::count()
]);
});
Route::get('/ogimage', function(Request $request) {
$article = Article::findOrFail($request->query('id'));
return view('ogimage', ['article' => $article]);
});