Skip to content

Commit c538082

Browse files
committed
Merge branch 'develop' into feature/controllers-and-services
2 parents b6911ee + 9c4c890 commit c538082

11 files changed

+211
-48
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
# uds-desafio-back-end
22
Teste para candidatos à vaga de backend
3+
4+
php artisan create-db
5+
6+
php artisan migrate:install
7+
8+
php artisan migrate

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"php": ">=7.0.0",
99
"fideloper/proxy": "~3.3",
1010
"laravel/framework": "5.5.*",
11-
"laravel/tinker": "~1.0",
1211
"soapbox/laravel-formatter": "^2.0"
12+
"webpatser/laravel-uuid": "^3.0"
1313
},
1414
"require-dev": {
1515
"filp/whoops": "~2.0",

composer.lock

Lines changed: 56 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/database.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
'driver' => 'mysql',
4444
'host' => env('DB_HOST', '127.0.0.1'),
4545
'port' => env('DB_PORT', '3306'),
46-
'database' => env('DB_DATABASE', 'forge'),
46+
'database' => env('DB_DATABASE', 'uds_desafio'),
4747
'username' => env('DB_USERNAME', 'forge'),
4848
'password' => env('DB_PASSWORD', ''),
4949
'unix_socket' => env('DB_SOCKET', ''),
50-
'charset' => 'utf8mb4',
51-
'collation' => 'utf8mb4_unicode_ci',
50+
'charset' => 'utf8',
51+
'collation' => 'utf8_unicode_ci',
5252
'prefix' => '',
5353
'strict' => true,
5454
'engine' => null,

database/migrations/2014_10_12_000000_create_users_table.php

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class CreateProductTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('produto', function (Blueprint $table) {
17+
$table->uuid('id')->unique();
18+
$table->primary('id');
19+
$table->string('codigo')->unique();
20+
$table->string('nome')->unique();
21+
$table->double('preco_unitario', 8, 2);
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*
28+
* @return void
29+
*/
30+
public function down()
31+
{
32+
Schema::dropIfExists('produto');
33+
}
34+
}

database/migrations/2014_10_12_100000_create_password_resets_table.php renamed to database/migrations/2018_02_07_014214_create_person_table.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use Illuminate\Database\Schema\Blueprint;
55
use Illuminate\Database\Migrations\Migration;
66

7-
class CreatePasswordResetsTable extends Migration
7+
class CreatePersonTable extends Migration
88
{
99
/**
1010
* Run the migrations.
@@ -13,10 +13,12 @@ class CreatePasswordResetsTable extends Migration
1313
*/
1414
public function up()
1515
{
16-
Schema::create('password_resets', function (Blueprint $table) {
17-
$table->string('email')->index();
18-
$table->string('token');
19-
$table->timestamp('created_at')->nullable();
16+
Schema::create('pessoa', function (Blueprint $table) {
17+
$table->uuid('id')->unique();
18+
$table->primary('id');
19+
$table->string('nome')->unique();
20+
$table->string('cpf');
21+
$table->date('data_nascimento');
2022
});
2123
}
2224

@@ -27,6 +29,6 @@ public function up()
2729
*/
2830
public function down()
2931
{
30-
Schema::dropIfExists('password_resets');
32+
Schema::dropIfExists('pessoa');
3133
}
3234
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\DB;
4+
use Illuminate\Support\Facades\Schema;
5+
use Illuminate\Database\Schema\Blueprint;
6+
use Illuminate\Database\Migrations\Migration;
7+
8+
class CreateOrderTable extends Migration
9+
{
10+
/**
11+
* Run the migrations.
12+
*
13+
* @return void
14+
*/
15+
public function up()
16+
{
17+
Schema::create('pedido', function (Blueprint $table) {
18+
$table->uuid('id')->unique();
19+
$table->char('cliente', 36)
20+
->index('pedido_pessoa_id_foreign');
21+
$table->foreign('cliente')->references('id')->on('pessoa');
22+
$table->integer('numero', true, false);
23+
$table->date('emissao');
24+
$table->double('total', 8, 2);
25+
});
26+
27+
// DB::unprepared('ALTER TABLE pedido DROP PRIMARY KEY');
28+
// DB::unprepared('ALTER TABLE pedido ADD PRIMARY KEY (id)');
29+
}
30+
31+
/**
32+
* Reverse the migrations.
33+
*
34+
* @return void
35+
*/
36+
public function down()
37+
{
38+
Schema::table('pedido', function ($table) {
39+
$table->dropForeign('pedido_pessoa_id_foreign');
40+
});
41+
Schema::dropIfExists('pedido');
42+
}
43+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class CreateOrderItemTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('item_pedido', function (Blueprint $table) {
17+
$table->uuid('id')->unique();
18+
$table->primary('id');
19+
$table->char('produto', 36)
20+
->index('item_pedido_produto_id_foreign');
21+
$table->foreign('produto')->references('id')->on('produto');
22+
$table->double('preco_unitario', 8, 2);
23+
$table->double('desconto', 8, 2);
24+
$table->double('total', 8, 2);
25+
});
26+
}
27+
28+
/**
29+
* Reverse the migrations.
30+
*
31+
* @return void
32+
*/
33+
public function down()
34+
{
35+
Schema::table('item_pedido', function ($table) {
36+
$table->dropForeign('item_pedido_produto_id_foreign');
37+
});
38+
Schema::dropIfExists('item_pedido');
39+
}
40+
}

resources/views/welcome.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979

8080
<div class="content">
8181
<div class="title m-b-md">
82-
Laravel
82+
Laravel {{app()::VERSION}}
8383
</div>
8484

8585
<div class="links">

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy