TestimonialsDataTable::getColumns()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Testimonials\DataTables\Managerarea;
6
7
use Cortex\Testimonials\Models\Testimonial;
8
use Cortex\Foundation\DataTables\AbstractDataTable;
9
use Cortex\Testimonials\Transformers\Managerarea\TestimonialTransformer;
10
11
class TestimonialsDataTable extends AbstractDataTable
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    protected $model = Testimonial::class;
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    protected $transformer = TestimonialTransformer::class;
22
23
    /**
24
     * Get columns.
25
     *
26
     * @return array
27
     */
28
    protected function getColumns(): array
29
    {
30
        $link = config('cortex.foundation.route.locale_prefix')
31
            ? '"<a href=\""+routes.route(\'managerarea.testimonials.edit\', {testimonial: full.id, locale: \''.$this->request->segment(1).'\'})+"\">"+data+"</a>"'
32
            : '"<a href=\""+routes.route(\'managerarea.testimonials.edit\', {testimonial: full.id})+"\">"+data+"</a>"';
33
34
        return [
35
            'body' => ['title' => trans('cortex/testimonials::common.body'), 'render' => $link.'+(full.is_approved ? " <i class=\"text-success fa fa-check\"></i>" : " <i class=\"text-danger fa fa-close\"></i>")', 'responsivePriority' => 0],
36
            'created_at' => ['title' => trans('cortex/testimonials::common.created_at'), 'render' => "moment(data).format('YYYY-MM-DD, hh:mm:ss A')"],
37
            'updated_at' => ['title' => trans('cortex/testimonials::common.updated_at'), 'render' => "moment(data).format('YYYY-MM-DD, hh:mm:ss A')"],
38
        ];
39
    }
40
}
41