| 1 | <?php |
||
| 2 | |||
| 3 | namespace Bavix\Entry\Models; |
||
| 4 | |||
| 5 | use Bavix\LaravelClickHouse\Database\Eloquent\Model; |
||
| 6 | use Bavix\Entry\Services\BulkService; |
||
| 7 | |||
| 8 | abstract class Entry extends Model |
||
| 9 | { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @inheritDoc |
||
| 13 | */ |
||
| 14 | public function save(array $options = []): bool |
||
| 15 | { |
||
| 16 | if (\config('entry.saveViaQueue', false)) { |
||
| 17 | return \app(BulkService::class)->insert($this); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 18 | } |
||
| 19 | |||
| 20 | foreach ($this->getAttributes() as $column => $value) { |
||
| 21 | if ($value === null) { |
||
| 22 | $this->$column = raw('NULL'); |
||
| 23 | } |
||
| 24 | } |
||
| 25 | |||
| 26 | return parent::save($options); |
||
| 27 | } |
||
| 28 | |||
| 29 | } |
||
| 30 |