0
\$\begingroup\$

I’ve built a backend-only wallet service using Laravel 8, and it’s fully containerized with Docker. The project handles two user roles (Players and Backoffice Agents) and provides JWT-based authentication, Redis caching, and a CI/CD pipeline.

I want to make sure my code structure, database schema, and API design follow best practices and are scalable.

The full project is available here for reference: https://github.com/sirinberhus/wallet-app

I’d really appreciate any feedback, tips, or suggestions to make this backend more robust, secure, and maintainable.

class BoPromotionController extends Controller
{
 public function getPromotions()
 {
 $promotions = Promotion::with('rewards')->paginate(10);
 return PromotionResource::collection($promotions);
 }
 public function createPromotion(CreatePromotionRequest $request, PromotionService $promotionService)
 {
 $validatedData = $request->validated();
 try {
 $promotion = $promotionService->create($validatedData);
 return response()->json([
 'message' => 'Promotion and rewards created successfully',
 'promotion' => $promotion->load('rewards') // load rewards relationship
 ]);
 } catch (Exception $e) {
 return response()->json([
 'error' => 'Failed to create promotion',
 'details' => $e->getMessage(),
 ], 500); //internal server error
 }
 }
toolic
14.3k5 gold badges29 silver badges200 bronze badges
asked 2 days ago
New contributor
Şirin Berhuş is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to Code Review! If you would like more code than just the two methods reviewed then please expand the code here. For more information Please see this meta post. Links to code hosted on third-party sites are permissible, but the most relevant excerpts must be embedded in the question itself. A stack snippet could also be used to embed the code. \$\endgroup\$ Commented 2 days ago

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.