Created
October 27, 2020 05:25
-
-
Save saber13812002/896417b374ec3c69bddd25cb344e6759 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Set empty nullable fields to null | |
* @param object $model | |
*/ | |
protected static function setNullables(object $model): void | |
{ | |
foreach ($model->nullable as $field) { | |
if (empty($model->{$field})) { | |
$model->{$field} = null; | |
} | |
} | |
} | |
public function wasDeleted() | |
{ | |
return !($this->deleted_at == null); | |
} |
Author
saber13812002
commented
Oct 27, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment