ProcessRepository::editProcess()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Adminetic\Website\Repositories;
4
5
use Adminetic\Website\Contracts\ProcessRepositoryInterface;
6
use Adminetic\Website\Http\Requests\ProcessRequest;
7
use Adminetic\Website\Models\Admin\Process;
8
use Illuminate\Support\Facades\Cache;
9
10
class ProcessRepository implements ProcessRepositoryInterface
11
{
12
    // Process Index
13
    public function indexProcess()
14
    {
15
        $processes = config('adminetic.caching', true)
16
            ? (Cache::has('processes') ? Cache::get('processes') : Cache::rememberForever('processes', function () {
17
                return Process::orderBy('position')->get();
18
            }))
19
            : Process::orderBy('position')->get();
20
21
        return compact('processes');
22
    }
23
24
    // Process Create
25
    public function createProcess()
26
    {
27
        //
28
    }
29
30
    // Process Store
31
    public function storeProcess(ProcessRequest $request)
32
    {
33
        Process::create($request->validated());
34
    }
35
36
    // Process Show
37
    public function showProcess(Process $process)
38
    {
39
        return compact('process');
40
    }
41
42
    // Process Edit
43
    public function editProcess(Process $process)
44
    {
45
        return compact('process');
46
    }
47
48
    // Process Update
49
    public function updateProcess(ProcessRequest $request, Process $process)
50
    {
51
        $process->update($request->validated());
52
    }
53
54
    // Process Destroy
55
    public function destroyProcess(Process $process)
56
    {
57
        $process->delete();
58
    }
59
}
60