gii

yii2 access denied to gii

不羁岁月 提交于 2019-12-12 05:37:37
问题 I have set up yii2 using composer. i have modified front end and backend in apache to display as alieses - yii2f and yii2b . I am trying to access gii using url yii2f/index.php/gii but i keep hetting following error 2015-03-25 15:42:10 [172.16.0.85][-][-][warning][yii\gii\Module::checkAccess] Access to Gii is denied due to IP address restriction. The requested IP is 172.16.0.85 2015-03-25 15:42:10 [172.16.0.85][-][-][error][yii\web\HttpException:403] exception 'yii\web\ForbiddenHttpException'

yii2 user CRUD create or update with password

跟風遠走 提交于 2019-12-11 16:15:29
问题 I have a User model that stores the users in the database. With GII create a CRUD to be able to register and update users. The problem is with the password. How could I do for when I create a user to load a password and when I update it if I want to be able to update it? My table: CREATE TABLE user ( id int(11) NOT NULL, username varchar(250) NOT NULL, auth_key varchar(32) NOT NULL, password_hash varchar(255) NOT NULL, password_reset_token varchar(255) NOT NULL, email varchar(255) NOT NULL,

How to use custom templates in gii (using Yii 2)

时光毁灭记忆、已成空白 提交于 2019-12-10 12:46:47
问题 I'm trying to find a way to use custom Gii templates for Yii 2, but looking at the missing documentation in the docs, I assume it's not possible yet? Or am I missing something? 回答1: Copy ie. the crud generator templates from gii/generators/crud/templates to your application app/templates/mycrud . Then define the templates in your config: $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', 'generators' => [ 'crud' => [ 'class' => 'yii\gii\generators\crud\Generator', 'templates' => [

谈谈yii2-gii如何自定义模板

懵懂的女人 提交于 2019-12-07 20:43:32
作者:白狼 出处: http://www.manks.top/article/yii2_gii_custom_template 本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 yii2中gii给我们实际的使用提供了很大的方便。 但是,实际开发中,相信gii生成的模板也给很多开发者带来了不变,为啥?因为都是都是用人家的模板主动性生成的,自然不满足千万家的需求了,自家的需求还是自家定制的好,毕竟官方也只是尽可能的给出一个模板案例。 关于gii的介绍以及怎么使用可参考 官方文档说明 ,如果有哪里不懂的,下方留言我们共同交流。 yii2官方只提供了一种模板,但是也给我们提供了自定义的机会,接下来我们看看如何抓住这个机会去做点什么。 gii生成器所用到的模板文件位于目录 vendor\yiisoft\yii2-gii\generators\crud\default,因为要自定义模板,我们现在把default目录拷贝一份,粘贴到任意目录,这里我们粘贴在根目录下的giitemplate\curd下面,然后按照下面进行配置 $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', 'allowedIPs' => ['127.0.0.1', '::1'],

Yii2 Gii Table Prefix

吃可爱长大的小学妹 提交于 2019-12-07 04:18:56
问题 I allways setup table prefix - for this post lets say my prefix is abc_ . So in common\config\main-local.php . I have: 'components' => [ 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=database', 'username' => 'user', 'password' => 'pwd', 'charset' => 'utf8', 'tablePrefix' => 'abc_', ], ... I have worked on Yii1 and used gii to generate models. In this version it generated files like: table.php . Now I work with Yii2 and learn the differences: gii generate

Yii2 Gii Table Prefix

萝らか妹 提交于 2019-12-05 09:44:05
I allways setup table prefix - for this post lets say my prefix is abc_ . So in common\config\main-local.php . I have: 'components' => [ 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=database', 'username' => 'user', 'password' => 'pwd', 'charset' => 'utf8', 'tablePrefix' => 'abc_', ], ... I have worked on Yii1 and used gii to generate models. In this version it generated files like: table.php . Now I work with Yii2 and learn the differences: gii generate files like abc_table.php . Yes - I checked "Use Table Prefix". This is not ok because prefix should be

Create a CRUD from a database view using Gii in Yii2

跟風遠走 提交于 2019-12-04 06:37:19
I have generated a Model using gii of a mariadb view, which worked. Then trying use the gii CRUD generator for the model, I get the error The table associated with app\models\Future must have primary key(s). Which is perfectly understandable as the the view does not have a PK. I found some advice that says to add a primaryKey function to the model so I tried public function primaryKey() { return 'id'; } With id being the column name which is actually the PK in the underlying table, which is part of the view. But this fails with an exception Cannot make static method yii\db\ActiveRecord:

Yii2 GridView implement Filter and Sort for Values for related Table of foreign Table

五迷三道 提交于 2019-12-02 04:10:50
问题 I have 3 Tables: CREATE TABLE tabCve ( intCveID INTEGER NOT NULL AUTO_INCREMENT, strNumber VARCHAR(20) NOT NULL, fltScore FLOAT(0), strDescription TEXT, datImported DATETIME NOT NULL DEFAULT NOW(), intCvePhaseID INTEGER, intCveTypeID INTEGER, PRIMARY KEY (intCveID), KEY (intCvePhaseID), KEY (intCveTypeID) ) ; CREATE TABLE tabProgress ( intProgressID INTEGER NOT NULL AUTO_INCREMENT, intProgressCveID INTEGER NOT NULL, intProgressUserID INTEGER NOT NULL, intProgressStateID INTEGER NOT NULL,

Yii2 GridView implement Filter and Sort for Values for related Table of foreign Table

时间秒杀一切 提交于 2019-12-02 00:32:15
I have 3 Tables: CREATE TABLE tabCve ( intCveID INTEGER NOT NULL AUTO_INCREMENT, strNumber VARCHAR(20) NOT NULL, fltScore FLOAT(0), strDescription TEXT, datImported DATETIME NOT NULL DEFAULT NOW(), intCvePhaseID INTEGER, intCveTypeID INTEGER, PRIMARY KEY (intCveID), KEY (intCvePhaseID), KEY (intCveTypeID) ) ; CREATE TABLE tabProgress ( intProgressID INTEGER NOT NULL AUTO_INCREMENT, intProgressCveID INTEGER NOT NULL, intProgressUserID INTEGER NOT NULL, intProgressStateID INTEGER NOT NULL, intProgressCategoryID INTEGER, datCreated DATETIME NOT NULL, PRIMARY KEY (intProgressID), KEY

gii not working in yii

被刻印的时光 ゝ 提交于 2019-11-30 19:27:42
I am new in yii framework. In my site gii shows the error Error 403 You are not allowed to access this page. I set the gii in the config file like this 'gii'=>array( 'class'=>'system.gii.GiiModule', 'password'=>'test123', 'ipFilters'=>array('192.168.0.101','127.0.0.1','::1'), ), still it show the error test techie This is the only line that worked for me: 'ipFilters'=>array($_SERVER['REMOTE_ADDR']), You may set... 'ipFilters' => false From the docs http://www.yiiframework.com/doc/api/1.1/GiiModule#ipFilters-detail ... If you want to allow all IPs to access gii, you may set this property to be