如何降低Laravel artisan 报错级别
1个回答
展开全部
首先确认,后台的用户表,我设计表叫做badmin,每个管理员有用户名(username),有昵称(nickname),有邮箱(email),有密码(password)
这里玩个花,使用laravel的migration来建立表(实际上可以用不着使用这个工具建立表)
1 安装好最基本的laravel框架
2 创建migration文件:
./artisan migrate:make create-badmin-table
3 发现app/database/migration/下面多了一个php文件:
2014_10_19__create-badmin-table.php
4 往up和down里面增加内容;
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBadminTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('badmin', function($table)
{
$table->increments('id');
$table->string('nickname', 100)->unique();
$table->string('username', 100)->unique();
$table->string('email', 100)->unique();
$table->string('password', 64);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('badmin');
}
}
5 配置好local的database,app/config/local/database.php
<?php
return array(
'fetch' => PDO::FETCH_CLASS,
'default' => 'mysql',
'connections' => array(
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => ’test',
'username' => 'yejianfeng',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
),
'migrations' => 'migrations',
);
这里玩个花,使用laravel的migration来建立表(实际上可以用不着使用这个工具建立表)
1 安装好最基本的laravel框架
2 创建migration文件:
./artisan migrate:make create-badmin-table
3 发现app/database/migration/下面多了一个php文件:
2014_10_19__create-badmin-table.php
4 往up和down里面增加内容;
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBadminTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('badmin', function($table)
{
$table->increments('id');
$table->string('nickname', 100)->unique();
$table->string('username', 100)->unique();
$table->string('email', 100)->unique();
$table->string('password', 64);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('badmin');
}
}
5 配置好local的database,app/config/local/database.php
<?php
return array(
'fetch' => PDO::FETCH_CLASS,
'default' => 'mysql',
'connections' => array(
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => ’test',
'username' => 'yejianfeng',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
),
'migrations' => 'migrations',
);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
启帆信息
2024-11-19 广告
2024-11-19 广告
启帆信息是英伟达中国区代理商,原厂授权代理,提供全面的软件技术解决方案以及NVIDIA以太网产品、交换机等产品,欢迎前来咨询!...
点击进入详情页
本回答由启帆信息提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询