Php 从服务器创建和/或更新Laravel 4中数据库中的表

Php 从服务器创建和/或更新Laravel 4中数据库中的表,php,mysql,laravel,schema,Php,Mysql,Laravel,Schema,我是一名移动应用程序(Android/iOS)开发人员,在没有php开发人员的情况下,我想在数据库中添加另一个表,并发布和获取一些数据并存储在新表中 Laravel4安装在我们的服务器中,通过一些基本的cPanel、phpMyAdmin和php信息,我试图在现有数据库中创建一个新表 首先,我使用phpMyAdmin创建了一个表,然后像这样添加了模型文件 <?php class Record extends Eloquent { protected $table = 'requestRe

我是一名移动应用程序(Android/iOS)开发人员,在没有php开发人员的情况下,我想在数据库中添加另一个表,并发布和获取一些数据并存储在新表中

Laravel4安装在我们的服务器中,通过一些基本的cPanel、phpMyAdmin和php信息,我试图在现有数据库中创建一个新表

首先,我使用phpMyAdmin创建了一个表,然后像这样添加了模型文件

<?php

class Record extends Eloquent {

protected $table = 'requestRecords';
protected $guarded = array();
public $timestamps = true;

}
事实上,我既没有得到200也没有得到401,但我得到了
HTTP500内部服务器错误

然后我尝试使用schema添加表,所以我在database/migrations文件夹中创建了一个php文件,名为:
2015\u 01\u 02\u 104814\u create\u requestRecords\u table.php
,并在其中添加以下代码:

<?php

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

class CreateRequestRecordsTable extends Migration {

public function up()
{
    Schema::create('requestRecords', function($table) {
        $table->increments('id');
        $table->string('userId',255);
        $table->string('userName', 255);
        $table->string('timeStamp', 255);
        $table->string('payLoad',255);
        $table->string('requestFor',255);
        $table->string('bToken',255);
        $table->string('bSituation',255);

    });
}

public function down()
{
    Schema::drop('requestRecords');
}
}
/app/models/Record.php中的模型:

<?php
class Record extends Eloquent {
protected $table = 'requestRecords';
protected $guarded = array();
public $timestamps = true;

}

您正在添加大量验证,并且总是自己在应用程序上抛出500个错误


一个最好的做法是你把所有这些都去掉,试着先把事情做好,然后再做。当您看到代码正常工作时,您可以添加验证,以确保您想要的每个字段都在表单上

那么你得到了什么样的回应?只是空白?另外,您是否可以确保没有填写的
create
值都是可选的/可为空的?因为在您的迁移过程中,它们不是。@lukasgeiter我得到了
HTTP 500内部服务器错误
@lukasgeiter实际上我尝试创建了一个只有on列的表(我唯一填写的
create
),但同样的500内部错误。请检查
app/storage/logs/laravel.log
,并用错误更新您的问题message@lukasgeiter事实上,我记得有一天,我们的php开发人员说我们不需要任何日志,为了防止存储警告,他禁用了日志记录((((
<?php 
            class RequestRecordsController extends BaseController {

              /**
               * Display a listing of the resource.
               *
               * @return Response
               */
              public function index()
              {

              }

              /**
               * Show the form for creating a new resource.
               *
               * @return Response
               */
              public function create()
              {

              }

              /**
               * Store a newly created resource in storage.
               *
               * @return Response
               */
              public function store()
              {

              }

              /**
               * Display the specified resource.
               *
               * @param  int  $id
               * @return Response
               */
              public function show($id)
              {

              }

              /**
               * Show the form for editing the specified resource.
               *
               * @param  int  $id
               * @return Response
               */
              public function edit($id)
              {

              }

              /**
               * Update the specified resource in storage.
               *
               * @param  int  $id
               * @return Response
               */
              public function update($id)
              {

              }

              /**
               * Remove the specified resource from storage.
               *
               * @param  int  $id
               * @return Response
               */
              public function destroy($id)
              {

              }

            }

            ?>
<?php
class Record extends Eloquent {
protected $table = 'requestRecords';
protected $guarded = array();
public $timestamps = true;

}