WidgetController::setLocalesAttributes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
nc 1
nop 1
dl 0
loc 4
c 0
b 0
f 0
cc 1
rs 10
1
<?php
2
3
namespace Diglabby\Doika\Http\Controllers\Widget;
4
5
use App\Http\Controllers\Controller;
6
use Illuminate\Contracts\Support\Renderable;
7
use Illuminate\Support\Facades\View;
8
9
class WidgetController extends Controller
10
{
11
    public function index(): Renderable
12
    {
13
        return view('widget.campaign');
14
    }
15
16
    /**
17
     * Push attributes in order to correctly localize slugs.
18
     *
19
     * @param $attributes
20
     */
21
    protected function setLocalesAttributes($attributes)
22
    {
23
        View::composer(['partials.alternates', 'partials.locales'], function (\Illuminate\View\View $view) use ($attributes) {
24
            $view->withAttributes($attributes);
25
        });
26
    }
27
28
    /**
29
     * Push translatable object in order to correctly localize slugs.
30
     *
31
     * @param $translatable
32
     */
33
    protected function setTranslatable($translatable)
34
    {
35
        View::composer(['partials.alternates', 'partials.locales'], function (\Illuminate\View\View $view) use ($translatable) {
36
            $view->withTranslatable($translatable);
37
        });
38
    }
39
}
40