forked from uspdev/laravel_basico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
:bn
29 lines (24 loc) · 917 Bytes
/
:bn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Passos para a elaboração do artigo
## Modelagem do banco de dados
- Modelar no MySQL Workbench
- Colocar o model.mwb e um .png no repositório
## Criação do projeto Laravel
- composer create-project laravel/laravel laravel_basico
## Criação dos models e migrations
- php artisan make:model Post -crmf
- php artisan make:model Comment -crmf
### Criação dos campos nas tabelas
- database/migrations/create_posts_table.php
-
- database/migrations/create_comments_table.php
- public function up()
¦ {
¦ ¦ ¦ Schema::create('comments', function (Blueprint $table) {
¦ ¦ ¦ ¦ ¦ $table->increments('id');
¦ ¦ ¦ ¦ ¦ $table->string('author_email');
¦ ¦ ¦ ¦ ¦ $table->text('content');
¦ ¦ ¦ ¦ ¦ $text->integer('post_id')->unsigned();
¦ ¦ ¦ ¦ ¦ $table->timestamps();
¦ ¦ ¦ ¦ ¦ $table->foreign('post_id')->references('id')->on('posts');
¦ ¦ ¦ });
¦ }