2018-09-25 16:47:44 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Base;
|
|
|
|
|
2018-09-25 17:13:23 +02:00
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
|
2018-09-25 16:47:44 +02:00
|
|
|
abstract class Description extends Model
|
|
|
|
{
|
2018-09-26 12:20:06 +02:00
|
|
|
protected static function boot($bypass = false)
|
2018-09-25 16:47:44 +02:00
|
|
|
{
|
|
|
|
parent::boot();
|
|
|
|
|
2018-09-26 12:06:24 +02:00
|
|
|
if (!$bypass) {
|
|
|
|
static::addGlobalScope('descriptions', function (Builder $builder) {
|
|
|
|
$builder->where('is_descrizione', '=', 0);
|
|
|
|
});
|
|
|
|
}
|
2018-09-25 16:47:44 +02:00
|
|
|
}
|
2018-09-26 15:37:46 +02:00
|
|
|
|
2018-10-02 18:25:52 +02:00
|
|
|
public static function make($bypass = false)
|
2018-09-26 15:37:46 +02:00
|
|
|
{
|
2018-10-02 18:25:52 +02:00
|
|
|
$model = parent::make();
|
2018-09-26 15:37:46 +02:00
|
|
|
|
|
|
|
if (!$bypass) {
|
|
|
|
$model->is_descrizione = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $model;
|
|
|
|
}
|
2018-09-25 16:47:44 +02:00
|
|
|
}
|