Proveedores
This commit is contained in:
@@ -10,6 +10,16 @@ class Proveedor extends Model {
|
||||
use UuidPrimaryKey, SoftDeletes;
|
||||
|
||||
protected $table = 'proveedores';
|
||||
protected $fillable = [
|
||||
'id', 'rut', 'nombre', 'descripcion',
|
||||
'direccion', 'telefono', 'restaurante_id'
|
||||
];
|
||||
|
||||
public static function findOrFail($id) {
|
||||
$proveedor = Proveedor::find($id);
|
||||
if(!$proveedor) throw new ModelNotFoundException("proveedor", $id);
|
||||
return $proveedor;
|
||||
}
|
||||
|
||||
public function restaurante() {
|
||||
return $this->belongsTo(Restaurante::class);
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Models\CanalVenta;
|
||||
use App\Models\Sector;
|
||||
use App\Models\ZonaProduccion;
|
||||
use App\Models\Categoria;
|
||||
use App\Models\Proveedor;
|
||||
use App\Traits\UuidPrimaryKey;
|
||||
use App\Exceptions\ModelNotFoundException;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -45,4 +46,8 @@ class Restaurante extends Model {
|
||||
public function categorias() {
|
||||
return $this->hasMany(Categoria::class, 'restaurante_id');
|
||||
}
|
||||
|
||||
public function proveedores() {
|
||||
return $this->hasMany(Proveedor::class, 'restaurante_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user