Skip to content

Commit

Permalink
Code commenting: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Slymee committed Mar 28, 2024
1 parent af170ff commit b04bd6e
Show file tree
Hide file tree
Showing 14 changed files with 137 additions and 19 deletions.
9 changes: 8 additions & 1 deletion app/Http/Controllers/API/SellerProductAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@

class SellerProductAPIController extends Controller
{
protected $productRepository;
/**
* @var SellerProductRepositoryInterface
*/
protected SellerProductRepositoryInterface $productRepository;

/**
* @param SellerProductRepositoryInterface $productRepository
*/
public function __construct(SellerProductRepositoryInterface $productRepository)
{
$this->productRepository = $productRepository;
Expand Down
10 changes: 10 additions & 0 deletions app/Http/Controllers/API/UserAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public function destroy(User $user)
//
}


/**
* Authenticate User
* @param LoginRequest $request
* @return \Illuminate\Contracts\Foundation\Application|ResponseFactory|Application|\Illuminate\Http\Response
*/
public function loginUser(LoginRequest $request)//: Application|\Illuminate\Http\Response|\Illuminate\Contracts\Foundation\Application|ResponseFactory
{
if (Auth::attempt($request->all())){
Expand All @@ -63,6 +69,10 @@ public function loginUser(LoginRequest $request)//: Application|\Illuminate\Http
return Response(['status' => 401, 'token' => null], 200);
}

/**
* Get User Details
* @return \Illuminate\Contracts\Foundation\Application|ResponseFactory|Application|\Illuminate\Http\Response
*/
public function getUserDetail()//: Application|\Illuminate\Http\Response|\Illuminate\Contracts\Foundation\Application|ResponseFactory
{
$userCheck = Auth::guard('api_user')->check();
Expand Down
24 changes: 20 additions & 4 deletions app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@

class AdminController extends Controller
{
private $authService;
/**
* @var AuthService
*/
private AuthService $authService;

/**
* @param AuthService $authService
*/
public function __construct(AuthService $authService)
{
$this->authService = $authService;
}
//display login form

/**
* Login form
* @throws \Exception
*/
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
Expand All @@ -35,7 +43,11 @@ public function index(): View|Application|Factory|\Illuminate\Contracts\Foundati
}
}

//login module
/**
* Authenticate Admin
* @param LoginRequest $request
* @return Application|Redirector|\Illuminate\Contracts\Foundation\Application|RedirectResponse
*/
public function login(LoginRequest $request): Application|Redirector|\Illuminate\Contracts\Foundation\Application|RedirectResponse
{
try {
Expand All @@ -54,7 +66,11 @@ public function login(LoginRequest $request): Application|Redirector|\Illuminate
}


//logout module
/**
* Logout Admin
* @return Application|Redirector|RedirectResponse|\Illuminate\Contracts\Foundation\Application
* @throws \Exception
*/
public function logout(): Application|Redirector|RedirectResponse|\Illuminate\Contracts\Foundation\Application
{
try {
Expand Down
18 changes: 17 additions & 1 deletion app/Http/Controllers/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@

class CartController extends Controller
{
protected $cartRepository;
/**
* @var CartRepositoryInterface
*/
protected CartRepositoryInterface $cartRepository;

/**
* @param CartRepositoryInterface $cartRepository
*/
public function __construct(CartRepositoryInterface $cartRepository)
{
$this->cartRepository = $cartRepository;
}

/**
* Display a listing of the resource.
* @param string $userId
* @return \Illuminate\Contracts\View\View|\Illuminate\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\Foundation\Application
*/
public function index(string $userId): \Illuminate\Contracts\View\View|\Illuminate\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\Foundation\Application
{
Expand All @@ -36,6 +46,8 @@ public function create()

/**
* Store a newly created resource in storage.
* @param CartItemsRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(CartItemsRequest $request): \Illuminate\Http\RedirectResponse
{
Expand Down Expand Up @@ -63,6 +75,8 @@ public function edit(Cart $cart)

/**
* Update the specified resource in storage.
* @param CartItemsRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function update(CartItemsRequest $request)
{
Expand All @@ -75,6 +89,8 @@ public function update(CartItemsRequest $request)

/**
* Remove the specified resource from storage.
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Request $request): \Illuminate\Http\RedirectResponse
{
Expand Down
25 changes: 20 additions & 5 deletions app/Http/Controllers/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@

class CategoryController extends Controller
{
private $categoryRepository;
/**
* @var AdminCategoryRepositoryInterface
*/
private AdminCategoryRepositoryInterface $categoryRepository;

/**
* @param AdminCategoryRepositoryInterface $categoryRepository
*/
public function __construct(AdminCategoryRepositoryInterface $categoryRepository)
{
$this->categoryRepository = $categoryRepository;
}

/**
* Display a listing of the resource.
* @return View|Application|Factory|\Illuminate\Contracts\Foundation\Application
*/
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
Expand All @@ -34,6 +42,8 @@ public function index(): View|Application|Factory|\Illuminate\Contracts\Foundati

/**
* Show the form for creating a new resource.
* @param Category $category
* @return View|Application|Factory|\Illuminate\Contracts\Foundation\Application
*/
public function create(Category $category): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
Expand All @@ -42,9 +52,9 @@ public function create(Category $category): View|Application|Factory|\Illuminate
}

/**
*
*
* Store a newly created resource in storage.
* @param CategoryRequest $request
* @return RedirectResponse
*/
public function store(CategoryRequest $request): RedirectResponse
{
Expand Down Expand Up @@ -72,6 +82,8 @@ public function show(Category $category)

/**
* Show the form for editing the specified resource.
* @param string $id
* @return View|Application|Factory|\Illuminate\Contracts\Foundation\Application
*/
public function edit(string $id): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
Expand All @@ -82,6 +94,8 @@ public function edit(string $id): View|Application|Factory|\Illuminate\Contracts

/**
* Update the specified resource in storage.
* @param CategoryRequest $request
* @return RedirectResponse
*/
public function update(CategoryRequest $request): RedirectResponse
{
Expand All @@ -90,6 +104,8 @@ public function update(CategoryRequest $request): RedirectResponse

/**
* Remove the specified resource from storage.
* @param string $id
* @return RedirectResponse
*/
public function destroy(string $id): RedirectResponse
{
Expand All @@ -116,8 +132,7 @@ public function getPaginatedCategory(Request $request): JsonResponse
}

/**
* Getting paginated child category
*
* Getting paginated child categorys
* @param string $parentId
* @return JsonResponse
*/
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Controllers/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@

class CheckoutController extends Controller
{
/**
* @var CheckoutRepositoryInterface
*/
protected $checkoutRepository;
public function __construct(CheckoutRepositoryInterface $checkoutRepository)
{
$this->checkoutRepository = $checkoutRepository;
}

/**
* Display a listing of the resource.
* @param ProductCheckoutRequest $request
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Foundation\Application
* @throws \Exception
*/
public function index(ProductCheckoutRequest $request)
{
Expand Down
8 changes: 8 additions & 0 deletions app/Http/Controllers/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@

class CommentController extends Controller
{
/**
* @var CommentRepositoryInterface
*/
private $commentInterface;

/**
* @param CommentRepositoryInterface $commentInterface
*/
public function __construct(CommentRepositoryInterface $commentInterface)
{
$this->commentInterface = $commentInterface;
Expand All @@ -36,6 +42,8 @@ public function create()

/**
* Store a newly created resource in storage.
* @param ProductCommentRequest $request
* @return RedirectResponse
*/
public function store(ProductCommentRequest $request): RedirectResponse
{
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class DashboardController extends Controller
{
/**
* Display a listing of the resource.
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Foundation\Application
*/
public function index()
{
Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

class OrderController extends Controller
{
protected $orderRepository;
/**
* @var OrderRepositoryInterface
*/
protected OrderRepositoryInterface $orderRepository;

public function __construct(OrderRepositoryInterface $orderRepository)
{
Expand Down
8 changes: 7 additions & 1 deletion app/Http/Controllers/PasswordResetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ public function index(): View|Application|Factory|\Illuminate\Contracts\Foundati
}


//send reset mail to the user
/**
* Send reset mail to user
* @param ForgotPasswordRequest $request
* @return RedirectResponse
*/
public function sendResetMail(ForgotPasswordRequest $request): RedirectResponse
{
$token = Str::random(64);
Expand All @@ -61,6 +65,7 @@ public function sendResetMail(ForgotPasswordRequest $request): RedirectResponse


/**
* Display form for password submission
* @throws \Exception
*/
public function showNewPasswordForm(string $token): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
Expand All @@ -76,6 +81,7 @@ public function showNewPasswordForm(string $token): View|Application|Factory|\Il


/**
* Store new password
* @param ResetPasswordRequest $request
* @return string|RedirectResponse
* @throws \Exception
Expand Down
11 changes: 9 additions & 2 deletions app/Http/Controllers/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@

class ProductController extends Controller
{
private $productRepository;
/**
* @var ProductRepositoryInterface
*/
private ProductRepositoryInterface $productRepository;

/**
* @param ProductRepositoryInterface $productRepository
*/
public function __construct(ProductRepositoryInterface $productRepository)
{
$this->productRepository = $productRepository;
}

/**
* Display a listing of the resource.
* @throws \Exception
Expand Down Expand Up @@ -92,7 +99,7 @@ public function destroy(string $productId)
}

/**
* List products acording to category
* List products according to category
* @param string $categoryId
* @return View|Application|Factory|\Illuminate\Contracts\Foundation\Application
*/
Expand Down
9 changes: 8 additions & 1 deletion app/Http/Controllers/SellerProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@

class SellerProductController extends Controller
{
protected $productRepository;
/**
* @var SellerProductRepositoryInterface
*/
protected SellerProductRepositoryInterface $productRepository;

/**
* @param SellerProductRepositoryInterface $productRepository
*/
public function __construct(SellerProductRepositoryInterface $productRepository)
{
$this->productRepository = $productRepository;
Expand Down
17 changes: 15 additions & 2 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,28 @@

class UserController extends Controller
{
protected $userRepository;
private $authService;
/**
* @var UserRepositoryInterface
*/
protected UserRepositoryInterface $userRepository;

/**
* @var AuthService
*/
private AuthService $authService;

/**
* @param UserRepositoryInterface $userRepository
* @param AuthService $authService
*/
public function __construct(UserRepositoryInterface $userRepository, AuthService $authService)
{
$this->userRepository = $userRepository;
$this->authService = $authService;
}

/**
* Display form for user login
* @return View|Application|Factory|\Illuminate\Contracts\Foundation\Application
* @throws \Exception
*/
Expand Down
Loading

0 comments on commit b04bd6e

Please sign in to comment.