1
I’m in trouble ,to create a Migration in 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 ,to then populate in the bank
Even when I create a model using the command - php artisan make:model Teste
it creates the model a Migration no.
Example of a model of mine : that has no Migration, and that would like to have in the bank
<?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 , for me to create it in the bank is with a Migration,this model he has relationships with other models..
Example 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 Migration of projects I did was this way ... 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 made it based on this video-lesson Creation of relationships between tables
If you’re right, the same logic I do in Migration stakeholders.. correct?
How are you giving the command on the terminal? Full command
– Darlei Fernando Zillmer
The command normally used for Migrations in the Laravel is:
php artisan migrate --seed
– MarceloBoni
Thanks a lot!!! Thanks a lot.
– Ricardo Mendes