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/exams-module / Transformers / QuestionsDatatableTransformer.php
Size: Mime:
<?php
/**
 * Created by PhpStorm.
 * User: danilo
 * Date: 18/12/15
 * Time: 16:47
 */
namespace Modules\Exams\Transformers;

use League\Fractal\TransformerAbstract;
use Modules\Exams\Entities\Question;
use \Html;

class QuestionsDatatableTransformer extends TransformerAbstract {

    public function transform(Question $model)
    {

        $showBtn = [
            'href' => route('questions.index', [$model->exam_id, $model->id]),
            'class' => 'btn btn-primary btn-xs'
        ];

        $editBtn = [
            'href' => route('questions.edit', [$model->exam_id, $model->id]),
            'class' => 'btn btn-primary btn-xs'
        ];

        $deletBtn = [
            'href' => route('questions.destroy', [$model->exam_id, $model->id]),
            'class' => 'btn btn-danger btn-xs confirm-delete'
        ];
        $data = [
            'id'     => (int) $model->id,
            'title' => $model->title,
            'is_active' => (boolean) $model->is_active ? Html::icon('check') : Html::icon('remove'),
            'action' => Html::linkWithIcon(trans('exams::exams.actions_btn.edit'), 'pencil', $editBtn).' '.
                        Html::linkWithIcon(trans('exams::exams.actions_btn.delete'), 'trash', $deletBtn)
        ];

        return $data;
    }
}