0% found this document useful (0 votes)
4 views2 pages

ReportController Method Overview

The ReportController contains two public methods: BookingReport(), which renders the booking report view without interacting with any models, and SearchByDate(Request $request), which retrieves bookings based on a specified date range. Both methods require backend access and are designed to be called via HTTP requests. Access control for these methods is managed through middleware to ensure only authorized users can access them.

Uploaded by

youngvicks2
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

ReportController Method Overview

The ReportController contains two public methods: BookingReport(), which renders the booking report view without interacting with any models, and SearchByDate(Request $request), which retrieves bookings based on a specified date range. Both methods require backend access and are designed to be called via HTTP requests. Access control for these methods is managed through middleware to ensure only authorized users can access them.

Uploaded by

youngvicks2
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ReportController Methods

Here’s a detailed breakdown of the ReportController methods and their visibility:

1. BookingReport():
o Purpose: Renders the booking report view.
o Access Level: Requires backend access.
o Visibility: Public.

php
Copy code
public function BookingReport(){
return view('[Link].booking_report');
}

2. SearchByDate(Request $request):
o Purpose: Searches bookings by a date range and renders the results.
o Access Level: Requires backend access.
o Visibility: Public.

php
Copy code
public function SearchByDate(Request $request){
$startDate = $request->input('start_date');
$endDate = $request->input('end_date');

$bookings = Booking::where('check_in', '>=', $startDate)-


>where('check_out', '<=', $endDate)->get();

return view('[Link].booking_search_date',
compact('startDate', 'endDate', 'bookings'));
}

Explanation of Access Levels

 Public Visibility: All methods in the ReportController are public because they
need to be accessible via HTTP requests routed through Laravel’s routing system.
This means they are callable by URLs defined in your route files (usually [Link] or
[Link]).
 Access Control: Typically, access control to ensure methods are only accessible by
authenticated users (and possibly users with specific roles or permissions) is handled
by middleware, not method visibility modifiers. In this case, ReportController
methods should be protected by middleware that ensures only authorized users can
access backend routes.

Interaction with the Booking Model

 BookingReport(): This method does not interact with any models. It simply returns a
view for booking reports.
 SearchByDate(Request $request): This method interacts with the Booking model to
fetch bookings within a specified date range and passes the results to a view for
rendering.

You might also like