FamilyEventForm   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A edit() 0 3 1
A __construct() 0 3 1
A create() 0 3 1
1
<?php
2
3
namespace App\Forms\Builders;
4
5
use App\Models\Family;
6
use App\Models\FamilyEvent;
7
use App\Models\Place;
8
use LaravelEnso\Forms\Services\Form;
9
10
class FamilyEventForm
11
{
12
    protected const TemplatePath = __DIR__.'/../Templates//familyEvent.json';
13
14
    protected Form $form;
15
16
    public function __construct()
17
    {
18
        $this->form = new Form(static::TemplatePath);
19
    }
20
21
    public function create()
22
    {
23
        return $this->form->options('family_id', Family::all())->options('place_id', Place::all())->create();
24
        // return $this->form->options(['family_id' => Family::all(), 'place_id' => Place::all()])->create();
25
    }
26
27
    public function edit(FamilyEvent $familyEvent)
28
    {
29
        return $this->form->options('family_id', Family::all())->options('place_id', Place::all())->edit($familyEvent);
30
        // return $this->form->options(['family_id' => Family::all(), 'place_id' => Place::all()])->edit($familyEvent);
31
    }
32
}
33