added simple post

pull/49/head
A1Gard 5 months ago
parent dc59afb928
commit d03617e998

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Models\Post;
use Illuminate\Http\Request;
use Spatie\Tags\Tag;
class ClientController extends Controller
{
@ -21,4 +22,10 @@ class ClientController extends Controller
$subtitle = $post->subtitle;
return view('client.post',compact('area','post','title','subtitle'));
}
public function tag($slug){
$tag = Tag::where('slug->'.config('app.locale'),'like',$slug)->first();
return $tag;
}
}

@ -32,7 +32,7 @@ class AreaSeeder extends Seeder
,"groups","categories","category","group","index"]
),
'max' => 10,
'preview' => 'welcome',
'preview' => 'client.welcome',
'icon' => 'ri-layout-top-2-line',
],
[
@ -42,7 +42,7 @@ class AreaSeeder extends Seeder
"parallax","other","post"]
),
'max' => 6,
'preview' => 'test',
'preview' => 'client.post',
'icon' => 'ri-layout-top-2-line',
],
];

@ -20,4 +20,8 @@
border-bottom-left-radius: 0;
height: 100px;
}
+ .content{
margin-top: -3rem;
}
}

@ -0,0 +1,35 @@
<section class='SimplePost content'>
<div class="{{gfx()['container']}}">
<div class="p-2">
<h1>
{{$post->title}}
</h1>
<img src="{{$post->orgUrl()}}" alt="" class="img-fluid">
<p class="text-muted my-3">
{{$post->subtitle}}
</p>
<div class="row">
<div class="col-md">
<i class="ri-calendar-line"></i>
{{$post->created_at->ldate('Y/m/d H:i')}}
</div>
<div class="col-md">
<i class="ri-message-line"></i>
{{number_format($post->approvedComments()->count())}}
</div>
<div class="col-md-6">
{{__("Tags")}}:
@foreach($post->tags as $tag)
<a href="{{route('client.tag',$tag->slug)}}" class="tag me-2">
<i class="ri-price-tag-line"></i>
{{$tag->name}}
</a>
@endforeach
</div>
</div>
<hr>
{!! $post->body !!}
</div>
</div>
</section>

@ -0,0 +1,10 @@
{
"name": "SimplePost",
"version": "1.0",
"author": "xStack",
"email": "xshop@xstack.ir",
"license": "GPL-3.0-or-later",
"url": "https:\/\/xstack.ir",
"author_url": "https:\/\/4xmen.ir",
"packages": []
}

@ -0,0 +1,21 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Part;
class SimplePost
{
public static function onAdd(Part $part = null)
{
}
public static function onRemove(Part $part = null)
{
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,21 @@
.SimplePost {
// scss
h1{
font-size: 27px;
padding: 1rem;
color: var(--xshop-primary);
}
img{
max-height: 40vh;
width: 100%;
object-fit: cover;
}
.tag{
background: var(--xshop-primary);
padding: 3px .7rem;
color: var(--xshop-diff);
border-radius: var(--xshop-border-radius);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

@ -358,6 +358,7 @@ Route::name('client.')->group(function (){
// index
Route::get('/', [\App\Http\Controllers\ClientController::class,'welcome'])->name('welcome');
Route::get('/{post}', [\App\Http\Controllers\ClientController::class,'post'])->name('post');
Route::get('/tag/{post}', [\App\Http\Controllers\ClientController::class,'tag'])->name('tag');
})->middleware([\App\Http\Middleware\VisitorCounter::class]);

Loading…
Cancel
Save