Ticket852

This commit is contained in:
Jérémy Munsch 2022-05-05 13:05:02 +00:00 • committed by Vincent BRIDIER
parent cfb576157e
commit 5989c04414
3 changed files with 27 additions and 6 deletions

View file

@ -10,11 +10,21 @@ class SubRange extends Model
{
use HasFactory;
/**
* The model's attributes.
*
* @var array
*/
protected $attributes = [
'back_link_url' => '',
'back_link_text' => ''
];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'picture_alt',
'back_link_url', 'back_link_text',
@ -22,20 +32,28 @@ class SubRange extends Model
'subtitle', 'content'
];
/**
* Perform any actions required after the model boots.
*
* @return void
*/
protected static function booted()
{
static::creating(function (SubRange $subRange) {
$subRange->title = clean($subRange->title);
$subRange->content = clean($subRange->content);
$subRange->slug = Str::slug($subRange->name);
});
static::updating(function (SubRange $subRange) {
$subRange->title = clean($subRange->title);
$subRange->content = clean($subRange->content);
$subRange->slug = Str::slug($subRange->name);
});
}
/**
* BelongsToMany ranges relation
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function ranges()
{
return $this->belongsToMany(Range::class, 'range_sub_range');

2
package-lock.json generated
View file

@ -1,5 +1,5 @@
{
"name": "srcs",
"name": "legaulois2020",
"lockfileVersion": 2,
"requires": true,
"packages": {

9
resources/js/app.js vendored
View file

@ -9,6 +9,8 @@ require('vue-select-image/dist/vue-select-image.css');
let bootstrap = require('bootstrap');
require('bootstrap/js/dist/tooltip');
import bsCustomFileInput from 'bs-custom-file-input'
import Vue from 'vue'
window.Vue = Vue
$(document).ready(function () {
bsCustomFileInput.init()
@ -25,10 +27,11 @@ if (window.vueDebug) {
Vue.config.debug = true;
}
window.Vue = require('vue/dist/vue.min.js');
import VueSelectImage from 'vue-select-image';
import VueSelectImage from 'vue-select-image'
// ES6 Modules or TypeScript
import Swal from 'sweetalert2';
import Swal from 'sweetalert2'
// bootstrap styling
window.Swal = Swal.mixin({