Completed
Push — master ( 8f08c7...7bd638 )
by Mohamed
02:25
created

LanguageController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 2
1
<?php
2
3
namespace Microboard\Http\Controllers;
4
5
use Illuminate\Http\RedirectResponse;
6
use Illuminate\Http\Request;
7
8
class LanguageController extends Controller
9
{
10
    /**
11
     * Handle the incoming request.
12
     *
13
     * @param Request $request
14
     * @param $code
15
     * @return RedirectResponse
16
     */
17
    public function __invoke(Request $request, $code)
18
    {
19
        if (in_array($code, collect(config('microboard.localizations', []))->pluck('code')->all())) {
20
            app()->setLocale($code);
21
            session()->put('locale', $code);
22
        }
23
24
        return redirect()->back();
25
    }
26
}
27