2

Eu estou tentando criar as tabelas e esta dando o seguinte erro:

  BadMethodCallException  : Method Illuminate\Database\Schema\Blueprint::number does not exist.
  at /var/www/html/clinicas/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:99
 95|      */
 96|     public function __call($method, $parameters)
 97|     {
 98|         if (! static::hasMacro($method)) {
  >  99|             throw new BadMethodCallException(sprintf(
100|                 'Method %s::%s does not exist.', static::class, $method
101|             ));
102|         }
103
Exception trace:
1   Illuminate\Database\Schema\Blueprint::__call("number")
/var/www/html/clinicas/database/migrations/2018_06_05_225926_create_pacientes_table.php:19
2   CreatePacientesTable::{closure}(Object(Illuminate\Database\Schema\Blueprint))
  /var/www/html/clinicas/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:164

Minhas Migrations: Users

public function up()
{
    Schema::create('users', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->string('email')->unique();
        $table->string('password');
        $table->string('nivel', 5)->nullable();
        $table->rememberToken();
        $table->timestamps();
    });
}

Password

public function up()
{
    Schema::create('password_resets', function (Blueprint $table) {
        $table->string('email')->index();
        $table->string('token');
        $table->timestamp('created_at')->nullable();
    });
}

Eventos

public function up()
{
    Schema::create('eventos', function (Blueprint $table) {
        $table->increments('id');
        $table->string('titulo');
        $table->datetime('start');
        $table->datetime('end');
        $table->string('color', 7);
        $table->timestamps();
    });
}

Pacientes

public function up()
{
    Schema::create('pacientes', function (Blueprint $table) {
        $table->increments('id');
        $table->string('nome');
        $table->number('cpf');
        $table->number('rg');
        $table->string('endereco');
        $table->string('numero');
        $table->string('bairro');
        $table->string('cep');
        $table->string('cidade');
        $table->string('estado');
        $table->string('telefone');
        $table->string('celular');
        $table->string('celular_2');
        $table->string('email');
        $table->string('imagem');
        $table->timestamps();
    });
}

O que pode estar errado?

3

1 Resposta 1

1

O problema ocorre, no método number();, pois ele não existe, como as colunas que você está usando é destinado a CPF ou RG pode utilizar string(); mesmo, ou caso seja apenas numeros (sem os pontos e -) você pode utilizar o integer();

Pacientes:

public function up()
{
    Schema::create('pacientes', function (Blueprint $table) {
        $table->increments('id');
        $table->string('nome');
        $table->string('cpf');
        $table->string('rg');
        $table->string('endereco');
        $table->string('numero');
        $table->string('bairro');
        $table->string('cep');
        $table->string('cidade');
        $table->string('estado');
        $table->string('telefone');
        $table->string('celular');
        $table->string('celular_2');
        $table->string('email');
        $table->string('imagem');
        $table->timestamps();
    });
}

Você pode verificar os métodos para criar as colunas no seguinte Link

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .