Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
webbingbrasil/students-module / Transformers / StudentsDatatableTransformer.php
Size: Mime:
<?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;
    }
}