promociones validadas
This commit is contained in:
@@ -104,7 +104,7 @@ class ShowPromociones extends Component
|
||||
'nombre_comprarPromo' => 'required',
|
||||
'celular_comprarPromo' => 'required',
|
||||
'email_comprarPromo' => 'required',
|
||||
'cantidad_comprarPromo' => 'required',
|
||||
'cantidad_comprarPromo' => 'required|numeric|min:1',
|
||||
];
|
||||
|
||||
public function render()
|
||||
@@ -207,9 +207,22 @@ class ShowPromociones extends Component
|
||||
|
||||
public function pagar()
|
||||
{
|
||||
|
||||
$this->validate();
|
||||
|
||||
if ($this->cantidad_comprarPromo == 0){
|
||||
$this->alert('error', 'La cantidad debe ser mayor a 0', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (auth()->user()->saldo->valor < $this->precioAhora * $this->cantidad_comprarPromo) {
|
||||
$this->alert('error', 'Saldo insuficiente', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$usuario_existe = User::firstWhere('email', $this->email_comprarPromo)->id ?? null;
|
||||
|
||||
if (is_null($usuario_existe)) {
|
||||
|
||||
Reference in New Issue
Block a user