Delete::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Itstructure\GridView\Actions;
4
5
/**
6
 * Class Delete.
7
 * @package Itstructure\GridView\Actions
8
 */
9
class Delete extends BaseAction
10
{
11
    const ACTION = 'delete';
12
13
    /**
14
     * @param $row
15
     * @param int $bootstrapColWidth
16
     * @return array|string
17
     */
18
    public function render($row, int $bootstrapColWidth = BaseAction::BOOTSTRAP_COL_WIDTH)
19
    {
20
        return view('grid_view::actions.'.self::ACTION, [
21
            'url' => $this->getUrl($row),
22
            'bootstrapColWidth' => $bootstrapColWidth,
23
            'htmlAttributes' => $this->buildHtmlAttributes()
24
        ])->render();
25
    }
26
27
    /**
28
     * @param $row
29
     * @return string
30
     */
31
    protected function buildUrl($row)
32
    {
33
        return $this->getCurrentUrl() . '/' . $row->id . '/' . self::ACTION;
34
    }
35
}
36