Merge branch 'issue-68' into 'develop'
fix published news - issue #68 See merge request ldc-web/projets/tregalette!18
This commit is contained in:
commit
879330c659
3 changed files with 15 additions and 10 deletions
|
|
@ -17,12 +17,17 @@ class NewsController extends Controller
|
||||||
*/
|
*/
|
||||||
public function index(): \Illuminate\Contracts\View\View
|
public function index(): \Illuminate\Contracts\View\View
|
||||||
{
|
{
|
||||||
|
/** @var \App\Models\StaticPage $staticPageModel */
|
||||||
$staticPageModel = StaticPage::query()
|
$staticPageModel = StaticPage::query()
|
||||||
->where('type', StaticPageType::news)
|
->where('type', StaticPageType::news)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
$rangeModelList = Range::query()->limit(3)->inRandomOrder()->get();
|
|
||||||
|
|
||||||
$newsModelList = News::query()->get();
|
/** @var \App\Models\Range $rangeModelList */
|
||||||
|
$rangeModelList = Range::query()->limit(3)->inRandomOrder()->get();
|
||||||
|
|
||||||
|
/** @var \App\Models\News $newsModelList */
|
||||||
|
$newsModelList = News::query()->where('published', true)->orderby('publish_at', 'ASC')->get();
|
||||||
|
|
||||||
return view('fo.pages.news.index', compact(
|
return view('fo.pages.news.index', compact(
|
||||||
'staticPageModel',
|
'staticPageModel',
|
||||||
'newsModelList',
|
'newsModelList',
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($newsModels as $newsModel)
|
@foreach ($newsModels as $newsModel)
|
||||||
<tr class="border-bottom list-item">
|
<tr class="border-bottom list-item">
|
||||||
<td class="text-center align-middle">{{ $newsModel->text }}</td>
|
<td class="text-center align-middle">{!! clean(Str::limit($newsModel->text, 50)) !!}</td>
|
||||||
<td class="text-center align-middle">
|
<td class="text-center align-middle">
|
||||||
<img src="{{ asset($newsModel->picture) }}" title="{{ $newsModel->picture_title }}" alt="{{ $newsModel->picture_alt }}"
|
<img src="{{ asset($newsModel->picture) }}" title="{{ $newsModel->picture_title }}" alt="{{ $newsModel->picture_alt }}"
|
||||||
height="50px">
|
height="50px">
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ use Illuminate\Support\Facades\Route;
|
||||||
Route::prefix('bo')
|
Route::prefix('bo')
|
||||||
->name('bo.')
|
->name('bo.')
|
||||||
->group(function () {
|
->group(function () {
|
||||||
// * Authenticable routes
|
// * AUTHENTICABLE ROUTES
|
||||||
Route::namespace('\App\Http\Controllers\Bo')
|
Route::namespace('\App\Http\Controllers\Bo')
|
||||||
->group(function () {
|
->group(function () {
|
||||||
Auth::routes(
|
Auth::routes(
|
||||||
|
|
@ -37,7 +37,7 @@ Route::prefix('bo')
|
||||||
Route::middleware(['admin-secure', 'auth:backend'])->group(function () {
|
Route::middleware(['admin-secure', 'auth:backend'])->group(function () {
|
||||||
Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
|
Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
|
||||||
|
|
||||||
// * USERS.
|
// * USERS
|
||||||
Route::resource('users', UserController::class)->except('show');
|
Route::resource('users', UserController::class)->except('show');
|
||||||
Route::patch('/users/{user}/change-published', [
|
Route::patch('/users/{user}/change-published', [
|
||||||
UserController::class, 'changePublished'
|
UserController::class, 'changePublished'
|
||||||
|
|
@ -46,7 +46,7 @@ Route::prefix('bo')
|
||||||
UserController::class, 'duplicate'
|
UserController::class, 'duplicate'
|
||||||
])->name('users.duplicate');
|
])->name('users.duplicate');
|
||||||
|
|
||||||
// * StaticPages
|
// * STATIC PAGES
|
||||||
Route::resource('pages', StaticPageController::class)
|
Route::resource('pages', StaticPageController::class)
|
||||||
->names([
|
->names([
|
||||||
'index' => 'static_pages.index',
|
'index' => 'static_pages.index',
|
||||||
|
|
@ -57,7 +57,7 @@ Route::prefix('bo')
|
||||||
->withoutMiddleware('htmlsanitize')
|
->withoutMiddleware('htmlsanitize')
|
||||||
->middleware(['htmlsanitize:content']);
|
->middleware(['htmlsanitize:content']);
|
||||||
|
|
||||||
// * PICTOS.
|
// * PICTOS
|
||||||
Route::resource('pictos', PictoController::class)->except('show');
|
Route::resource('pictos', PictoController::class)->except('show');
|
||||||
Route::patch('/pictos/{picto}/change-published', [
|
Route::patch('/pictos/{picto}/change-published', [
|
||||||
PictoController::class, 'changePublished'
|
PictoController::class, 'changePublished'
|
||||||
|
|
@ -83,7 +83,7 @@ Route::prefix('bo')
|
||||||
ProductController::class, 'duplicate'
|
ProductController::class, 'duplicate'
|
||||||
])->name('products.duplicate');
|
])->name('products.duplicate');
|
||||||
|
|
||||||
// * LOCAL_COMMITMENTS
|
// * LOCAL COMMITMENTS
|
||||||
Route::resource('localcommitments', LocalCommitmentController::class)->except('show')
|
Route::resource('localcommitments', LocalCommitmentController::class)->except('show')
|
||||||
->parameters(['localcommitments' => 'local_commitment'])
|
->parameters(['localcommitments' => 'local_commitment'])
|
||||||
->withoutMiddleware('htmlsanitize')
|
->withoutMiddleware('htmlsanitize')
|
||||||
|
|
@ -145,10 +145,10 @@ Route::prefix('bo')
|
||||||
->only(['edit', 'update']);
|
->only(['edit', 'update']);
|
||||||
|
|
||||||
Route::middleware('can:isConceptor')->group(function () {
|
Route::middleware('can:isConceptor')->group(function () {
|
||||||
// * ACTIVITY LOGS.
|
// * ACTIVITY LOGS
|
||||||
Route::resource('activity_logs', ActivityLogController::class)->only(['index', 'show']);
|
Route::resource('activity_logs', ActivityLogController::class)->only(['index', 'show']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// * Others routes
|
// * OTHERS ROUTES
|
||||||
Route::post('theme/set', [Controller::class, 'setTheme'])->name('theme.set');
|
Route::post('theme/set', [Controller::class, 'setTheme'])->name('theme.set');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue