Add calls and API to get user's fleet, determined by rank #35

This commit is contained in:
Nabeel Shahzad
2018-01-10 18:40:01 -06:00
parent 8aacd844b3
commit bf4e164e0d
6 changed files with 164 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Services;
use Illuminate\Support\Collection;
use Log;
use App\Facades\Utils;
use App\Models\User;
@@ -53,6 +54,18 @@ class UserService extends BaseService
return $user;
}
/**
* Return the subfleets this user is allowed access to,
* based on their current rank
* @param $user
* @return Collection
*/
public function getAllowableSubfleets($user)
{
$subfleets = $user->rank->subfleets();
return $subfleets->with('aircraft')->get();
}
/**
* Change the user's state. PENDING to ACCEPTED, etc
* Send out an email