Commit 1584aac4 by Edward Simarmata

rbac yang belum selesai

parent ba3de97c
...@@ -34,6 +34,13 @@ return [ ...@@ -34,6 +34,13 @@ return [
], ],
], ],
], ],
'authManager'=>
[
'class' => 'yii\rbac\DbManager',
'defaultRoles' => ['guest'],
],
'errorHandler' => [ 'errorHandler' => [
'errorAction' => 'site/error', 'errorAction' => 'site/error',
], ],
......
<?php
namespace backend\controllers;
use Yii;
use app\models\Sekolah;
use app\models\SekolahSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* SekolahController implements the CRUD actions for Sekolah model.
*/
class SekolahController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Sekolah models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new SekolahSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Sekolah model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Sekolah model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Sekolah();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Sekolah model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Sekolah model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Sekolah model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Sekolah the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Sekolah::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
...@@ -95,4 +95,9 @@ class SiteController extends Controller ...@@ -95,4 +95,9 @@ class SiteController extends Controller
return $this->goHome(); return $this->goHome();
} }
public function actionTest()
{
return $this->render('test');
}
} }
<?php
namespace backend\controllers;
use Yii;
use app\models\Users;
use app\models\UsersSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\web\ForbiddenHttpException;
/**
* UsersController implements the CRUD actions for Users model.
*/
class UsersController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Users models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new UsersSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Users model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Users model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
if(Yii::$app->user->can('sekpenTK')){
$model = new Users();
if ($model->load(Yii::$app->request->post()) && $model->save() ) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
else
{
throw new ForbiddenHttpException;
}
}
/**
* Updates an existing Users model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Users model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Users model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Users the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Users::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
public function actionTest(){
return $this->redirect(['index']);
}
}
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "sekolah".
*
* @property integer $id
* @property string $nama_sekolah
* @property string $alamat_sekolah
* @property string $foto_sekolah
* @property string $visi
* @property string $misi
* @property string $created_at
* @property string $updated_at
* @property string $deleted_at
* @property integer $deleted
* @property string $created_by
* @property string $updated_by
* @property string $deleted_by
*/
class Sekolah extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'sekolah';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['nama_sekolah', 'alamat_sekolah', 'foto_sekolah', 'visi', 'misi', 'created_at', 'updated_at', 'deleted_at', 'deleted', 'created_by', 'updated_by', 'deleted_by'], 'required'],
[['created_at', 'updated_at', 'deleted_at'], 'safe'],
[['deleted'], 'integer'],
[['nama_sekolah', 'alamat_sekolah', 'foto_sekolah', 'visi', 'misi'], 'string', 'max' => 100],
[['created_by', 'updated_by', 'deleted_by'], 'string', 'max' => 32],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'nama_sekolah' => 'Nama Sekolah',
'alamat_sekolah' => 'Alamat Sekolah',
'foto_sekolah' => 'Foto Sekolah',
'visi' => 'Visi',
'misi' => 'Misi',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
'deleted_at' => 'Deleted At',
'deleted' => 'Deleted',
'created_by' => 'Created By',
'updated_by' => 'Updated By',
'deleted_by' => 'Deleted By',
];
}
}
<?php
namespace app\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\models\Sekolah;
/**
* SekolahSearch represents the model behind the search form about `app\models\Sekolah`.
*/
class SekolahSearch extends Sekolah
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'deleted'], 'integer'],
[['nama_sekolah', 'alamat_sekolah', 'foto_sekolah', 'visi', 'misi', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'deleted_by'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Sekolah::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'deleted_at' => $this->deleted_at,
'deleted' => $this->deleted,
]);
$query->andFilterWhere(['like', 'nama_sekolah', $this->nama_sekolah])
->andFilterWhere(['like', 'alamat_sekolah', $this->alamat_sekolah])
->andFilterWhere(['like', 'foto_sekolah', $this->foto_sekolah])
->andFilterWhere(['like', 'visi', $this->visi])
->andFilterWhere(['like', 'misi', $this->misi])
->andFilterWhere(['like', 'created_by', $this->created_by])
->andFilterWhere(['like', 'updated_by', $this->updated_by])
->andFilterWhere(['like', 'deleted_by', $this->deleted_by]);
return $dataProvider;
}
}
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "user".
*
* @property integer $id
* @property string $username
* @property string $password
* @property string $email
* @property string $auth_key
* @property string $password_hash
* @property string $password_reset_token
* @property integer $status
* @property string $created_at
* @property string $updated_at
* @property string $deleted_at
* @property integer $deleted
* @property string $created_by
* @property string $updated_by
* @property string $deleted_by
*/
class Users extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'user';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['username', 'password', 'email'], 'required'],
[['status', 'deleted'], 'integer'],
[['created_at', 'updated_at', 'deleted_at'], 'safe'],
[['username', 'password', 'email'], 'string', 'max' => 100],
[['auth_key', 'created_by', 'updated_by', 'deleted_by'], 'string', 'max' => 32],
[['password_hash', 'password_reset_token'], 'string', 'max' => 255],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'username' => 'Username',
'password' => 'Password',
'email' => 'Email',
'auth_key' => 'Auth Key',
'password_hash' => 'Password Hash',
'password_reset_token' => 'Password Reset Token',
'status' => 'Status',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
'deleted_at' => 'Deleted At',
'deleted' => 'Deleted',
'created_by' => 'Created By',
'updated_by' => 'Updated By',
'deleted_by' => 'Deleted By',
];
}
}
<?php
namespace app\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\models\Users;
/**
* UsersSearch represents the model behind the search form about `app\models\Users`.
*/
class UsersSearch extends Users
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'status', 'deleted'], 'integer'],
[['username', 'password', 'email', 'auth_key', 'password_hash', 'password_reset_token', 'created_at', 'updated_at', 'deleted_at', 'created_by', 'updated_by', 'deleted_by'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Users::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'status' => $this->status,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'deleted_at' => $this->deleted_at,
'deleted' => $this->deleted,
]);
$query->andFilterWhere(['like', 'username', $this->username])
->andFilterWhere(['like', 'password', $this->password])
->andFilterWhere(['like', 'email', $this->email])
->andFilterWhere(['like', 'auth_key', $this->auth_key])
->andFilterWhere(['like', 'password_hash', $this->password_hash])
->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])
->andFilterWhere(['like', 'created_by', $this->created_by])
->andFilterWhere(['like', 'updated_by', $this->updated_by])
->andFilterWhere(['like', 'deleted_by', $this->deleted_by]);
return $dataProvider;
}
}
...@@ -36,7 +36,11 @@ AppAsset::register($this); ...@@ -36,7 +36,11 @@ AppAsset::register($this);
]); ]);
$menuItems = [ $menuItems = [
['label' => 'Home', 'url' => ['/site/index']], ['label' => 'Home', 'url' => ['/site/index']],
['label' => 'User', 'url' => ['/users/index']],
['label' => 'Sekolah', 'url' => ['/sekolah/index']]
]; ];
if (Yii::$app->user->isGuest) { if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
} else { } else {
......
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Sekolah */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="sekolah-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'nama_sekolah')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'alamat_sekolah')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'foto_sekolah')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'visi')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'misi')->textInput(['maxlength' => true]) ?>
<!-- <?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<?= $form->field($model, 'deleted_at')->textInput() ?>
<?= $form->field($model, 'deleted')->textInput() ?>
<?= $form->field($model, 'created_by')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'updated_by')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'deleted_by')->textInput(['maxlength' => true]) ?> -->
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\SekolahSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="sekolah-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'nama_sekolah') ?>
<?= $form->field($model, 'alamat_sekolah') ?>
<?= $form->field($model, 'foto_sekolah') ?>
<?= $form->field($model, 'visi') ?>
<?php // echo $form->field($model, 'misi') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'deleted_at') ?>
<?php // echo $form->field($model, 'deleted') ?>
<?php // echo $form->field($model, 'created_by') ?>
<?php // echo $form->field($model, 'updated_by') ?>
<?php // echo $form->field($model, 'deleted_by') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Sekolah */
$this->title = 'Create Sekolah';
$this->params['breadcrumbs'][] = ['label' => 'Sekolahs', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="sekolah-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\models\SekolahSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Sekolahs';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="sekolah-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Create Sekolah', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'nama_sekolah',
'alamat_sekolah',
'foto_sekolah',
'visi',
// 'misi',
// 'created_at',
// 'updated_at',
// 'deleted_at',
// 'deleted',
// 'created_by',
// 'updated_by',
// 'deleted_by',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Sekolah */
$this->title = 'Update Sekolah: ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Sekolahs', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="sekolah-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Sekolah */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Sekolahs', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="sekolah-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'nama_sekolah',
'alamat_sekolah',
'foto_sekolah',
'visi',
'misi',
'created_at',
'updated_at',
'deleted_at',
'deleted',
'created_by',
'updated_by',
'deleted_by',
],
]) ?>
</div>
<html>
<h1> Hello World </h1>
</html>
\ No newline at end of file
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Users */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="users-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'password')->passwordInput(['maxlength' => true]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
<!-- <?= $form->field($model, 'auth_key')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'password_hash')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'password_reset_token')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<?= $form->field($model, 'deleted_at')->textInput() ?>
<?= $form->field($model, 'deleted')->textInput() ?>
<?= $form->field($model, 'created_by')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'updated_by')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'deleted_by')->textInput(['maxlength' => true]) ?> -->
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\UsersSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="users-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'username') ?>
<?= $form->field($model, 'password') ?>
<?= $form->field($model, 'email') ?>
<?= $form->field($model, 'auth_key') ?>
<?php // echo $form->field($model, 'password_hash') ?>
<?php // echo $form->field($model, 'password_reset_token') ?>
<?php // echo $form->field($model, 'status') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'deleted_at') ?>
<?php // echo $form->field($model, 'deleted') ?>
<?php // echo $form->field($model, 'created_by') ?>
<?php // echo $form->field($model, 'updated_by') ?>
<?php // echo $form->field($model, 'deleted_by') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Users */
$this->title = 'Create Users';
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="users-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\models\UsersSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Users';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="users-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Create Users', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'username',
'password',
'email:email',
'auth_key',
// 'password_hash',
// 'password_reset_token',
// 'status',
// 'created_at',
// 'updated_at',
// 'deleted_at',
// 'deleted',
// 'created_by',
// 'updated_by',
// 'deleted_by',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Users */
$this->title = 'Update Users: ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="users-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Users */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="users-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'username',
'password',
'email:email',
// 'auth_key',
// 'password_hash',
// 'password_reset_token',
// 'status',
'created_at',
'updated_at',
// 'deleted_at',
// 'deleted',
// 'created_by',
// 'updated_by',
// 'deleted_by',
],
]) ?>
</div>
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment