Files
karudhaas/routes/web.php
2021-05-07 07:22:11 +05:00

75 lines
2.5 KiB
PHP

<?php
use App\Article;
use App\Source;
use App\Topic;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\ArticlesController;
use App\Http\Controllers\TopicsController;
use App\Http\Controllers\SourcesController;
use App\Http\Controllers\MylistController;
use App\Http\Controllers\NameSpaceController;
use App\Http\Controllers\WeatherController;
use Spatie\Browsershot\Browsershot;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
*/
Route::get('/', \HomeController::class)->name('home');
Route::get('/preview', fn () => view('pages.preview'));
Route::get('/download/android', fn () => redirect("https://play.google.com/store/apps/details?id=dev.baraveli.karudhaas"));
Route::get('/article/{source}/{guid}', [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::group(['prefix' => 'namespaces'], function(){
Route::get('/', [NameSpaceController::class, 'index'])->name('namespaces.index');
Route::get('/{namespace}', [NameSpaceController::class, 'show'])->name('namespaces.show');
});
Route::get('/about', function () {
return view('pages.about', [
'sources' => Source::all(),
'total_topics' => Topic::count(),
'total_articles' => Article::count()
]);
});
/*
=============================
Resource pages
=============================
*/
Route::get('/weather',[WeatherController::class, 'index'])->name('weather');
Route::middleware(['auth:sanctum', 'verified'])->prefix('dashboard')->namespace('Admin')->group(function() {
Route::get('/', function () {
return view('admin.dashboard', [
'total_sources' => Source::count(),
'total_topics' => Topic::count(),
'total_articles' => Article::count()
]);
})->name('dashboard.index');
Route::get('/analytics', AnalyticsController::class)->name('dashboard.analytics');
Route::get('/monitor', MonitorController::class)->name('dashboard.monitor');
});
Route::get('ogimage/{article}', function(Article $article){
return view('ogimage', [
'article' => $article
]);
});