Implement news management features: add author field and comments functionality in NewsResource, enhance HomePageController to fetch latest news, and create dedicated views for news display and commenting. Update routes for comment submission and adjust homepage to showcase recent news articles.
This commit is contained in:
@@ -15,8 +15,6 @@ use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class HomePageSettings extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-home';
|
||||
|
||||
protected static string $settings = HomeSettings::class;
|
||||
|
||||
public function form(Form $form): Form
|
||||
@@ -291,4 +289,4 @@ class HomePageSettings extends SettingsPage
|
||||
{
|
||||
return 'Manage the homepage hero section, background video, and call-to-action content.';
|
||||
}
|
||||
}
|
||||
}
|
||||
40
app/Filament/Pages/ManageCtaSettings.php
Normal file
40
app/Filament/Pages/ManageCtaSettings.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Settings\CtaSettings;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\SettingsPage;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
|
||||
class ManageCtaSettings extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationGroup = 'CMS';
|
||||
protected static ?string $navigationLabel = 'Call To Action';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-megaphone';
|
||||
|
||||
protected static string $settings = CtaSettings::class;
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('title')
|
||||
->label('Call To Action Title')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('button_text')
|
||||
->label('Button Text')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('button_url')
|
||||
->label('Button URL')
|
||||
->required()
|
||||
->url(),
|
||||
FileUpload::make('background_image')
|
||||
->label('Background Image 1320x408')
|
||||
->directory('settings')
|
||||
->image()
|
||||
->columnSpan('full'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
99
app/Filament/Resources/CommentResource.php
Normal file
99
app/Filament/Resources/CommentResource.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\CommentResource\Pages;
|
||||
use App\Filament\Resources\CommentResource\RelationManagers;
|
||||
use App\Models\Comment;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class CommentResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Comment::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-chat-bubble-bottom-center-text';
|
||||
|
||||
protected static ?string $navigationGroup = 'CMS';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Card::make()
|
||||
->schema([
|
||||
Select::make('news_id')
|
||||
->relationship('news', 'title')
|
||||
->required(),
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
RichEditor::make('message')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
TextInput::make('author_name')
|
||||
->label('Author Name (Optional)')
|
||||
->maxLength(255),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('news.title')
|
||||
->label('News Article')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('title')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('author_name')
|
||||
->label('Author')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListComments::route('/'),
|
||||
'create' => Pages\CreateComment::route('/create'),
|
||||
'edit' => Pages\EditComment::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CommentResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CommentResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateComment extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CommentResource::class;
|
||||
}
|
||||
19
app/Filament/Resources/CommentResource/Pages/EditComment.php
Normal file
19
app/Filament/Resources/CommentResource/Pages/EditComment.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CommentResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CommentResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditComment extends EditRecord
|
||||
{
|
||||
protected static string $resource = CommentResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CommentResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CommentResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListComments extends ListRecords
|
||||
{
|
||||
protected static string $resource = CommentResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ use Filament\Tables;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Filament\Resources\NewsResource\RelationManagers\CommentsRelationManager;
|
||||
|
||||
class NewsResource extends Resource
|
||||
{
|
||||
@@ -42,10 +43,14 @@ class NewsResource extends Resource
|
||||
->dehydrated()
|
||||
->unique(News::class, 'slug', ignoreRecord: true),
|
||||
FileUpload::make('image')
|
||||
->label('Image 1100x660')
|
||||
->image()
|
||||
->directory('news')
|
||||
->nullable()
|
||||
->columnSpanFull(),
|
||||
TextInput::make('author')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
RichEditor::make('content')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
@@ -70,6 +75,9 @@ class NewsResource extends Resource
|
||||
Tables\Columns\TextColumn::make('slug')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('author')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('published_at')
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
@@ -99,7 +107,7 @@ class NewsResource extends Resource
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
CommentsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\NewsResource\RelationManagers;
|
||||
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CommentsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'comments';
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
RichEditor::make('message')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
TextInput::make('author_name')
|
||||
->label('Author Name (Optional)')
|
||||
->maxLength(255),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('title')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title')
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('author_name')
|
||||
->label('Author')
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Brand;
|
||||
use App\Models\News;
|
||||
use App\Settings\HomeSettings;
|
||||
|
||||
class HomePageController extends Controller
|
||||
@@ -11,7 +12,8 @@ class HomePageController extends Controller
|
||||
{
|
||||
$brands = Brand::query()->get(['id', 'image']);
|
||||
$homeSettings = app(HomeSettings::class);
|
||||
$allNews = News::query()->latest()->take(3)->get();
|
||||
|
||||
return view('web.pages.home.index', compact('homeSettings', 'brands'));
|
||||
return view('web.pages.home.index', compact('homeSettings', 'brands', 'allNews'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\News;
|
||||
use App\Models\Comment;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class NewsPageController extends Controller
|
||||
{
|
||||
@@ -17,4 +19,17 @@ class NewsPageController extends Controller
|
||||
{
|
||||
return view('web.pages.news.show', compact('news'));
|
||||
}
|
||||
|
||||
public function storeComment(Request $request, News $news)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'title' => 'required|string|max:255',
|
||||
'message' => 'required|string',
|
||||
'author_name' => 'nullable|string|max:255',
|
||||
]);
|
||||
|
||||
$news->comments()->create($validated);
|
||||
|
||||
return back()->with('success', 'Comment added successfully!');
|
||||
}
|
||||
}
|
||||
|
||||
24
app/Models/Comment.php
Normal file
24
app/Models/Comment.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Comment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'message',
|
||||
'author_name',
|
||||
'news_id',
|
||||
];
|
||||
|
||||
public function news(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(News::class);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class News extends Model
|
||||
{
|
||||
@@ -15,5 +16,11 @@ class News extends Model
|
||||
'content',
|
||||
'image',
|
||||
'published_at',
|
||||
'author',
|
||||
];
|
||||
|
||||
public function comments(): HasMany
|
||||
{
|
||||
return $this->hasMany(Comment::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
use Filament\Pages;
|
||||
@@ -15,8 +14,11 @@ use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||
use Illuminate\Session\Middleware\AuthenticateSession;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
use App\Filament\Pages\HomePageSettings;
|
||||
use App\Filament\Pages\ManageCtaSettings;
|
||||
|
||||
class PanelPanelProvider extends PanelProvider
|
||||
{
|
||||
@@ -34,6 +36,8 @@ class PanelPanelProvider extends PanelProvider
|
||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
||||
->pages([
|
||||
Pages\Dashboard::class,
|
||||
HomePageSettings::class,
|
||||
ManageCtaSettings::class,
|
||||
])
|
||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||
->widgets([
|
||||
|
||||
18
app/Settings/CtaSettings.php
Normal file
18
app/Settings/CtaSettings.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Settings;
|
||||
|
||||
use Spatie\LaravelSettings\Settings;
|
||||
|
||||
class CtaSettings extends Settings
|
||||
{
|
||||
public string $title;
|
||||
public string $button_text;
|
||||
public string $button_url;
|
||||
public string $background_image;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'cta';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::table('news', function (Blueprint $table) {
|
||||
$table->string('author')->after('image')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('news', function (Blueprint $table) {
|
||||
$table->dropColumn('author');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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('comments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->text('message');
|
||||
$table->string('author_name')->nullable();
|
||||
$table->foreignId('news_id')->constrained()->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('comments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
use Spatie\LaravelSettings\Migrations\SettingsMigration;
|
||||
|
||||
return new class extends SettingsMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$this->migrator->add('cta.title', 'Join Our Community and Access Exclusive Insights Today');
|
||||
$this->migrator->add('cta.button_text', 'Free Consultation');
|
||||
$this->migrator->add('cta.button_url', 'request-quote.html');
|
||||
$this->migrator->add('cta.background_image', '');
|
||||
}
|
||||
};
|
||||
@@ -13,6 +13,8 @@ class NewsTableSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
News::factory()->count(12)->create();
|
||||
News::factory()->count(12)->create([
|
||||
'image' => '/web/assets/img/page/breadcrumb.jpg',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
@inject('solutionSettings', 'App\Settings\SolutionSettings')
|
||||
@inject('successSettings', 'App\Settings\SuccessSettings')
|
||||
@inject('portfolioSettings', 'App\Settings\PortfolioSettings')
|
||||
@inject('ctaSettings', 'App\Settings\CtaSettings')
|
||||
|
||||
@section('content')
|
||||
<!-- Banner Area Start -->
|
||||
@@ -315,71 +316,33 @@
|
||||
<div class="col-xl-12">
|
||||
<div class="blog__four-title t-center">
|
||||
<span class="subtitle wow fadeInLeft" data-wow-delay=".4s">News & Blog</span>
|
||||
<h2 class="title_split_anim">Update News & Blogs</h2>
|
||||
<h2 class="title_split_anim">News</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@foreach($allNews as $news)
|
||||
<div class="col-xl-4 col-md-6 mt-25 wow fadeInUp" data-wow-delay=".4s">
|
||||
<div class="blog__four-item">
|
||||
<div class="blog__four-item-image">
|
||||
<a href="blog-details.html"><img src="/web/assets/img/blog/blog-1.jpg" alt="image"></a>
|
||||
<a href="{{ route('news.show', $news->slug) }}"><img src="/storage/{{ $news->image }}" alt="image"></a>
|
||||
<div class="blog__four-item-image-date">
|
||||
<h5>22</h5>
|
||||
<h6>Dec</h6>
|
||||
<h5>{{ \Carbon\Carbon::parse($news->published_at)->format('d') }}</h5>
|
||||
<h6>{{ \Carbon\Carbon::parse($news->published_at)->format('M') }}</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="blog__four-item-content">
|
||||
<div class="meta">
|
||||
<ul>
|
||||
<li><a href="#"><i class="far fa-user"></i>By-Admin</a></li>
|
||||
<li><a href="#"><i class="far fa-comment-dots"></i>Comments (3)</a></li>
|
||||
<li><a href="#"><i class="far fa-user"></i>{{ $news->author }}</a></li>
|
||||
<li><a href="#"><i class="far fa-comment-dots"></i>Comments ({{ $news->comments->count() }})</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h4><a href="blog-details.html">How Weather Can Impact a Construction Project</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-md-6 mt-25 wow fadeInUp" data-wow-delay=".7s">
|
||||
<div class="blog__four-item">
|
||||
<div class="blog__four-item-image">
|
||||
<a href="blog-details.html"><img src="/web/assets/img/blog/blog-2.jpg" alt="image"></a>
|
||||
<div class="blog__four-item-image-date">
|
||||
<h5>19</h5>
|
||||
<h6>Dec</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="blog__four-item-content">
|
||||
<div class="meta">
|
||||
<ul>
|
||||
<li><a href="#"><i class="far fa-user"></i>By-Admin</a></li>
|
||||
<li><a href="#"><i class="far fa-comment-dots"></i>Comments (3)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h4><a href="blog-details.html">How to Choose the Perfect Construction Company</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-md-6 mt-25 wow fadeInUp" data-wow-delay="1s">
|
||||
<div class="blog__four-item">
|
||||
<div class="blog__four-item-image">
|
||||
<a href="blog-details.html"><img src="/web/assets/img/blog/blog-3.jpg" alt="image"></a>
|
||||
<div class="blog__four-item-image-date">
|
||||
<h5>14</h5>
|
||||
<h6>Dec</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="blog__four-item-content">
|
||||
<div class="meta">
|
||||
<ul>
|
||||
<li><a href="#"><i class="far fa-user"></i>By-Admin</a></li>
|
||||
<li><a href="#"><i class="far fa-comment-dots"></i>Comments (3)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h4><a href="blog-details.html">Top Mistakes to Avoid During Home Renovation</a></h4>
|
||||
<h4><a href="{{ route('news.show', $news->slug) }}">{{ $news->title }}</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -390,11 +353,11 @@
|
||||
<div class="container">
|
||||
<div class="row jc-center">
|
||||
<div class="col-xl-12">
|
||||
<div class="cta__four-area t-center" style="background-image: url('/web/assets/img/page/subscribe.jpg');">
|
||||
<div class="cta__four-area t-center" style="background-image: url('/storage/{{ $ctaSettings->background_image }}');">
|
||||
<div class="cta__four-area-content">
|
||||
<h2 class="title_split_anim">Join Our Community and Access Exclusive Insights Today</h2>
|
||||
<h2 class="title_split_anim">{{ $ctaSettings->title }}</h2>
|
||||
<div class="item_bounce">
|
||||
<a class="build_button mt-40" href="request-quote.html">Free Consultation<i class="flaticon-right-up"></i></a>
|
||||
<a class="build_button mt-40" href="{{ $ctaSettings->button_url }}">{{ $ctaSettings->button_text }}<i class="flaticon-right-up"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
@section('content')
|
||||
<!-- Breadcrumb Area Start -->
|
||||
<div class="breadcrumb__area" style="background-image: url('assets/img/page/breadcrumb.jpg');">
|
||||
<div class="breadcrumb__area" style="background-image: url('/web/assets/img/page/breadcrumb.jpg');">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
@extends('web.layouts.app')
|
||||
|
||||
@section('content')
|
||||
<!-- Breadcrumb Area Start -->
|
||||
<div class="breadcrumb__area" style="background-image: url('/web/assets/img/page/breadcrumb.jpg');">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="breadcrumb__area-content">
|
||||
<h2>{{ $news->title }}</h2>
|
||||
<ul>
|
||||
<li><a href="{{ route('home') }}">Home</a><i class="fa-regular fa-angle-right"></i></li>
|
||||
<li><a href="{{ route('news.index') }}">News</a><i class="fa-regular fa-angle-right"></i></li>
|
||||
<li>{{ $news->title }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Breadcrumb Area End -->
|
||||
|
||||
<!-- Blog Single Area Start -->
|
||||
<div class="blog-single__area section-padding">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xl-8 col-lg-8 lg-mb-50">
|
||||
<div class="blog__single-left">
|
||||
<div class="blog__single-left-image">
|
||||
<img src="/storage/{{ $news->image }}" alt="{{ $news->title }}">
|
||||
</div>
|
||||
<div class="blog__single-left-content">
|
||||
<div class="blog__single-left-content-meta">
|
||||
<ul>
|
||||
<li><i class="fa-regular fa-calendar"></i> {{ \Carbon\Carbon::parse($news->published_at)->format('d M, Y') }}</li>
|
||||
<li><i class="fa-regular fa-user"></i> {{ $news->author }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h3 class="mb-20">{{ $news->title }}</h3>
|
||||
{!! $news->content !!}
|
||||
</div>
|
||||
<!-- Comments Section -->
|
||||
<div class="comments-area">
|
||||
<h3 class="comments-title">Comments ({{ $news->comments->count() }})</h3>
|
||||
<div class="comments-list">
|
||||
@foreach ($news->comments as $comment)
|
||||
<div class="single-comment-item">
|
||||
<div class="single-comment-item-content">
|
||||
<h5>{{ $comment->title }}</h5>
|
||||
<span>By {{ $comment->author_name ?? 'Anonymous' }} on {{ \Carbon\Carbon::parse($comment->created_at)->format('d M, Y') }}</span>
|
||||
<p>{{ $comment->message }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="comment-form-area">
|
||||
<h3 class="comment-form-title">Leave a Comment</h3>
|
||||
<form action="{{ route('comments.store', $news->slug) }}" method="POST">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-lg-6 mb-25">
|
||||
<input type="text" name="title" placeholder="Comment Title*" required>
|
||||
</div>
|
||||
<div class="col-lg-6 mb-25">
|
||||
<input type="text" name="author_name" placeholder="Your Name (Optional)">
|
||||
</div>
|
||||
<div class="col-lg-12 mb-25">
|
||||
<textarea name="message" rows="5" placeholder="Your Message*" required></textarea>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<button type="submit" class="theme-btn">Post Comment<i class="flaticon-right-up"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-4 col-lg-4">
|
||||
<!-- You can add a sidebar here if needed -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Blog Single Area End -->
|
||||
@endsection
|
||||
|
||||
@@ -24,6 +24,7 @@ Route::get('our-solutiouns/{solution:slug}', [OurSolutionPageController::class,
|
||||
// News...
|
||||
Route::get('news', [NewsPageController::class, 'index'])->name('news.index');
|
||||
Route::get('news/{news:slug}', [NewsPageController::class, 'show'])->name('news.show');
|
||||
Route::post('news/{news:slug}/comments', [NewsPageController::class, 'storeComment'])->name('comments.store');
|
||||
|
||||
// Success stories...
|
||||
Route::get('stories', [StoryPageController::class, 'index'])->name('story.index');
|
||||
|
||||
Reference in New Issue
Block a user