-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flights filtered per va #242
Conversation
Sorry to be nitpicky, but no tabs, please. Indent with 4 spaces. Also, create a new setting in the settings migration file, after $this->addSetting('pilots.restrict_to_company', [
'name' => 'Restrict the flights to company',
'group' => 'pilots',
'value' => false,
'type' => 'boolean',
'description' => 'Restrict flights to the user\'s airline',
]); And check it before adding it to the where: if(setting('pilots.restrict_to_company')) {
$where['airline_id'] = Auth::user()->airline_id;
} Leave the translations out for now, for the settings. |
@@ -68,6 +69,8 @@ public function index(Request $request) | |||
|
|||
$flights = $this->flightRepo | |||
->orderBy('flight_number', 'asc') | |||
->orderBy('route_leg', 'asc') | |||
->orderBy('route_code', 'asc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave code out, for now
@@ -94,7 +97,7 @@ public function bids(Request $request) | |||
$saved_flights = $flights->pluck('id')->toArray(); | |||
|
|||
return view('flights.index', [ | |||
'title' => 'Bids', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave translations out until I fix the other commit. I'm rearranging some of the files.
@@ -110,8 +113,14 @@ public function bids(Request $request) | |||
*/ | |||
public function search(Request $request) | |||
{ | |||
$flights = $this->flightRepo->searchCriteria($request)->paginate(); | |||
|
|||
$request['airline_id'] = Auth::user()->airline_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave this out from the $request
. Instead, add as a separate $where, after checking if the setting is enabled. No tabs
@@ -52,7 +52,8 @@ public function __construct( | |||
public function index(Request $request) | |||
{ | |||
$where = [ | |||
'active' => true | |||
'active' => true, | |||
'airline_id' => Auth::user()->airline_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No tabs
->orderBy('flight_number', 'asc') | ||
->orderBy('route_leg', 'asc') | ||
->orderBy('route_code', 'asc') | ||
->paginate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And no tabs
A test should also be added for this, in the |
…ent = true and departure airport is not the same pilot's current airport.
And just check with me first before adding features or whatever, I have a very specific way for implementing of a lot of them, or I have them completed already. This is an example of one I've already got done, but not pushed up yet... because there are changes to the API layer that I haven't written the tests for yet. |
added setting corrected code
Looks good, also needs to be done in |
All done my lord ;) Now i must go to work, leave me an email at pva0001@piemontevirtualairlines.tk if you want me to do something special, or i'll wait for your commit on translation to go forward with the admin panel translation. |
Forgot to say: the menu icon on mobile devices still doesn't work and i have no clue on what to do to fix it... |
Yeah I have to look at that. Merged, thanks!! |
Pilots now see only their company's flights.