Repository URL to install this package:
|
Version:
0.2.1 ▾
|
<?php
/**
* Created by PhpStorm.
* User: danilo
* Date: 18/12/15
* Time: 16:47
*/
namespace Modules\Students\Transformers;
use League\Fractal\TransformerAbstract;
use Modules\Core\Utils\NameFormat;
use Modules\Students\Entities\Student;
use \Html;
class StudentsDatatableTransformer extends TransformerAbstract {
public function transform(Student $model)
{
$showBtn = [
'href' => route('questions.index', [$model->id]),
'class' => 'btn btn-primary btn-xs'
];
$editBtn = [
'href' => route('students.edit', [$model->id]),
'class' => 'btn btn-primary btn-xs'
];
$deletBtn = [
'href' => route('students.destroy', [$model->id]),
'class' => 'btn btn-danger btn-xs confirm-delete'
];
$data = [
'id' => (int) $model->id,
'full_name' => $model->full_name,
'country' => $model->country,
'email' => $model->email,
'is_active' => (boolean) $model->is_active ? Html::icon('check') : Html::icon('remove'),
'action' => Html::linkWithIcon(trans('students::students.actions_btn.edit'), 'pencil', $editBtn).' '.
Html::linkWithIcon(trans('students::students.actions_btn.delete'), 'trash', $deletBtn)
];
return $data;
}
}