Test Failed
Push — master ( 262e91...d4bdb3 )
by Marcel
04:20
created

SubmitController::logo_add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 23
rs 9.0856
cc 1
eloc 15
nc 1
nop 1
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Events\Obyx;
6
use App\Models\Logo;
7
use App\Models\User;
8
use Illuminate\Http\Request;
9
use Illuminate\Support\Facades\Input;
10
use Illuminate\Support\Facades\Storage;
11
use Illuminate\Support\Facades\File;
12
use Illuminate\Http\Response;
13
use Illuminate\Http\UploadedFile;
14
15
class SubmitController extends Controller
16
{
17
    public function index() {
18
        //Zeige Submit View
19
        return view('submit.index');
20
    }
21
22
    public function logo_index() {
23
        //Zeige View zum Einsenden eines Logos
24
        return view('submit.logo.index');
25
    }
26
27
    public function logo_add(Request $request) {
28
        $this->validate($request, [
29
            'file' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
30
            'logoname' => 'required',
31
        ]);
32
33
        $file = $request->file('file');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
34
        $extorig = $file->getExtension();
35
36
        $imageName = \Storage::putFile('logos', new UploadedFile($file->path(), $file->getClientOriginalName()));
37
        //dd($file);
38
39
        $l = new Logo;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 12 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
40
        $l->extension = \Storage::mimeType($imageName);
41
        $l->filename = str_replace($extorig, '', $imageName);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
42
        $l->title = $request->get('logoname');
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
43
        $l->user_id = \Auth::id();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
44
        $l->save();
45
46
        event(new Obyx('logo-add', \Auth::id()));
47
48
        return redirect()->route('submit.logo.success');
49
    }
50
51
}
52