2017 © Pedro Peláez
 

laravel laravel-yii

laravel gridview & active form from yii2

image

zacksleo/laravel-yii

laravel gridview & active form from yii2

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

laravel-yii

use Yii2 Gridview, ActiveForm, DetailView etc... in laravel, (*1)

Features

  • GridView
  • ActiveForm
  • DetailView
  • Html

Get Started

Grid View

echo \zacksleo\laravel\yii\grid\GridView::widget([
     'dataProvider' => new zacksleo\laravel\yii\data\ActiveDataProvider([
         'query' => \App\Models\User::query(),
     ]),
     'columns' => [
         'name',
         'image',
         [
             'class' => zacksleo\laravel\yii\grid\ActionColumn::class,
         ],
     ],
 ]);

ActiveForm

Create a Request Form

use php artisan make:request Person to make a RequestForm, (*2)

the class should implements RequestActiveForm, (*3)

model = \App\Models\Person::query()->find($id);
        parent::__construct([], [], [], [], [], [], []);
    }

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return false;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required',
            'img' => 'file'
        ];
    }

    public function getModel(): Model
    {
        return $this->model;
    }
}

```

View

```




= $form->field($model, 'name')->textInput() ?>

= $form->field($model, 'img')->textInput() ?>



= Html::submitButton('Save', ['class' => $model->model->exists() ? 'btn btn-success' : 'btn btn-primary']) ?>

DetailView

echo zacksleo\laravel\yii\widgets\DetailView::widget([
       'model' => $model,
       'attributes' => [
           'id',
           'name',
           'image',
         ]
     ]);

The Versions

15/04 2018

dev-master

9999999-dev

laravel gridview & active form from yii2

  Sources   Download

MIT

The Requires