Skip to content

Commit

Permalink
seeder marcas
Browse files Browse the repository at this point in the history
  • Loading branch information
ionansantos committed Dec 28, 2023
1 parent 66b3081 commit 25b00c1
Show file tree
Hide file tree
Showing 70 changed files with 135 additions and 30 deletions.
Binary file modified .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function up()
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->boolean('isAdmin');
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateClientesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
Expand All @@ -13,9 +13,10 @@ class CreateClientesTable extends Migration
*/
public function up()
{
Schema::create('clientes', function (Blueprint $table) {
Schema::create('cidades', function (Blueprint $table) {
$table->id();
$table->string('nome', 30);
$table->string('nome');
$table->string('uf');
$table->timestamps();
});
}
Expand All @@ -27,6 +28,6 @@ public function up()
*/
public function down()
{
Schema::dropIfExists('clientes');
Schema::dropIfExists('cidades');
}
}
};
40 changes: 40 additions & 0 deletions database/migrations/2022_07_27_210220_create_agencias_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('agencias', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('cidade_id');
$table->string('nome', 20);
$table->string('endereco', 30);
$table->integer('telefone');
$table->dateTime('horario_ini');
$table->dateTime('horario_fim');
$table->timestamps();


$table->foreign('cidade_id')->references('id')->on('cidades');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('agencias');
}
};
2 changes: 2 additions & 0 deletions database/migrations/2022_08_26_040240_create_carros_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ public function up()
Schema::create('carros', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('modelo_id');
$table->unsignedBigInteger('agencia_id');
$table->string('placa', 10)->unique();
$table->boolean('disponivel');
$table->integer('km');
$table->timestamps();

//foreign key (constraints)
$table->foreign('modelo_id')->references('id')->on('modelos');
$table->foreign('agencia_id')->references('id')->on('agencias');
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function up()
{
Schema::create('locacoes', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('cliente_id');
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('carro_id');
$table->dateTime('data_inicio_periodo');
$table->dateTime('data_final_previsto_periodo');
Expand All @@ -26,7 +26,7 @@ public function up()
$table->timestamps();

//foreign key (constraints)
$table->foreign('cliente_id')->references('id')->on('clientes');
$table->foreign('user_id')->references('id')->on('users');
$table->foreign('carro_id')->references('id')->on('carros');
});
}
Expand Down
18 changes: 0 additions & 18 deletions database/seeders/ClienteSeeder.php

This file was deleted.

2 changes: 2 additions & 0 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->call(UserSeeder::class);
$this->call(MarcasSeeder::class);
// \App\Models\User::factory(10)->create();
}
}
43 changes: 43 additions & 0 deletions database/seeders/MarcasSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Illuminate\Database\Seeder;

class MarcasSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$marcaImagePath = 'marcas';

$marcas = [
'Chevrolet' => 'chevrolet.png',
'BMW' => 'bmw.png',
'Ford' => 'ford.png',
'Honda' => 'honda.png',
'Hyundai' => 'hyundai.png',
'Kia' => 'kia.png',
'Nissan' => 'nissan.png',
'Toyota' => 'toyota.png',
'Volkswagen' => 'volkswagen.png',
];

foreach ($marcas as $nomeMarca => $marcaImageName) {
DB::table('marcas')->insert([
'nome' => $nomeMarca,
'imagem' => "$marcaImagePath/$marcaImageName",
]);

// Armazenar a imagem no disco público
Storage::disk('public')->put("$marcaImagePath/$marcaImageName", file_get_contents(public_path("marcas/$marcaImageName")));
}
}
}
34 changes: 34 additions & 0 deletions database/seeders/UserSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;

class UserSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('users')->insert([
'name' => 'admin',
'email' => '[email protected]',
'isAdmin' => true,
'password' => Hash::make('admin123')
]);

DB::table('users')->insert([
'name' => 'cliente',
'email' => '[email protected]',
'isAdmin' => false,
'password' => Hash::make('cliente123')
]);
}
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"src": "resources/images/wallpaperHome.jpeg"
},
"resources/js/app.js": {
"file": "assets/app.fae00cae.js",
"file": "assets/app.72fe592d.js",
"src": "resources/js/app.js",
"isEntry": true,
"css": [
Expand Down
Binary file added public/marcas/bmw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/marcas/chevrolet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/marcas/ford.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/marcas/honda.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/marcas/hyundai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/marcas/kia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/marcas/nissan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/marcas/toyota.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/marcas/volkswagen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/modelos/ford_ka_1_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/modelos/ford_ka_sedan_1_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/modelos/hyundai_hb20_1_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/modelos/hyundai_hb20s_1_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/modelos/onix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/modelos/prisma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/modelos/volkswagen_gol_1_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/modelos/volkswagen_gol_1_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/modelos/volkswagen_polo_1_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/.DS_Store
100644 → 100755
Binary file not shown.
Empty file modified resources/css/app.css
100644 → 100755
Empty file.
Binary file added resources/images/.DS_Store
Binary file not shown.
Empty file modified resources/images/banners-logos.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified resources/images/car-logo-reg.webp
100644 → 100755
Empty file.
Empty file modified resources/images/car-logo.webp
100644 → 100755
Empty file.
Empty file modified resources/images/car-logo.webp:Zone.Identifier
100644 → 100755
Empty file.
Empty file modified resources/images/lotus.webp
100644 → 100755
Empty file.
Empty file modified resources/images/lotus.webp:Zone.Identifier
100644 → 100755
Empty file.
Empty file modified resources/images/wallpaperHome.jpeg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified resources/js/Components/card-search.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Components/customInput.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Components/footer.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Components/menu-item.vue
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions resources/js/Components/menu.vue
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<nav class="navbar navbar-expand-lg bg-body-tertiary px-3 py-2 bg-white rounded shadow-sm">
<div v-if="!user['name']" class="container-fluid">
<nav v-if="!user['name']" class="navbar navbar-expand-lg bg-body-tertiary px-3 py-2 bg-white rounded shadow-sm">
<div class="container-fluid">
<a class="navbar-brand" href="#">Loca+</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
Expand Down
Empty file modified resources/js/Components/sideMenu.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Pages/carros.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Pages/dashboard.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Pages/home.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Pages/locacoes.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Pages/login.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Pages/marcas.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Pages/modelos.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Pages/perfil.vue
100644 → 100755
Empty file.
Empty file modified resources/js/Pages/register.vue
100644 → 100755
Empty file.
Empty file modified resources/js/app.js
100644 → 100755
Empty file.
Empty file modified resources/js/bootstrap.js
100644 → 100755
Empty file.
Empty file modified resources/js/plugins/axios.js
100644 → 100755
Empty file.
Empty file modified resources/js/plugins/fontawesome.js
100644 → 100755
Empty file.
Empty file modified resources/js/store/marca.js
100644 → 100755
Empty file.
Empty file modified resources/js/store/user.js
100644 → 100755
Empty file.
Empty file modified resources/lang/en/auth.php
100644 → 100755
Empty file.
Empty file modified resources/lang/en/pagination.php
100644 → 100755
Empty file.
Empty file modified resources/lang/en/passwords.php
100644 → 100755
Empty file.
Empty file modified resources/lang/en/validation.php
100644 → 100755
Empty file.
Empty file modified resources/sass/_variables.scss
100644 → 100755
Empty file.
Empty file modified resources/sass/app.scss
100644 → 100755
Empty file.
Empty file modified resources/views/app.blade.php
100644 → 100755
Empty file.
Empty file modified resources/views/error.blade.php
100644 → 100755
Empty file.
Empty file modified resources/views/welcome.blade.php
100644 → 100755
Empty file.

0 comments on commit 25b00c1

Please sign in to comment.