1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-19 04:50:42 +01:00
openstamanager/src/Base/Description.php

31 lines
585 B
PHP
Raw Normal View History

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
}