Passed
Pull Request — master (#83)
by Ron
25:57
created

SetFileLinkDetails::setLinkInstructions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 10
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