Skip to content

Commit

Permalink
Merge pull request #87 from Crudzaso/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
DiegoAndresRamirez authored Dec 2, 2024
2 parents 0abe89d + 52a9488 commit 3cc446b
Show file tree
Hide file tree
Showing 9 changed files with 302 additions and 226 deletions.
15 changes: 15 additions & 0 deletions Modules/Payment/app/Http/Controllers/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,19 @@ public function destroy($id)

return redirect()->route('payment.index')->with('success', 'Pago eliminado exitosamente.');
}

public function createPayment(Request $request)
{
$user = auth()->user();

$payment = Payment::create([
'user_id' => $request->user_id,
'raffle_id' => $request->raffle_id,
'amount' => $request->amount,
'payment_method' => $request->payment_method,
'payment_date' => $request->payment_date,
]);

return response()->json(['status' => 'success', 'payment' => $payment]);
}
}
10 changes: 5 additions & 5 deletions Modules/Ticket/app/Http/Controllers/TicketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public function store(Request $request)
$request->validate([
'raffle_id' => 'required|exists:raffles,id',
'user_id' => 'required|exists:users,id',
'ticket_number' => 'required|string|max:10',
'purchase_date' => 'nullable|date',
'end_date' => 'nullable|date|after_or_equal:purchase_date',
'ticket_number' => 'required|integer',
'purchase_date' => 'required|date',
'end_date' => 'required|date|after_or_equal:purchase_date',
'verification_code' => 'required|string|max:50',
]);

Ticket::create($request->all());
$ticket = Ticket::create($request->all());

return redirect()->route('tickets.index')->with('success', 'Ticket creado exitosamente.');
return response()->json(['status' => 'success', 'ticket' => $ticket]);
}

public function edit($id)
Expand Down
8 changes: 6 additions & 2 deletions app/Http/Middleware/HandleInertiaRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ public function share(Request $request): array
{
return array_merge(parent::share($request), [
'auth' => [
'user' => Auth::user(),
],
'user' => $request->user() ? [
'id' => $request->user()->id,
'name' => $request->user()->name,
'email' => $request->user()->email,
] : null,
],
]);
}
}
6 changes: 3 additions & 3 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use Inertia\Inertia;

class AppServiceProvider extends ServiceProvider
{
Expand All @@ -26,9 +27,8 @@ public function boot(): void
if ($this->app->environment('production')) {
URL::forceScheme('https');
}

View::share('authUser', Auth::user());

set_time_limit(env('APP_MAX_EXECUTION_TIME', 500));

}
}
2 changes: 2 additions & 0 deletions bootstrap/providers.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
App\Providers\JetstreamServiceProvider::class,
App\Providers\TelescopeServiceProvider::class,
Spatie\Permission\PermissionServiceProvider::class,


];
Loading

0 comments on commit 3cc446b

Please sign in to comment.