小编MD.*_*man的帖子

Laravel Migration表已经存在,但我想添加新的而不是旧的

我以前创建过用户表.现在我创建了一个新的迁移来在我的模式中创建一个新的books表.当我尝试运行命令时

php artisan migrate
Run Code Online (Sandbox Code Playgroud)

表明:

[Illuminate\Database\QueryException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
ady exists (SQL: create table `users` (`id` int unsigned not null auto_incr
ement primary key, `username` varchar(255) not null, `email` varchar(255) n
ot null, `password` varchar(255) not null, `created_at` timestamp default 0
 not null, `updated_at` timestamp default 0 not null) default character set
 utf8 collate utf8_unicode_ci)
Run Code Online (Sandbox Code Playgroud)

这是我的新迁移表:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateBooksTable extends Migration {
    public function up()
    {
        Schema::create('books', function(Blueprint …
Run Code Online (Sandbox Code Playgroud)

php mysql laravel

54
推荐指数
9
解决办法
15万
查看次数

如何将数据插入Database Laravel?

我是编程新手.我在views/register.blade.php中创建了一个基本表单

         @section('content')
<h1>Registration Form</h1><hr>
<h3>Please insert the informations bellow:</h3>
{{Form::open(array('url'=>'test/register','method'=>'post'))}}
<input type="text" name="username" placeholder="username"><br><br>
<input type="text" name="email" placeholder="email"><br><br>
<input type="password" placeholder="password"><br><br>
<input type="submit" value="REGISTER NOW!">
{{Form::close()}}@stop
Run Code Online (Sandbox Code Playgroud)

我有一个控制器.像这样

         public function create()
         {
             $user= Input::all();
               $user = new User;
               $user->username = Input::get('username');
               $user->email = Input::get('email');
               $user->password = Input::get('password');
               $user->save();

            return Redirect::back();
        } 
Run Code Online (Sandbox Code Playgroud)

这是我的路线:

Route::get('test/register', array('uses'=>'TestController@create'))
Run Code Online (Sandbox Code Playgroud)

我无法通过表单注册用户.你能建议我怎么做吗?

php laravel laravel-4

6
推荐指数
1
解决办法
8万
查看次数

如何使用PHP从字符串中删除前n个数字字符?

我有一个字符串$str = "4sX3yY4mj2DT9gVOOS0x60onT08lwzLLZBqn8".现在我想从字符串中删除前5个数字字符.

我怎么在PHP中这样做?

php regex string preg-replace

5
推荐指数
1
解决办法
254
查看次数

如果不是主页,请Shopify?

如何检测shopify if Homepage?以前有一个page.frontpage不再使用的处理程序。

我需要从首页中排除某些内容,因此无法进行index.liquid文件编辑。

liquid shopify

3
推荐指数
2
解决办法
2180
查看次数

显示没有链接wordpress的类别列表

我试图列出类别名称.wp_list_categories()返回类别列表,但问题是它会自动用链接包装名称.我不需要链接.

可以通过JavaScript禁用链接吗?但是我必须解雇一些JS事件.

我需要检索没有自动锚标签的类别列表,任何想法?

php wordpress

2
推荐指数
2
解决办法
9027
查看次数

将元素推送到父元素的底部

我有如下构建的布局:

<div class="parent">
  <div class="pushBottom">Bottom Content</div>
  <div> Something </div>
  <div>Something </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我想要实现的输出是:

Something
Something
Bottom Content
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

2
推荐指数
1
解决办法
56
查看次数

标签 统计

php ×4

laravel ×2

css ×1

html ×1

javascript ×1

jquery ×1

laravel-4 ×1

liquid ×1

mysql ×1

preg-replace ×1

regex ×1

shopify ×1

string ×1

wordpress ×1