Source view

This commit is contained in:
2020-08-15 02:24:46 +05:00
parent 084f275b89
commit 35e96947d9
3 changed files with 84 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Source;
class SourcesController extends Controller
{
/**
* Load a single Source view
*
* @param mixed $topic
* @return void
*/
public function show(Source $source)
{
return view('sources.show', [
'source' => $source->load('articles')
]);
}
}

View File

@@ -0,0 +1,60 @@
@extends('layouts.app')
@section('content')
<div>
<section class="mx-auto max-w-6xl py-5">
<div class="flex flex-col">
<div class="flex flex-col md:flex-row justify-center items-center">
<div class="transition-all ease-in-out duration-1000 flex flex-col justify-center">
<div slot="middle-right" class="max-w-xs">
<div class="flex flex-col justify-center h-48 p-3">
<div class="flex flex-col items-center shadow hover:shadow-lg rounded-lg p-3">
<img src="{{$source->logo}}" class="h-16 w-16">
<div class="text-3xl font-bold text-gray-800 text-center MvAamu mt-2">{{$source->name}}</div>
</div>
<div class="text-sm my-3 MvTyper text-center leading-6" style="direction:rtl;">
{{$source->name}} ނޫހުން ޝާޢިޢުކޮއްފައިވާ ލިޔުންތަށް</div>
</div>
</div>
</div>
</div>
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2 mb-10 mt-8">
@foreach ($source->articles as $article)
<div class="transition-all ease-in-out duration-1000 flex flex-col justify-center mr-0 md:mr-2">
<div slot="bottom-left" class="max-w-xs">
<div class="p-5 shadow-md m-2 mt-4">
<a href="{{route('articles.show', $article->id)}}">
<img class="object-scale-down h-30" src="{{$article->featured_image}}"
alt="{{$article->meta['title']}}">
</a>
<div class="text-xs font-bold uppercase text-gray-500 text-right mt-1 mb-2 MvTyper">
{{$article->source->name}}</div>
<a href="{{route('articles.show', $article->id)}}">
<div class="text-md font-bold leading-7 mb-2 MvTyper text-right hover:underline">
{{$article->title}}</div>
</a>
</div>
</div>
</div>
@endforeach
</div>
</div>
</section>
</div>
@endsection

View File

@@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route;
use App\Article; use App\Article;
use App\Http\Controllers\ArticlesController; use App\Http\Controllers\ArticlesController;
use App\Http\Controllers\TopicsController; use App\Http\Controllers\TopicsController;
use App\Http\Controllers\SourcesController;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -23,6 +24,7 @@ Route::get('/', function(){
Route::get('/article/{article:id}', [ArticlesController::class,'show'])->name('articles.show'); Route::get('/article/{article:id}', [ArticlesController::class,'show'])->name('articles.show');
Route::get('/topic/{topic:slug}', [TopicsController::class,'show'])->name('topics.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('/ogimage', function(Request $request) { Route::get('/ogimage', function(Request $request) {