From cf7f36c9505c65c68f178b037c6d26fa0440cd1c Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 22 Mar 2020 13:57:31 -0700 Subject: [PATCH] Always include the tasks with a schedule --- app/Models/Schedule.php | 7 +++++++ app/Transformers/Api/Client/ScheduleTransformer.php | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index 44bed1213..21cad0e59 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -40,6 +40,13 @@ class Schedule extends Validable */ protected $table = 'schedules'; + /** + * Always return the tasks associated with this schedule. + * + * @var array + */ + protected $with = ['tasks']; + /** * Mass assignable attributes on this model. * diff --git a/app/Transformers/Api/Client/ScheduleTransformer.php b/app/Transformers/Api/Client/ScheduleTransformer.php index 2c2bbb85b..43e35ed42 100644 --- a/app/Transformers/Api/Client/ScheduleTransformer.php +++ b/app/Transformers/Api/Client/ScheduleTransformer.php @@ -13,6 +13,11 @@ class ScheduleTransformer extends BaseClientTransformer */ protected $availableIncludes = ['tasks']; + /** + * @var array + */ + protected $defaultIncludes = ['tasks']; + /** * {@inheritdoc} */