Erster Upload

This commit is contained in:
Malek Tellissi
2026-09-11 01:17:47 +02:00
commit 400172cdde
171 changed files with 18844 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Batch extends Model
{
protected $fillable = ['lot_number', 'product_id', 'recipe_id', 'produced_at', 'expires_at'];
protected $casts = [
'produced_at' => 'date',
'expires_at' => 'date',
];
public function product()
{
return $this->belongsTo(Product::class);
}
public function recipe()
{
return $this->belongsTo(Recipe::class);
}
public function origins()
{
return $this->hasMany(BatchOrigin::class);
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BatchOrigin extends Model
{
protected $fillable = ['batch_id', 'spice_id', 'supplier_id', 'origin_country', 'farmer', 'notes'];
public function batch()
{
return $this->belongsTo(Batch::class);
}
public function spice()
{
return $this->belongsTo(Spice::class);
}
public function supplier()
{
return $this->belongsTo(Supplier::class);
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Packing extends Model
{
use HasFactory;
protected $fillable = ['name', 'size'];
public function products() {
return $this->belongsToMany(Product::class, 'products_sizes')
->withPivot('price')
->withPivot('description')
->withTimestamps();
}
}
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
protected $fillable = ['title', 'description', 'images', 'package_content', 'recipes_id'];
protected $casts = [
'images' => 'array',
];
public function recipe()
{
return $this->belongsTo(Recipe::class, 'recipes_id');
}
public function sizes()
{
return $this->belongsToMany(Packing::class, 'products_sizes')
->withPivot('price')
->withPivot('description')
->withTimestamps();
}
public function inventories()
{
return $this->hasMany(ProductInventory::class);
}
public function batches()
{
return $this->hasMany(Batch::class);
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProductInventory extends Model
{
protected $fillable = ['product_id', 'size_id', 'out_at'];
protected $table = 'products_inventory';
public function product()
{
return $this->belongsTo(product::class);
}
public function size()
{
return $this->belongsTo(ProductSize::class);
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProductSale extends Model
{
protected $table = 'products_sales';
protected $fillable = [
'product_id',
'size_id',
'amount',
'sold_at',
];
// Beziehungen
public function product()
{
return $this->belongsTo(Product::class);
}
public function size()
{
return $this->belongsTo(ProductSize::class);
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProductSize extends Model
{
use HasFactory;
protected $table = 'products_sizes';
protected $fillable = ['product_id', 'packing_id', 'sku', 'price', 'description'];
public function product() {
return $this->belongsTo(Product::class);
}
public function packing() {
return $this->belongsTo(Packing::class);
}
public function inventories() {
return $this->hasMany(ProductInventory::class);
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Recipe extends Model
{
use HasFactory;
protected $fillable = ['name', 'description'];
public function spices()
{
return $this->belongsToMany(Spice::class, 'recipes_spices')
->withPivot('amount_in_percent')
->withTimestamps();
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class RecipeSpice extends Model
{
use HasFactory;
protected $table = 'recipes_spices';
protected $fillable = ['recipe_id', 'spice_id', 'amount_in_percent'];
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Spice extends Model
{
protected $fillable = ['name', 'quantity', 'unit'];
public function recipes()
{
return $this->belongsToMany(Recipe::class, 'recipes_spices')
->withPivot('amount_in_percent')
->withTimestamps();
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SpiceSupplier extends Model
{
use HasFactory;
protected $table = 'spices_suppliers'; // explizit, weil der Standard sonst 'spice_suppliers' wäre
protected $fillable = [
'spice_id',
'supplier_id',
'amount',
'supplied_at',
];
// Beziehungen
public function spice()
{
return $this->belongsTo(Spice::class);
}
public function supplier()
{
return $this->belongsTo(Supplier::class);
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Supplier extends Model
{
use HasFactory;
protected $fillable = ['name'];
public function spiceSuppliers()
{
return $this->hasMany(SpiceSupplier::class);
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Models;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable implements FilamentUser
{
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
public function canAccessPanel(Panel $panel): bool
{
return true; // allow all authenticated users access to the dashboard
}
}