From aa604b7056170552f36f7a4e39406dfa03092a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Mon, 27 Jul 2020 13:08:26 +0300 Subject: [PATCH] added cast for enabled field --- app/Abstracts/Model.php | 4 ++++ app/Models/Auth/User.php | 9 +++++++++ app/Models/Common/Company.php | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/app/Abstracts/Model.php b/app/Abstracts/Model.php index 951a5963f..f2fd309ea 100644 --- a/app/Abstracts/Model.php +++ b/app/Abstracts/Model.php @@ -18,6 +18,10 @@ abstract class Model extends Eloquent protected $dates = ['deleted_at']; + protected $casts = [ + 'enabled' => 'boolean', + ]; + /** * The "booting" method of the model. * diff --git a/app/Models/Auth/User.php b/app/Models/Auth/User.php index be1268dcf..f8c7e94e0 100644 --- a/app/Models/Auth/User.php +++ b/app/Models/Auth/User.php @@ -42,6 +42,15 @@ class User extends Authenticatable */ protected $dates = ['last_logged_in_at', 'created_at', 'updated_at', 'deleted_at']; + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = [ + 'enabled' => 'boolean', + ]; + /** * Sortable columns. * diff --git a/app/Models/Common/Company.php b/app/Models/Common/Company.php index 2da164874..32390caa6 100644 --- a/app/Models/Common/Company.php +++ b/app/Models/Common/Company.php @@ -21,6 +21,10 @@ class Company extends Eloquent protected $fillable = ['domain', 'enabled']; + protected $casts = [ + 'enabled' => 'boolean', + ]; + /** * Sortable columns. *