Compare commits

..

No commits in common. "1129a9e11bf2c05d2198ddc8e0d2a965001425e1" and "2a5cf1ccd99af5f8aac299184d4b4103d7f42440" have entirely different histories.

6 changed files with 0 additions and 148 deletions

View File

@ -23,12 +23,4 @@ public function region(): BelongsTo
{
return $this->belongsTo(Region::class);
}
/**
* Los pedidos que pertenecen al barrio.
*/
public function pedidos(): HasMany
{
return $this->hasMany(Pedido::class);
}
}

View File

@ -1,34 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Pedido extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
];
/**
* El barrio al que pertenece el pedido.
*/
public function barrio(): BelongsTo
{
return $this->belongsTo(Barrio::class);
}
/**
* Los productos que pertenecen al pedido.
*/
public function productos(): BelongsToMany
{
return $this->belongsToMany(Producto::class);
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Producto extends Model
{
/**
* Los pedidos que tienen al producto.
*/
public function pedidos(): BelongsToMany
{
return $this->belongsToMany(Pedido::class);
}
}

View File

@ -1,30 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('pedidos', function (Blueprint $table) {
$table->id();
$table->string('name', 100);
$table->unsignedBigInteger('barrio_id');
$table->foreign('barrio_id')->references('id')->on('barrios');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pedidos');
}
};

View File

@ -1,27 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('productos', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('productos');
}
};

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('productos_pedidos', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('pedido_id');
$table->unsignedBigInteger('producto_id');
$table->unsignedInteger('ammount');
$table->timestamps();
$table->foreign('pedido_id')->references('id')->on('pedidos');
$table->foreign('producto_id')->references('id')->on('productos');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('productos_pedidos');
}
};