Add (posts)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Category;
|
||||
use App\Models\CountryLocale;
|
||||
use App\Models\Post;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Stevebauman\Location\Facades\Location;
|
||||
@@ -27,7 +28,35 @@ public function country(Request $request, $country)
|
||||
|
||||
$request->session()->put('view_country_locale', $country_locale);
|
||||
|
||||
return view('front.country', ['country_locale' => $country_locale]);
|
||||
$featured_posts = Post::select('posts.*')
|
||||
->join('post_categories','posts.id','=', 'post_categories.post_id')
|
||||
->join('categories','post_categories.category_id','=', 'categories.id')
|
||||
->whereNotNull('post_categories.id')
|
||||
->whereNotNull('categories.id')
|
||||
->where('categories.country_locale_slug', $country_locale->slug)
|
||||
->where('posts.featured', true)
|
||||
->where('posts.status', 'publish')
|
||||
->orderBy('posts.updated_at', 'desc')
|
||||
->take(3)
|
||||
->get();
|
||||
|
||||
|
||||
$latest_posts = Post::select('posts.*')
|
||||
->join('post_categories','posts.id','=', 'post_categories.post_id')
|
||||
->join('categories','post_categories.category_id','=', 'categories.id')
|
||||
->whereNotNull('post_categories.id')
|
||||
->whereNotNull('categories.id')
|
||||
->where('categories.country_locale_slug', $country_locale->slug)
|
||||
->where('posts.featured', true)
|
||||
->whereNotIn('posts.id', $featured_posts->pluck('id')->toArray())
|
||||
->where('posts.status', 'publish')
|
||||
->orderBy('posts.updated_at', 'desc')
|
||||
->distinct()
|
||||
->take(20)
|
||||
->get();
|
||||
|
||||
return view('front.country', compact('country_locale','featured_posts','latest_posts')
|
||||
);
|
||||
}
|
||||
|
||||
return redirect()->route('home.country', ['country' => config('platform.general.fallback_country_slug')]);
|
||||
@@ -50,6 +79,13 @@ public function countryCategory(Request $request, $country, $category)
|
||||
return view('front.country_category', ['country_locale' => $country_locale, 'category' => $category]);
|
||||
}
|
||||
|
||||
public function all(Request $request, $country)
|
||||
{
|
||||
$country_locale = CountryLocale::where('slug', $country)->first();
|
||||
|
||||
return view('front.country_all', ['country_locale' => $country_locale]);
|
||||
}
|
||||
|
||||
public function posts(Request $request, $country)
|
||||
{
|
||||
return "{$country} : all posts";
|
||||
|
||||
50
app/Models/Author.php
Normal file
50
app/Models/Author.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Author
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $avatar
|
||||
* @property string $bio
|
||||
* @property bool $enabled
|
||||
* @property bool $public
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property Collection|Post[] $posts
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Author extends Model
|
||||
{
|
||||
protected $table = 'authors';
|
||||
|
||||
protected $casts = [
|
||||
'enabled' => 'bool',
|
||||
'public' => 'bool'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'avatar',
|
||||
'bio',
|
||||
'enabled',
|
||||
'public'
|
||||
];
|
||||
|
||||
public function posts()
|
||||
{
|
||||
return $this->hasMany(Post::class);
|
||||
}
|
||||
}
|
||||
11
app/Models/DraftPost.php
Normal file
11
app/Models/DraftPost.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DraftPost extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
70
app/Models/Post.php
Normal file
70
app/Models/Post.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Post
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $title
|
||||
* @property string|null $slug
|
||||
* @property string|null $excerpt
|
||||
* @property int|null $author_id
|
||||
* @property string $featured_image
|
||||
* @property string $editor
|
||||
* @property array|null $body
|
||||
* @property string $post_format
|
||||
* @property int $comment_count
|
||||
* @property int $likes_count
|
||||
* @property string $status
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property Author|null $author
|
||||
* @property Collection|PostCategory[] $post_categories
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Post extends Model
|
||||
{
|
||||
protected $table = 'posts';
|
||||
|
||||
protected $casts = [
|
||||
'author_id' => 'int',
|
||||
'body' => 'json',
|
||||
'comment_count' => 'int',
|
||||
'likes_count' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'slug',
|
||||
'excerpt',
|
||||
'author_id',
|
||||
'featured_image',
|
||||
'editor',
|
||||
'body',
|
||||
'post_format',
|
||||
'comment_count',
|
||||
'likes_count',
|
||||
'status'
|
||||
];
|
||||
|
||||
public function author()
|
||||
{
|
||||
return $this->belongsTo(Author::class);
|
||||
}
|
||||
|
||||
public function post_categories()
|
||||
{
|
||||
return $this->hasMany(PostCategory::class);
|
||||
}
|
||||
}
|
||||
49
app/Models/PostCategory.php
Normal file
49
app/Models/PostCategory.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class PostCategory
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $post_id
|
||||
* @property int $category_id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property Category $category
|
||||
* @property Post $post
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class PostCategory extends Model
|
||||
{
|
||||
protected $table = 'post_categories';
|
||||
|
||||
protected $casts = [
|
||||
'post_id' => 'int',
|
||||
'category_id' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'post_id',
|
||||
'category_id'
|
||||
];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
return $this->belongsTo(Post::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('authors', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('avatar');
|
||||
$table->string('bio');
|
||||
$table->boolean('enabled')->default(true);
|
||||
$table->boolean('public')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('authors');
|
||||
}
|
||||
};
|
||||
41
database/migrations/2023_07_26_155118_create_posts_table.php
Normal file
41
database/migrations/2023_07_26_155118_create_posts_table.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('posts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('slug')->nullable();
|
||||
$table->mediumText('excerpt')->nullable();
|
||||
$table->foreignId('author_id')->nullable();
|
||||
$table->boolean('featured')->default(false);
|
||||
$table->string('featured_image');
|
||||
$table->enum('editor', ['editorjs'])->default('editorjs');
|
||||
$table->json('body')->nullable();
|
||||
$table->enum('post_format',['standard'])->default('standard');
|
||||
$table->integer('comment_count')->default(0);
|
||||
$table->integer('likes_count')->default(0);
|
||||
$table->enum('status', ['publish','future','draft','private','trash'])->default('draft');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('author_id')->references('id')->on('authors');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('posts');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('post_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('post_id');
|
||||
$table->foreignId('category_id');
|
||||
|
||||
$table->foreign('post_id')->references('id')->on('posts');
|
||||
$table->foreign('category_id')->references('id')->on('categories');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('post_categories');
|
||||
}
|
||||
};
|
||||
70
database/seeders/PostsSeeder.php
Normal file
70
database/seeders/PostsSeeder.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\Models\Author;
|
||||
use App\Models\Category;
|
||||
use App\Models\Post;
|
||||
use App\Models\PostCategory;
|
||||
|
||||
use Faker\Factory as FakerFactory;
|
||||
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
|
||||
class PostsSeeder extends Seeder
|
||||
{
|
||||
/*
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$authors = Author::where('enabled', true)->get();
|
||||
|
||||
$categories = Category::Where('enabled', true)->get();
|
||||
|
||||
|
||||
$faker = FakerFactory::create();
|
||||
|
||||
|
||||
for ($i = 0; $i < 20; $i++) {
|
||||
|
||||
$photo_id = (($i + 1) % 16); // placekitten has only 16 photos
|
||||
|
||||
$post_title = $faker->sentence;
|
||||
$post_slug = Str::slug($post_title, "-");
|
||||
|
||||
$cloned_authors = clone $authors;
|
||||
$cloned_categories = clone $categories;
|
||||
|
||||
$createdAt = $faker->dateTimeBetween('-1 year', 'now');
|
||||
|
||||
|
||||
$post = Post::create([
|
||||
"title" => $post_title,
|
||||
"slug" => $post_slug,
|
||||
"excerpt" => $faker->paragraph,
|
||||
"author_id" => $cloned_authors->random()->first()->id,
|
||||
"featured" => rand(0,1),
|
||||
"featured_image" => "https://placekitten.com/1920/1080?image={$photo_id}",
|
||||
"editor" => "editorjs",
|
||||
"post_format" => "standard",
|
||||
"comment_count" => rand(0,100),
|
||||
"likes_count" => rand(0,100),
|
||||
"status" => "publish",
|
||||
"body" => "{\"time\":1563816717958,\"blocks\":[{\"data\":{\"text\":\"Editor.js\",\"level\":2},\"type\":\"header\"},{\"data\":{\"text\":\"Hey. Meet the new Editor. On this page you can see it in action \\u2014 try to edit this text.\"},\"type\":\"paragraph\"},{\"data\":{\"text\":\"Key features\",\"level\":3},\"type\":\"header\"},{\"data\":{\"items\":[\"It is a block-styled editor\",\"It returns clean data output in JSON\",\"Designed to be extendable and pluggable with a simple API\"],\"style\":\"unordered\"},\"type\":\"list\"},{\"data\":{\"text\":\"What does it mean \\u00abblock-styled editor\\u00bb\",\"level\":3},\"type\":\"header\"},{\"data\":{\"text\":\"Workspace in classic editors is made of a single contenteditable element, used to create different HTML markups. Editor.js <mark class=\\\"cdx-marker\\\">workspace consists of separate Blocks: paragraphs, headings, images, lists, quotes, etc<\\\/mark>. Each of them is an independent contenteditable element (or more complex structure) provided by Plugin and united by Editor's Core.\"},\"type\":\"paragraph\"},{\"data\":{\"text\":\"There are dozens of <a href=\\\"https:\\\/\\\/github.com\\\/editor-js\\\">ready-to-use Blocks<\\\/a> and the <a href=\\\"https:\\\/\\\/editorjs.io\\\/creating-a-block-tool\\\">simple API<\\\/a> for creation any Block you need. For example, you can implement Blocks for Tweets, Instagram posts, surveys and polls, CTA-buttons and even games.\"},\"type\":\"paragraph\"},{\"data\":{\"text\":\"What does it mean clean data output\",\"level\":3},\"type\":\"header\"},{\"data\":{\"text\":\"Classic WYSIWYG-editors produce raw HTML-markup with both content data and content appearance. On the contrary, Editor.js outputs JSON object with data of each Block. You can see an example below\"},\"type\":\"paragraph\"},{\"data\":{\"text\":\"Given data can be used as you want: render with HTML for <code class=\\\"inline-code\\\">Web clients<\\\/code>, render natively for <code class=\\\"inline-code\\\">mobile apps<\\\/code>, create markup for <code class=\\\"inline-code\\\">Facebook Instant Articles<\\\/code> or <code class=\\\"inline-code\\\">Google AMP<\\\/code>, generate an <code class=\\\"inline-code\\\">audio version<\\\/code> and so on.\"},\"type\":\"paragraph\"},{\"data\":{\"text\":\"Clean data is useful to sanitize, validate and process on the backend.\"},\"type\":\"paragraph\"},{\"data\":[],\"type\":\"delimiter\"},{\"data\":{\"text\":\"We have been working on this project more than three years. Several large media projects help us to test and debug the Editor, to make it's core more stable. At the same time we significantly improved the API. Now, it can be used to create any plugin for any task. Hope you enjoy. \\ud83d\\ude0f\"},\"type\":\"paragraph\"},{\"data\":{\"file\":{\"url\":\"https:\\\/\\\/codex.so\\\/upload\\\/redactor_images\\\/o_e48549d1855c7fc1807308dd14990126.jpg\"},\"caption\":\"Image caption\",\"stretched\":false,\"withBorder\":true,\"withBackground\":false},\"type\":\"image\"}],\"version\":\"2.15.0\"}",
|
||||
'created_at' => $createdAt,
|
||||
'updated_at' => $createdAt,
|
||||
]);
|
||||
|
||||
$post_category = PostCategory::create([
|
||||
'post_id' => $post->id,
|
||||
'category_id' => $cloned_categories->random()->first()->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,23 +13,25 @@
|
||||
<div class="container">
|
||||
<h3 class="h4 fw-bold text-center mb-3">Featured Articles</h3>
|
||||
<div class="row g-3 justify-content-center">
|
||||
@for ($i = 1; $i <= 3; $i++)
|
||||
@foreach($featured_posts as $post)
|
||||
<div class="col-12 col-xl-3">
|
||||
<a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post' => str_random() ]) }}" class="text-decoration-none">
|
||||
<div class="card shadow-sm">
|
||||
<img src="https://placekitten.com/400/300" alt="" class="card-img-top">
|
||||
<a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post' => $post->slug]) }}" class="text-decoration-none">
|
||||
<div class="card shadow-sm" style="height:100%;">
|
||||
<div class="card-img-top ratio ratio-16x9">
|
||||
<img src="{{ $post->featured_image }}" alt="">
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<p class="card-text fw-bold">Here is why a kitten catches mice faster than an adult cat.
|
||||
</p>
|
||||
<p class="card-text fw-bold">{{ $post->title }}</p>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<small class="text-body-secondary">5 April 2023</small>
|
||||
<small class="text-body-secondary">9 mins</small>
|
||||
<small class="text-body-secondary">{{ $post->created_at->format('j F Y') }}</small>
|
||||
{{-- <small class="text-body-secondary">9 min read</small> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
@endfor
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -37,25 +39,24 @@
|
||||
<div class="container-fluid py-4">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col col-lg-9">
|
||||
<div class="col col-md-12 col-lg-12 col-xl-11 col-xxl-9">
|
||||
<h3 class="h4 fw-bold text-center mb-3">What's New in {{ get_country_name_by_iso($country_locale->country_iso) }}</h3>
|
||||
<div class="row g-3">
|
||||
@for ($i = 1; $i <= 12; $i++)
|
||||
<div class="col-6">
|
||||
@foreach ($latest_posts as $post)
|
||||
<div class="col-lg-6">
|
||||
<a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post' => str_random() ]) }}" class="text-decoration-none">
|
||||
<div class="card">
|
||||
<div class="card" style="height:100%;">
|
||||
<div class="row g-0">
|
||||
<div class="col-md-4">
|
||||
<img src="https://placekitten.com/400/300" class="img-fluid rounded-start"
|
||||
alt="...">
|
||||
<div class="col-md-5">
|
||||
<div class="img-fluid rounded-start ratio ratio-16x9">
|
||||
<img src="{{ $post->featured_image }}" alt="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="col-md-7">
|
||||
<div class="card-body">
|
||||
<p class="card-title fw-bold">Here is why a kitten catches mice faster
|
||||
than an adult cat.</p>
|
||||
<p class="card-title fw-bold">H{{ $post->title }}</p>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<small class="text-body-secondary">5 April 2023</small>
|
||||
<small class="text-body-secondary">9 mins</small>
|
||||
<small class="text-body-secondary">{{ $post->created_at->format('j F Y') }}</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,7 +64,7 @@
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
@endfor
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
<div class="text-center py-3">
|
||||
|
||||
70
resources/views/front/country_all.blade.php
Normal file
70
resources/views/front/country_all.blade.php
Normal file
@@ -0,0 +1,70 @@
|
||||
@extends('layouts.front.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container py-3">
|
||||
|
||||
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-lg-11 col-xl-9 col-xxl-8">
|
||||
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-8 col-xl-8">
|
||||
|
||||
<div class="mb-5">
|
||||
<h1 class="h2 fw-bold">All {{ $country_locale->name }} News</h1>
|
||||
<p class="text-secondary">
|
||||
The latest {{ $country_locale->name }} news, brought to you by {{ config('app.name') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@for($i = 0; $i < 10; $i++)
|
||||
<div class="my-3">
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="card mb-3">
|
||||
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a class="text-decoration-none" href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post' => str_random() ]) }}">Here is why a kitten catches mice faster than an adult cat.</a></h5>
|
||||
<p class="card-text">
|
||||
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
|
||||
</p>
|
||||
|
||||
<p class="card-text">
|
||||
<small><a class="text-decoration-none" href="{{ route('home.country.category', ['country' => $country_locale->country_iso, 'category' => 'technology' ]) }}">#technology</a> <a class="text-decoration-none" href="{{ route('home.country.category', ['country' => $country_locale->country_iso, 'category' => 'gadgets' ]) }}">#gadgets</a></small>
|
||||
<small class="text-body-secondary ms-2">3 min read</small>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<a class="card-img-top" href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post' => str_random() ]) }}">
|
||||
<img src="https://placekitten.com/400/300" class="card-img-top rounded-bottom-2 rounded-top-0" alt="...">
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@endfor
|
||||
|
||||
<nav aria-label="Page navigation example">
|
||||
<ul class="pagination">
|
||||
<li class="page-item"><a class="page-link" href="#">Previous</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">1</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">2</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">3</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">Next</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
@@ -3,18 +3,21 @@
|
||||
@section('content')
|
||||
<div class="container py-3">
|
||||
|
||||
<div class="mb-5">
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-lg-11 col-xl-9 col-xxl-8">
|
||||
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-8 col-xl-8">
|
||||
|
||||
<div class="mb-5">
|
||||
<h1 class="h2 fw-bold">{{ $category->name }}</h1>
|
||||
<p class="text-secondary">
|
||||
{{ $category->description }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-lg-11 col-xl-9 col-xxl-8">
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-lg-8 col-xl-8 bg-primary">
|
||||
|
||||
@for($i = 0; $i < 10; $i++)
|
||||
<div class="my-3">
|
||||
|
||||
@@ -30,12 +33,12 @@
|
||||
|
||||
<p class="card-text">
|
||||
<small><a class="text-decoration-none" href="{{ route('home.country.category', ['country' => $country_locale->country_iso, 'category' => 'technology' ]) }}">#technology</a> <a class="text-decoration-none" href="{{ route('home.country.category', ['country' => $country_locale->country_iso, 'category' => 'gadgets' ]) }}">#gadgets</a></small>
|
||||
<small class="text-body-secondary">Updated 3 mins ago</small>
|
||||
<small class="text-body-secondary ms-2">3 min read</small>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<a class="card-img-top" href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post' => str_random() ]) }}">
|
||||
<img src="https://placekitten.com/400/300" class="card-img-top" alt="...">
|
||||
<img src="https://placekitten.com/400/300" class="card-img-top rounded-bottom-2 rounded-top-0" alt="...">
|
||||
</a>
|
||||
|
||||
</div>
|
||||
@@ -43,10 +46,22 @@
|
||||
|
||||
</div>
|
||||
@endfor
|
||||
|
||||
<div>
|
||||
<nav class="col" aria-label="Page navigation example">
|
||||
<ul class="pagination">
|
||||
<li class="page-item"><a class="page-link" href="#">Previous</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">1</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">2</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">3</a></li>
|
||||
<li class="page-item"><a class="page-link" href="#">Next</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 col-lg-4 col-xl-4 bg-secondary">
|
||||
{{-- <div class="col-md-4 col-lg-4 col-xl-4 bg-secondary">
|
||||
b
|
||||
</div>
|
||||
</div> --}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
7
resources/views/front/post.blade.php
Normal file
7
resources/views/front/post.blade.php
Normal file
@@ -0,0 +1,7 @@
|
||||
@extends('layouts.front.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container py-3">
|
||||
Post
|
||||
</div>
|
||||
@endsection
|
||||
@@ -41,6 +41,9 @@
|
||||
|
||||
<div class="p-3">
|
||||
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="{{ route('home.country', ['country' => $current_country_locale->slug ]) }}">Home</a>
|
||||
</li>
|
||||
@foreach ($categories as $category)
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug ]) }}">{{ $category->name }}</a>
|
||||
|
||||
@@ -12,12 +12,16 @@
|
||||
| be assigned to the "web" middleware group. Make something great!
|
||||
|
|
||||
*/
|
||||
Route::get('test', function() {
|
||||
return App\Models\Post::first()->body;
|
||||
});
|
||||
|
||||
|
||||
Route::get('/', [App\Http\Controllers\Front\HomeController::class, 'index'])->name('home');
|
||||
|
||||
Route::get('/{country}', [App\Http\Controllers\Front\HomeController::class, 'country'])->name('home.country');
|
||||
|
||||
Route::get('/{country}/posts', [App\Http\Controllers\Front\HomeController::class, 'posts'])->name('home.country.posts');
|
||||
Route::get('/{country}/posts', [App\Http\Controllers\Front\HomeController::class, 'all'])->name('home.country.posts');
|
||||
|
||||
Route::get('/{country}/posts/{post}', [App\Http\Controllers\Front\HomeController::class, 'post'])->name('home.country.post');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user