Passed
Push — master ( 1d6d9a...2a90e7 )
by Ron
02:47 queued 12s
created

SetFileLinkDetails   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 25
ccs 13
cts 13
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 11 1
A setLinkInstructions() 0 8 1
1
<?php
2
3
namespace App\Domains\FileLinks;
4
5
use Illuminate\Support\Facades\Log;
6
use Illuminate\Support\Facades\Auth;
7
8
use App\FileLinks;
9
10
use App\Http\Requests\UpdateFileLinkRequest;
11
use App\Http\Requests\UpdateFileLinkInstructionsRequest;
12
13
class SetFileLinkDetails
14
{
15
    //  Execute will process an uploading file
16 2
    public function execute(UpdateFileLinkRequest $request, $linkID)
17
    {
18 2
        $linkData = FileLinks::find($linkID)->update([
19 2
            'link_name'    => $request->name,
20 2
            'expire'       => $request->expire,
21 2
            'allow_upload' => $request->allowUp,
22 2
            'cust_id'      => $request->customerID,
23
        ]);
24
25 2
        Log::info('File Link ID '.$linkID.' has been updated by '.Auth::user()->full_name.'.  Link Data - ', array($linkData));
26 2
        return true;
27
    }
28
29
    //  Update only the instructions attached to the link
30 2
    public function setLinkInstructions(UpdateFileLinkInstructionsRequest $request, $linkID)
31
    {
32 2
        FileLinks::find($linkID)->update([
33 2
            'note' => $request->instructions,
34
        ]);
35
36 2
        Log::info('Instructions for File Link ID '.$linkID.' have been updated by '.Auth::user()->full_name.'.  Instruction Details - ', array($request));
37 2
        return true;
38
    }
39
}
40