I'm having problems, to create a migration on the terminal displays this ...
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "make:migrations" is not defined.
Did you mean one of these?
make:migration
make:auth
make:command
make:controller
make:event
make:job
make:listener
make:mail
make:middleware
make:model
make:notification
make:policy
make:provider
make:request
make:seeder
make:test'
This is a ready project I just want to create the tables and make the relationship, then populate the bank
Even when I create a model using the command - php artisan make:model Teste
it creates the model a migration not.
Example of a model of mine: that does not have migration, and would like to have in the database
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Projetos extends Model{
public $timestamps = false;
protected $table = 'projetos';
protected $IntId = 'id';
protected $fillable = array('nome', 'area', 'data_criacao', 'data_conclusao_prevista',
'status', 'porcentagem', 'codigo', 'dono', 'descricao');
protected $strDataUltimaAtualizacao = 'data_ultima_atualizacao';
protected $strArquivo = 'arquivo';
protected $strDescricao = 'descricao';
protected $strDataArquivoAtualizacao = 'data_arquivo_atualizacao';
public function areas() {
return $this->hasOne('App\Models\Area', 'id', 'area');
}
public function stakeholders() {
return $this->belongsToMany('App\Models\Stakeholders', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
}
public function comentario() {
return $this->hasMany('App\Models\Comentario', 'id_projeto', 'id');
}
public function roles() {
return $this->belongsToMany('App\Models\Projetos', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
}
}
Another question, raised there is this model, so I create it in the bank is with a migration, this model it has a relationship with other models ..
Sample model Stakeholders:
public $timestamps = false;
protected $table = 'stakeholders';
protected $IntId = 'id';
protected $fillable = array('login', 'nome', 'email');
protected $boolAdmin = 'admin';
protected $boolBoss = 'boss';
protected $strSenha = 'senha';
protected $strTokenResetarSenha = 'token_resetar_senha';
public function projetos() {
return $this->belongsToMany('App\Models\Projetos', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
}
public function comentario() {
return $this->hasMany('App\Models\Comentario', 'id_stakeholder', 'id');
}
public function roles() {
return $this->belongsToMany('App\Models\Projetos', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
}
The project migration I did was like this ... I wonder if I'm right
Schema::create('projetos', function (Blueprint $table) {
$table->increments('id');
$table->string('nome',200);
$table->string('area',30);
$table->date('data_criacao',20);
$table->date('data_conclusao_prevista',20);
$table->string('status',40);
$table->integer('porcentagem',80);
$table->integer('codigo',10);
$table->integer('dono',40);
$table->string('descricao',80);
//relacao
$table->integer('id')->unsigned();
$table->foreign('id')->references('id')->on('area');
$table->integer('id')->unsigned();
$table->integer('id')->references('id')->on('stakeholders');
$table->integer('id'->unsigned();
$table->foreign('id')->references('id')->on('comentarios');
I've been basing myself on this video lesson Creating relationships between tables
If it's right, the same logic I do in migration stakeholders .. correct?