fix: somes fix related to issue 48, news bo + fo
This commit is contained in:
parent
e04c789a80
commit
07f8af2e90
7 changed files with 31 additions and 11 deletions
|
|
@ -57,6 +57,10 @@ class NewsController extends Controller
|
|||
// Find the next news from the id.
|
||||
$prevNews = News::query()->where('id', $publishedNews[$prevPositionId])->firstOrFail();
|
||||
|
||||
return view('fo.pages.news.show', \compact('news', 'nextNews', 'prevNews'));
|
||||
return view('fo.pages.news.show', [
|
||||
'news' => $news,
|
||||
'nextNews' => $nextNews,
|
||||
'prevNews' => $prevNews,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class StoreNewsRequest extends FormRequest
|
|||
];
|
||||
return \array_merge(
|
||||
$rules,
|
||||
$this->pictureRules('picture', 330, 210, 330, 210, true),
|
||||
$this->pictureRules('picture', 500, 390, 500, 390, true),
|
||||
$this->pictureRules('thumbnail', 300, 200, 300, 200, true),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Providers;
|
||||
|
||||
use App\Http\Middleware\VerifyCsrfToken;
|
||||
use App\Models\News;
|
||||
use App\Models\Strip;
|
||||
use App\Models\User;
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
|
|
@ -45,6 +46,12 @@ class RouteServiceProvider extends ServiceProvider
|
|||
|
||||
Route::model('user', User::class);
|
||||
Route::model('strip', Strip::class);
|
||||
Route::model('news', News::class);
|
||||
Route::bind('publishedNews', function ($value) {
|
||||
return News::where(function ($q) use ($value) {
|
||||
$q->where('id', $value)->orWhere('slug', $value);
|
||||
})->where('published', true)->firstOrFail();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@
|
|||
.rotate-arrow {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.news-linkedin-logo {
|
||||
height: 3rem;
|
||||
}
|
||||
}
|
||||
|
||||
// LLLLLLLLLLL GGGGGGGGGGGGG
|
||||
|
|
|
|||
|
|
@ -244,12 +244,12 @@
|
|||
@include('bo.partials.inputs.varchar-picture', [
|
||||
'id' => 'newsPicture',
|
||||
'name' => 'picture',
|
||||
'width' => 330,
|
||||
'height' => 210,
|
||||
'width' => 500,
|
||||
'height' => 390,
|
||||
'model' => $newsModel ?? null,
|
||||
'helper' => __('crud.minicrud.dimensions_must_be', [
|
||||
'widthpx' => '330px',
|
||||
'heightpx' => '210px',
|
||||
'widthpx' => '500px',
|
||||
'heightpx' => '390px',
|
||||
]),
|
||||
'required' => true,
|
||||
'preview' => true,
|
||||
|
|
@ -361,7 +361,7 @@
|
|||
'id' => 'newsPublishedAt',
|
||||
'name' => 'publish_at',
|
||||
'model' => $newsModel ?? null,
|
||||
'helper' => __('crud.helpers.publish_at', [
|
||||
'helper' => __('validation.custom.publish_at', [
|
||||
'model' => trans_choice('models.classes.news', 1),
|
||||
]),
|
||||
])
|
||||
|
|
@ -374,7 +374,7 @@
|
|||
'id' => 'newsUnPublishedAt',
|
||||
'name' => 'unpublish_at',
|
||||
'model' => $newsModel ?? null,
|
||||
'helper' => __('crud.helpers.unpublish_at', [
|
||||
'helper' => __('validation.custom.unpublish_at', [
|
||||
'model' => trans_choice('models.classes.news', 1),
|
||||
]),
|
||||
])
|
||||
|
|
|
|||
|
|
@ -21,11 +21,16 @@
|
|||
</div>
|
||||
<div class="card-body">
|
||||
<div class="title-intro row align-items-center mb-3 text-center">
|
||||
<h1 class="col-12 text-primary m-auto p-3 pt-0">
|
||||
<h1 class="col-10 text-primary m-auto p-3 pt-0">
|
||||
{{ $news->title }}
|
||||
</h1>
|
||||
<div class="col-2">
|
||||
<a href="{{ $news->linkedin_url }}" target="_blank">
|
||||
<img class="news-linkedin-logo" src="{{ Vite::asset('resources/assets/images/social/linkedin.svg') }}" alt="{{ __('Logo linkedin') }}">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card sub-card text-primary border-0">
|
||||
<div class="card sub-card text-primary border-0 m-4">
|
||||
<div class="card-body row align-items-center">
|
||||
<div class="news-content col-lg-6 col-12 order-lg-first order-last">
|
||||
{!! clean($news->content) !!}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Route::middleware(['throttle:web'])->name('fo.')->group(function () {
|
|||
Route::get('/on-vous-ecoute', [StaticPageController::class, 'listen'])->name('listen.show');
|
||||
Route::get('/sites/{site:slug}', [StaticPageController::class, 'site'])->name('sites.show');
|
||||
Route::get('/on-bouge', [NewsController::class, 'index'])->name('news.index');
|
||||
Route::get('/on-bouge/{news:slug}', [NewsController::class, 'show'])->name('news.show');
|
||||
Route::get('/on-bouge/{publishedNews:slug}', [NewsController::class, 'show'])->name('news.show');
|
||||
Route::get('/on-embauche', [StaticPageController::class, 'hire'])->name('hire.show');
|
||||
Route::get('/on-produit', [StaticPageController::class, 'produce'])->name('produce.show');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue