Code Duplication    Length = 46-46 lines in 2 locations

src/Requests/StoreBed.php 1 location

@@ 7-52 (lines=46) @@
4
5
use Illuminate\Foundation\Http\FormRequest;
6
7
class StoreBed extends FormRequest
8
{
9
    /**
10
    * Determine if the user is authorized to make this request.
11
    *
12
    * @return bool
13
    */
14
    public function authorize()
15
    {
16
        return true;
17
    }
18
19
    /**
20
    * Get the validation rules that apply to the request.
21
    *
22
    * @return array
23
    */
24
    public function rules()
25
    {
26
        return [
27
            'ruang_id' => 'required',
28
            'kode_bed' => 'required',
29
30
        ];
31
    }
32
33
    public function messages()
34
    {
35
        $messages = [
36
            'ruang_id.required' => 'Nama Ruangan belum di pilih',
37
            'kode_bed.required' => 'Kode Tempat Tidur Masih Kosong'
38
        ];
39
40
        if ('PATCH' === $this->method()){
41
42
            $messages = [
43
                'ruang_id.required' => 'Nama Ruangan belum di pilih',
44
                'kode_bed.required' => 'Kode Tempat Tidur tidak boleh kosong'
45
46
            ];
47
48
        }
49
50
        return $messages;
51
    }
52
}
53

src/Requests/UpdateBed.php 1 location

@@ 7-52 (lines=46) @@
4
5
use Illuminate\Foundation\Http\FormRequest;
6
7
class UpdateBed extends FormRequest
8
{
9
    /**
10
    * Determine if the user is authorized to make this request.
11
    *
12
    * @return bool
13
    */
14
    public function authorize()
15
    {
16
        return true;
17
    }
18
19
    /**
20
    * Get the validation rules that apply to the request.
21
    *
22
    * @return array
23
    */
24
    public function rules()
25
    {
26
        return [
27
28
29
            'kode_bed' => 'required',
30
            'ruang_id' => 'required',
31
        ];
32
    }
33
34
    public function messages()
35
    {
36
        $messages = [
37
          'ruang_id.required' => 'Kelas Rawah Inap belum di pilih',
38
            'kode_bed.required' => 'Kode Tempat Tidur Masih Kosong'
39
        ];
40
41
        if ('PATCH' === $this->method()){
42
43
            $messages = [
44
              'ruang_id.required' => 'Nama Ruangan belum di pilih',
45
                'kode_bed.required' => 'Kode Tempat Tidur tidak boleh kosong'
46
            ];
47
48
        }
49
50
        return $messages;
51
    }
52
}
53