Initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Categoria extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'nombre',
|
||||
'descripcion',
|
||||
'imagen',
|
||||
];
|
||||
|
||||
public function promociones(){
|
||||
return $this ->hasMany(Promociones::class,'categoria_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Configuracione extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'color_boton',
|
||||
'color_barra',
|
||||
'color_menu',
|
||||
'url_logo',
|
||||
'nombre',
|
||||
'slogan',
|
||||
'usermodifico_id',
|
||||
'top_1',
|
||||
'top_2',
|
||||
'top_3',
|
||||
'top_4',
|
||||
'top_5',
|
||||
'top_6',
|
||||
'top_7',
|
||||
'top_8',
|
||||
'top_9',
|
||||
'top_10',
|
||||
|
||||
'img_top',
|
||||
'mensaje_top',
|
||||
'premio_1',
|
||||
'premio_2',
|
||||
'premio_3',
|
||||
'premio_4',
|
||||
'premio_5',
|
||||
'premio_6',
|
||||
'premio_7',
|
||||
'premio_8',
|
||||
'premio_9',
|
||||
'premio_10',
|
||||
|
||||
'msj_compra',
|
||||
'msj_wp',
|
||||
'clave_1',
|
||||
'clave_2',
|
||||
'clave_3',
|
||||
'clave_4',
|
||||
'clave_5',
|
||||
'clave_6',
|
||||
'iptv',
|
||||
'hora',
|
||||
'visto',
|
||||
];
|
||||
|
||||
public function usuario(){
|
||||
return $this ->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function redes(){
|
||||
return $this ->hasMany(Rede::class,'configuracion_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Cuentas extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'correo',
|
||||
'password',
|
||||
'vencimiento',
|
||||
'estado',
|
||||
'tarifa_id',
|
||||
'promocion_id',
|
||||
'inicio',
|
||||
'servicio_id'
|
||||
];
|
||||
|
||||
public function tarifa(){
|
||||
return $this ->belongsTo(Tarifas::class);
|
||||
}
|
||||
|
||||
public function promocion(){
|
||||
return $this ->belongsTo(Promociones::class);
|
||||
}
|
||||
|
||||
public function historiales(){
|
||||
return $this ->belongsToMany(Historiale::class,'historial_cuentas','cuenta_id','historial_id');
|
||||
}
|
||||
|
||||
public function perfil(){
|
||||
return $this ->hasMany(Historial_cuenta::class,'cuenta_id');
|
||||
}
|
||||
|
||||
public function servicio(){
|
||||
return $this ->belongsTo(Servicio::class);
|
||||
}
|
||||
|
||||
public function historiales_obsoletos(){
|
||||
return $this ->belongsToMany(Historiale::class,'logs','cuenta_id','historial_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Historial_cuenta extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'historial_id',
|
||||
'cuenta_id',
|
||||
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Historiale extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'fecha_inicio',
|
||||
'fecha_final',
|
||||
'valor',
|
||||
'tipo_pago',
|
||||
'estado',
|
||||
'vendedor_id',
|
||||
'tarifa_id',
|
||||
'promocion_id',
|
||||
'cliente_id',
|
||||
'nombre_cliente'
|
||||
];
|
||||
|
||||
public function vendedor(){
|
||||
return $this ->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function tarifa(){
|
||||
return $this ->belongsTo(Tarifas::class);
|
||||
}
|
||||
|
||||
public function promocion(){
|
||||
return $this ->belongsTo(Promociones::class);
|
||||
}
|
||||
|
||||
public function cliente(){
|
||||
return $this ->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function cuentas(){
|
||||
return $this ->belongsToMany(Cuentas::class,'historial_cuentas','historial_id','cuenta_id');
|
||||
}
|
||||
|
||||
public function cuentas_obsoletas(){
|
||||
return $this ->belongsToMany(Cuentas::class,'logs','historial_id','cuenta_id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Permiso extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'vista',
|
||||
'usuario_id',
|
||||
'rol_id'
|
||||
];
|
||||
|
||||
public function rol(){
|
||||
return $this ->belongsTo(Role::class);
|
||||
}
|
||||
|
||||
public function usuario(){
|
||||
return $this ->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Preferencial extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'valor',
|
||||
'usuario_id',
|
||||
'tarifa_id'
|
||||
];
|
||||
|
||||
public function usuario(){
|
||||
return $this ->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function tarifa(){
|
||||
return $this ->belongsTo(Tarifas::class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Promocion_tarifa extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'promocion_id',
|
||||
'tarifa_id',
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
//public function promocion_tarifa(){
|
||||
// return $this ->belongsTo(Promociones::class,'promocion_id');
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Promociones extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'precio',
|
||||
'img_publicidad',
|
||||
'fecha_limite',
|
||||
'visible',
|
||||
'categoria_id'
|
||||
];
|
||||
public function categoria(){
|
||||
return $this ->belongsTo(Categoria::class);
|
||||
}
|
||||
|
||||
public function servicios(){
|
||||
return $this ->hasMany(Servicio::class,'promocion_id');
|
||||
}
|
||||
|
||||
public function cuentas(){
|
||||
return $this ->hasMany(Cuentas::class,'promocion_id');
|
||||
}
|
||||
|
||||
public function historiales(){
|
||||
return $this ->hasMany(Historiale::class,'promocion_id');
|
||||
}
|
||||
|
||||
|
||||
public function tarifas(){
|
||||
return $this ->belongsToMany(Tarifas::class,'promocion_tarifas','promocion_id','tarifa_id');
|
||||
}
|
||||
|
||||
public function usuario_promos(){
|
||||
return $this ->hasMany(Usuario_promo::class,'promocion_id');
|
||||
}
|
||||
|
||||
public function tarifaPromo(){
|
||||
return $this ->hasMany(TarifaPromo::class,'promocion_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Rede extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'nombre',
|
||||
'url',
|
||||
'configuracion_id'
|
||||
];
|
||||
|
||||
public function configuracion(){
|
||||
return $this ->belongsTo(Configuracione::class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Role extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'nombre',
|
||||
|
||||
];
|
||||
|
||||
public function usuarios(){
|
||||
return $this ->hasMany(User::class,'rol_id');
|
||||
}
|
||||
|
||||
public function permisos(){
|
||||
return $this ->hasMany(Permiso::class,'rol_id');
|
||||
}
|
||||
|
||||
public function tarifas(){
|
||||
return $this ->hasMany(Tarifas::class,'rol_id');
|
||||
}
|
||||
|
||||
public function rol_promos(){
|
||||
return $this ->hasMany(TarifaPromo::class,'rol_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Saldo extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'valor',
|
||||
'usuario_id'
|
||||
];
|
||||
|
||||
public function usuario(){
|
||||
return $this ->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function recargas(){
|
||||
return $this ->hasMany(recarga::class, 'saldo_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Servicio extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'nombre',
|
||||
'descripcion',
|
||||
'color_fondo',
|
||||
'estado',
|
||||
'img',
|
||||
'promocion_id',
|
||||
'pantallas',
|
||||
'img_inicio',
|
||||
'mensaje',
|
||||
'completa',
|
||||
'ver_perfiles',
|
||||
'perfiles',
|
||||
'ver_url',
|
||||
'url',
|
||||
'por_tiempo',
|
||||
'renovacion'
|
||||
|
||||
];
|
||||
|
||||
public function promocion(){
|
||||
return $this ->belongsTo(Promociones::class);
|
||||
}
|
||||
|
||||
public function tarifas(){
|
||||
return $this ->hasMany(Tarifas::class,'servicio_id');
|
||||
}
|
||||
|
||||
public function cuentas(){
|
||||
return $this ->hasMany(Cuentas::class,'servicio_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TarifaPromo extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'promocion_id',
|
||||
'rol_id',
|
||||
'precio',
|
||||
'visible',
|
||||
|
||||
];
|
||||
|
||||
public function rol(){
|
||||
return $this ->belongsTo(Role::class,'rol_id');
|
||||
}
|
||||
|
||||
public function promocion(){
|
||||
return $this ->belongsTo(Promociones::class,'promocion_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Tarifas extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'pantallas',
|
||||
'dias',
|
||||
'valor',
|
||||
'estado',
|
||||
'servicio_id',
|
||||
'rol_id'
|
||||
|
||||
];
|
||||
|
||||
public function servicio(){
|
||||
return $this ->belongsTo(Servicio::class);
|
||||
}
|
||||
|
||||
public function preferenciales(){
|
||||
return $this ->hasMany(Preferencial::class,'tarifa_id');
|
||||
}
|
||||
|
||||
public function cuentas(){
|
||||
return $this ->hasMany(Cuentas::class,'tarifa_id');
|
||||
}
|
||||
|
||||
public function historiales(){
|
||||
return $this ->hasMany(Historiale::class,'tarifa_id');
|
||||
}
|
||||
|
||||
public function promociones(){
|
||||
return $this ->belongsToMany(Promociones::class,'promocion_tarifas','tarifa_id','promocion_id');
|
||||
}
|
||||
|
||||
public function rol(){
|
||||
return $this ->belongsTo(Role::class);
|
||||
}
|
||||
|
||||
public function usuario_tarifas(){
|
||||
return $this ->hasMany(Usuario_tarifa::class,'tarifa_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'cedula',
|
||||
'estado',
|
||||
'img_perfil',
|
||||
'rol_id'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function rol(){
|
||||
return $this ->belongsTo(Role::class);
|
||||
}
|
||||
|
||||
public function saldo(){
|
||||
return $this ->hasOne(Saldo::class,'usuario_id');
|
||||
}
|
||||
|
||||
public function modificaciones(){
|
||||
return $this ->hasOne(Configuracione::class,'usermodifico_id');
|
||||
}
|
||||
|
||||
public function permisos(){
|
||||
return $this ->hasMany(Permiso::class,'usuario_id');
|
||||
}
|
||||
|
||||
public function preferenciales(){
|
||||
return $this ->hasMany(Preferencial::class,'usuario_id');
|
||||
}
|
||||
|
||||
public function historiales_venta(){
|
||||
return $this ->hasMany(Historiale::class,'vendedor_id');
|
||||
}
|
||||
|
||||
public function historiales_compra(){
|
||||
return $this ->hasMany(Historiale::class,'cliente_id');
|
||||
}
|
||||
|
||||
public function recargas(){
|
||||
return $this ->hasMany(recarga::class,'usuario_id');
|
||||
}
|
||||
|
||||
public function usuario_tarifas(){
|
||||
return $this ->hasMany(Usuario_tarifa::class,'usuario_id');
|
||||
}
|
||||
public function usuario_promos(){
|
||||
return $this ->hasMany(Usuario_promo::class,'usuario_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Usuario_promo extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $hidden = [
|
||||
'usuario_id',
|
||||
'promocion_id',
|
||||
'precio',
|
||||
'visible',
|
||||
|
||||
];
|
||||
|
||||
public function usuario(){
|
||||
return $this ->belongsTo(User::class,'usuario_id');
|
||||
}
|
||||
|
||||
public function promocion(){
|
||||
return $this ->belongsTo(Promociones::class,'promocion_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Usuario_tarifa extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'usuario_id',
|
||||
'tarifa_id',
|
||||
'precio',
|
||||
'visible',
|
||||
|
||||
];
|
||||
|
||||
public function usuario(){
|
||||
return $this ->belongsTo(User::class,'usuario_id');
|
||||
}
|
||||
|
||||
public function tarifa(){
|
||||
return $this ->belongsTo(Tarifas::class,'tarifa_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class log extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class recarga extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'payment_type_id',
|
||||
'payment_method_id',
|
||||
'status',
|
||||
'usuario_id',
|
||||
'saldo_id',
|
||||
'reference',
|
||||
'monto',
|
||||
'valor_recarga'
|
||||
|
||||
];
|
||||
public function usuario(){
|
||||
return $this ->belongsTo(User::class);
|
||||
}
|
||||
public function saldo(){
|
||||
return $this ->belongsTo(Saldo::class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class slider extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'slider',
|
||||
|
||||
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user