ldc-bogt/app/Models/Eleveur.php

81 lines
1.6 KiB
PHP
Raw Normal View History

2019-12-04 17:30:46 +01:00
<?php
2022-03-08 11:40:52 +01:00
namespace App\Models;
2019-12-04 17:30:46 +01:00
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
2022-03-08 09:42:26 +01:00
2019-12-04 17:30:46 +01:00
class Eleveur extends Model
{
use SoftDeletes;
2020-07-20 11:20:46 +02:00
2022-03-08 11:40:52 +01:00
/**
* Indicates if the model should be timestamped.
*
* @var boolean
*/
2019-12-04 17:30:46 +01:00
public $timestamps = false;
2022-03-08 09:42:26 +01:00
2019-12-04 17:30:46 +01:00
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
2020-07-20 11:20:46 +02:00
'code_cafel',
2020-01-29 11:07:08 +01:00
'code_ede',
2020-07-20 11:20:46 +02:00
'civilite',
'nom',
'prenom',
'naissance',
'cp',
'ville',
'elv_date_debut',
'code_inuav',
'exploitation',
'aboutyou',
'vocation',
'likeinjob',
2019-12-04 17:30:46 +01:00
'loue_means',
'path_photo1',
2020-07-20 11:20:46 +02:00
'path_photo2',
'marquage_oeuf',
'marquage_b1',
'marquage_b2'
2019-12-04 17:30:46 +01:00
];
2022-03-08 09:42:26 +01:00
2019-12-04 17:30:46 +01:00
/**
2022-03-08 09:42:26 +01:00
* @var string
*/
2019-12-04 17:30:46 +01:00
protected $table = 'eleveurs';
2020-01-30 17:01:44 +01:00
2022-03-08 11:40:52 +01:00
/**
* The accessors to append to the model's array form.
*
* @var array
*/
2020-01-30 17:01:44 +01:00
protected $appends = ['questions'];
2022-03-08 11:40:52 +01:00
/**
* Questions attribute accessor
*
* @return boolean
*/
public function getQuestionsAttribute(): bool
2022-03-08 09:42:26 +01:00
{
if ($this->aboutyou != null && $this->aboutyou != '') {
2020-01-30 17:01:44 +01:00
return true;
}
2022-03-08 09:42:26 +01:00
if ($this->vocation != null && $this->vocation != '') {
2020-01-30 17:01:44 +01:00
return true;
}
2022-03-08 09:42:26 +01:00
if ($this->likeinjob != null && $this->likeinjob != '') {
2020-01-30 17:01:44 +01:00
return true;
}
2022-03-08 09:42:26 +01:00
if ($this->loue_means != null && $this->loue_means != '') {
2020-01-30 17:01:44 +01:00
return true;
}
return false;
}
2019-12-04 17:30:46 +01:00
}