Completed
Push — master ( aec46e...b9d3b7 )
by Martin
11:50
created

StartController::index()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 3
eloc 3
c 2
b 0
f 0
nc 2
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Setting;
6
use Illuminate\Http\Request;
7
use Illuminate\Support\Facades\Auth;
8
use Illuminate\Support\Facades\Storage;
9
10
class StartController extends Controller
11
{
12
    /**
13
     * Redirect the browser to the appropriate shop site
14
     */
15
    public function index(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

15
    public function index(/** @scrutinizer ignore-unused */ Request $request)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
    {
17
        if (Auth::user() != null && Auth::user()->hasPermission('SELL_TICKETS')) {
18
            return redirect()->route('retail.sell.events');
19
        }
20
21
        return redirect()->route('ts.events');
22
    }
23
24
    /**
25
     * Change the current locale to the given value
26
     */
27
    public function changeLocale($locale)
28
    {
29
        session(['locale' => $locale]);
30
        return redirect()->back();
31
    }
32
33
    /**
34
     * Return the currently stored logo
35
     */
36
    public function getLogo()
37
    {
38
        $logo = Setting::where('name', 'logo')->first();
39
        if( $logo ) {
40
            return response()->file(Storage::path($logo->value));
41
        } else {
42
            return redirect(asset('img/logos/fa-ticket.png'));
43
        }
44
    }
45
}
46