porfavor hacer la migracion
This commit is contained in:
@@ -10,8 +10,8 @@ class ShowLogGeneral extends Component
|
||||
public $entradas;
|
||||
|
||||
public $buscar;
|
||||
public $filtro_fecha;
|
||||
|
||||
public $filtro_fecha;
|
||||
|
||||
public function render()
|
||||
{
|
||||
$query = Log_general::query();
|
||||
@@ -23,11 +23,12 @@ class ShowLogGeneral extends Component
|
||||
if ($this->filtro_fecha) {
|
||||
$query->whereDate('created_at', $this->filtro_fecha);
|
||||
}
|
||||
|
||||
$logs = $query->orderBy('id', 'desc')->paginate($this->entradas);
|
||||
|
||||
$logs = $query->orderBy('id', 'desc')->paginate($this->entradas);
|
||||
|
||||
return view('livewire.show-log-general', [
|
||||
'logs' => $logs
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Log_general;
|
||||
use App\Models\Log_historial;
|
||||
use App\Models\User;
|
||||
use Livewire\Component;
|
||||
|
||||
class ShowLogHistorial extends Component
|
||||
@@ -13,9 +14,11 @@ class ShowLogHistorial extends Component
|
||||
public $buscar;
|
||||
public $filtro_fecha;
|
||||
|
||||
public $user_id;
|
||||
|
||||
public function render()
|
||||
{
|
||||
$query = Log_general::query();
|
||||
$query = Log_historial::query();
|
||||
|
||||
if ($this->buscar) {
|
||||
$query->where('detalle', 'like', '%' . $this->buscar . '%');
|
||||
@@ -25,10 +28,17 @@ class ShowLogHistorial extends Component
|
||||
$query->whereDate('created_at', $this->filtro_fecha);
|
||||
}
|
||||
|
||||
if ($this->user_id) {
|
||||
$query->where('user_id', $this->user_id);
|
||||
}
|
||||
|
||||
$logs = $query->orderBy('id', 'desc')->paginate($this->entradas);
|
||||
|
||||
$users = User::orderBy('name')->get();
|
||||
|
||||
return view('livewire.show-log-historial', [
|
||||
'logs' => $logs
|
||||
'logs' => $logs,
|
||||
'users' => $users
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Models\Cuentas;
|
||||
use App\Models\Historiale;
|
||||
use App\Models\Historial_cuenta;
|
||||
use App\Models\Log_general;
|
||||
use App\Models\Log_historial;
|
||||
use App\Models\Notificacion;
|
||||
use App\Models\Pendientes;
|
||||
use App\Models\Role;
|
||||
@@ -280,6 +281,11 @@ class ShowPlanes extends Component
|
||||
$cuenta->estado = $this->estado;
|
||||
$cuenta->save();
|
||||
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha creado la cuenta ' . $cuenta->correo
|
||||
]);
|
||||
|
||||
if ($this->estado === 'activo') {
|
||||
$servicioPantallas = Servicio::find($this->servicio_newCuenta)->pantallas;
|
||||
|
||||
@@ -487,8 +493,24 @@ class ShowPlanes extends Component
|
||||
|
||||
public function eliminarCuentas()
|
||||
{
|
||||
$cuentas = Cuentas::whereIn('id', $this->delete_1)->get();
|
||||
|
||||
if ($cuentas) {
|
||||
forEach ($cuentas as $cuenta) {
|
||||
Log_historial::create([
|
||||
'user_id' => Auth::user()->id,
|
||||
'detalle' => 'El usuario ha eliminado la cuenta ' . $cuenta->correo
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$consulta_cuentas = Cuentas::whereIn('id', $this->delete_1)->delete();
|
||||
|
||||
$this->alert('success', 'Cuentas eliminadas correctamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
$this->delete_1 = [];
|
||||
}
|
||||
|
||||
public function openAdd()
|
||||
|
||||
Reference in New Issue
Block a user