Return is_filterable for subactivity
This commit is contained in:
parent
f12a83b849
commit
4cb2dddb43
|
@ -49,7 +49,7 @@ class ActivityResource extends JsonResource
|
||||||
public static function meta(): array
|
public static function meta(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'subactivities' => Subactivity::select('name', 'id')->get(),
|
'subactivities' => Subactivity::select('name', 'id', 'is_filterable')->get(),
|
||||||
'filter' => ActivityFilterScope::fromRequest(request()->input('filter')),
|
'filter' => ActivityFilterScope::fromRequest(request()->input('filter')),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ class Subactivity extends Model
|
||||||
|
|
||||||
public $casts = [
|
public $casts = [
|
||||||
'is_age_group' => 'boolean',
|
'is_age_group' => 'boolean',
|
||||||
|
'is_filterable' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function sluggable(): array
|
public function sluggable(): array
|
||||||
|
|
|
@ -14,7 +14,7 @@ class EditTest extends TestCase
|
||||||
public function testItEditsAnActivity(): void
|
public function testItEditsAnActivity(): void
|
||||||
{
|
{
|
||||||
$this->login()->loginNami()->withoutExceptionHandling();
|
$this->login()->loginNami()->withoutExceptionHandling();
|
||||||
$activity = Activity::factory()->name('Asas')->hasAttached(Subactivity::factory()->name('Pupu'))->create();
|
$activity = Activity::factory()->name('Asas')->hasAttached(Subactivity::factory()->name('Pupu')->filterable())->create();
|
||||||
|
|
||||||
$response = $this->get(route('activity.edit', ['activity' => $activity]));
|
$response = $this->get(route('activity.edit', ['activity' => $activity]));
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ class EditTest extends TestCase
|
||||||
$this->assertInertiaHas([
|
$this->assertInertiaHas([
|
||||||
'id' => $activity->subactivities->first()->id,
|
'id' => $activity->subactivities->first()->id,
|
||||||
'name' => 'Pupu',
|
'name' => 'Pupu',
|
||||||
|
'is_filterable' => true,
|
||||||
], $response, 'meta.subactivities.0');
|
], $response, 'meta.subactivities.0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue