Removed show_title form static pages
This commit is contained in:
parent
bb2b637fa9
commit
e365eb5f5e
4 changed files with 49 additions and 27 deletions
|
|
@ -45,7 +45,6 @@ class StoreStaticPageRequest extends FormRequest
|
|||
$this->mergePicture('banner');
|
||||
$this->merge([
|
||||
'value' => $this->value ? $this->value : '',
|
||||
'show_title' => $this->show_title ? true : false,
|
||||
'show_banner' => $this->show_banner ? true : false
|
||||
]);
|
||||
}
|
||||
|
|
@ -59,7 +58,6 @@ class StoreStaticPageRequest extends FormRequest
|
|||
{
|
||||
return \array_merge([
|
||||
'title' => 'required|string|min:3|max:255',
|
||||
'show_title' => 'required|boolean',
|
||||
'show_banner' => 'required|boolean',
|
||||
'value' => 'present|string|min:0'
|
||||
], $this->pictureRules(
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ class StaticPage extends Model
|
|||
protected $casts = [
|
||||
'date_start' => 'datetime',
|
||||
'date_end' => 'datetime',
|
||||
'show_title' => 'bool',
|
||||
'show_banner' => 'bool'
|
||||
];
|
||||
|
||||
|
|
@ -45,7 +44,6 @@ class StaticPage extends Model
|
|||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'show_title',
|
||||
'show_banner',
|
||||
'value',
|
||||
'banner'
|
||||
|
|
@ -61,10 +59,10 @@ class StaticPage extends Model
|
|||
// * EVENT CLOSURES.
|
||||
static::creating(function (self $model) {
|
||||
if (!$model->type->equals(StaticPageType::crud())) {
|
||||
throw new \RuntimeException('Impossible de créer :model de type autre que :type.', [
|
||||
throw new \RuntimeException(__('Impossible de créer :model de type autre que :type.', [
|
||||
'model' => \trans('models.classes.static_pages'),
|
||||
'type' => StaticPageType::crud()->label
|
||||
]);
|
||||
]));
|
||||
}
|
||||
// * ASSERTIONS
|
||||
static::assertTitleIsUnique($model->title);
|
||||
|
|
@ -95,10 +93,10 @@ class StaticPage extends Model
|
|||
});
|
||||
static::deleting(function (self $model) {
|
||||
if (!$model->type->equals(StaticPageType::crud())) {
|
||||
throw new \RuntimeException('Impossible de supprimer :model de type autre que :type.', [
|
||||
throw new \RuntimeException(__('Impossible de supprimer :model de type autre que :type.', [
|
||||
'model' => \trans('models.classes.static_pages'),
|
||||
'type' => StaticPageType::crud()->label
|
||||
]);
|
||||
]));
|
||||
}
|
||||
});
|
||||
static::deleted(function (self $model) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RemoveShowTitleFromStaticPagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('static_pages', function (Blueprint $table) {
|
||||
$table->dropColumn('show_title');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('static_pages', function (Blueprint $table) {
|
||||
$table->boolean('show_title')->after('title')
|
||||
->comment('Afficher le titre ?');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{{-- TITLE --}}
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<div class="col-12 col-lg-6">
|
||||
@include('back::partials.inputs.varchar', [
|
||||
'id' => 'staticPageTitle',
|
||||
'hasWordCounter' => true,
|
||||
|
|
@ -9,26 +9,16 @@
|
|||
'model' => $static_pageModel ?? null,
|
||||
'required' => false,
|
||||
'placeholder' => __('Un titre beau et explicite'),
|
||||
'helper' => __('Doit décrire précisément la page')
|
||||
])
|
||||
</div>
|
||||
<div class="col">
|
||||
@include('back::partials.inputs.tinyint-boolean', [
|
||||
'id' => 'staticPageShowTitle',
|
||||
'label' => __('Afficher le titre'),
|
||||
'name' => 'show_title',
|
||||
'model' => $static_pageModel ?? null,
|
||||
'required' => false,
|
||||
'helper' => __('Afficher en front le titre de la page ou non')
|
||||
'helper' => __('Doit décrire précisément la page'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- BANNER --}}
|
||||
<fieldset class="border p-3 mb-3">
|
||||
<fieldset class="mb-3 border p-3">
|
||||
<div class="row mb-1">
|
||||
<div class="col">
|
||||
<label for="bannerInput" class="form-label"><span class="h4">{{ __('Image bannière de la page') }}</span></label>
|
||||
<label class="form-label" for="bannerInput"><span class="h4">{{ __('Image bannière de la page') }}</span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-end">
|
||||
|
|
@ -39,7 +29,7 @@
|
|||
'name' => 'show_banner',
|
||||
'model' => $static_pageModel ?? null,
|
||||
'required' => false,
|
||||
'helper' => __('Afficher en front la banniere de la page ou non')
|
||||
'helper' => __('Afficher en front la banniere de la page ou non'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -52,9 +42,12 @@
|
|||
'height' => Config::get('theme.models.static_pages.banner_maxheight'),
|
||||
'required' => false,
|
||||
'model' => $static_pageModel ?? null,
|
||||
'helper' => __('L\'image qui va servir de bannière pour la page, format de référence : :width px max de large et :height px max de hauteur.', [
|
||||
'width' => Config::get('theme.models.static_pages.banner_maxwidth'), 'height' => Config::get('theme.models.static_pages.banner_maxheight')
|
||||
]),
|
||||
'helper' => __(
|
||||
'L\'image qui va servir de bannière pour la page, format de référence : :width px max de large et :height px max de hauteur.',
|
||||
[
|
||||
'width' => Config::get('theme.models.static_pages.banner_maxwidth'),
|
||||
'height' => Config::get('theme.models.static_pages.banner_maxheight'),
|
||||
]),
|
||||
'required' => true,
|
||||
'preview' => true,
|
||||
])
|
||||
|
|
@ -63,7 +56,7 @@
|
|||
</fieldset>
|
||||
|
||||
{{-- TEXT --}}
|
||||
<fieldset class="border p-3 mb-3">
|
||||
<fieldset class="mb-3 border p-3">
|
||||
<legend><label class="h4" for="pageText">{{ __('Contenu de la page') }} *</label></legend>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue