Add public/private pages #641 (#644)

* Add public/private pages #641

* Cleanup the form requests
This commit is contained in:
Nabeel S
2020-03-28 13:03:52 -04:00
committed by GitHub
parent 4a3ec38919
commit 45873431e4
341 changed files with 9139 additions and 570 deletions

View File

@@ -8,11 +8,9 @@ class CommentRequest extends FormRequest
{
public function rules(): array
{
$rules = [
return [
'comment' => 'required',
'created_at' => 'sometimes|date',
];
return $rules;
}
}

View File

@@ -4,9 +4,6 @@ namespace App\Http\Requests\Acars;
use App\Contracts\FormRequest;
/**
* Class PrefileRequest
*/
class FieldsRequest extends FormRequest
{
public function rules(): array

View File

@@ -16,7 +16,7 @@ class FileRequest extends FormRequest
public function rules(): array
{
$rules = [
return [
'distance' => 'required|numeric',
'flight_time' => 'required|integer',
'fuel_used' => 'required|numeric',
@@ -48,7 +48,5 @@ class FileRequest extends FormRequest
'fares.*.id' => 'required',
'fares.*.count' => 'required|numeric',
];
return $rules;
}
}

View File

@@ -16,14 +16,12 @@ class LogRequest extends FormRequest
public function rules(): array
{
$rules = [
return [
'logs' => 'required|array',
'logs.*.log' => 'required',
'logs.*.lat' => 'sometimes|numeric',
'logs.*.lon' => 'sometimes|numeric',
'logs.*.created_at' => 'sometimes|date',
];
return $rules;
}
}

View File

@@ -19,7 +19,7 @@ class PositionRequest extends FormRequest
public function rules(): array
{
$rules = [
return [
'positions' => 'required|array',
'positions.*.lat' => 'required|numeric',
'positions.*.lon' => 'required|numeric',
@@ -36,7 +36,5 @@ class PositionRequest extends FormRequest
'positions.*.sim_time' => 'sometimes|date',
'positions.*.created_at' => 'sometimes|date',
];
return $rules;
}
}

View File

@@ -16,7 +16,7 @@ class RouteRequest extends FormRequest
public function rules(): array
{
$rules = [
return [
'route' => 'required|array',
'route.*.name' => 'required',
'route.*.order' => 'required|int',
@@ -24,7 +24,5 @@ class RouteRequest extends FormRequest
'route.*.lat' => 'required|numeric',
'route.*.lon' => 'required|numeric',
];
return $rules;
}
}

View File

@@ -16,7 +16,7 @@ class UpdateRequest extends FormRequest
public function rules(): array
{
$rules = [
return [
'airline_id' => 'nullable|exists:airlines,id',
'aircraft_id' => 'nullable|exists:aircraft,id',
'flight_id' => 'sometimes|nullable|exists:flights,id',
@@ -50,7 +50,5 @@ class UpdateRequest extends FormRequest
'fares.*.id' => 'required',
'fares.*.count' => 'required|numeric',
];
return $rules;
}
}

View File

@@ -2,8 +2,8 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Aircraft;
use Illuminate\Foundation\Http\FormRequest;
class CreateAircraftRequest extends FormRequest
{

View File

@@ -2,17 +2,12 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Airline;
use Illuminate\Foundation\Http\FormRequest;
class CreateAirlineRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
public function rules(): array
{
$rules = Airline::$rules;
$rules['iata'] .= '|unique:airlines';

View File

@@ -2,24 +2,11 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Airport;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class CreateAirportRequest
*/
class CreateAirportRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Award;
use Illuminate\Foundation\Http\FormRequest;
class CreateAwardRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Award::$rules;
}

View File

@@ -2,21 +2,11 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Fare;
use Illuminate\Foundation\Http\FormRequest;
class CreateFareRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Flight;
use Illuminate\Foundation\Http\FormRequest;
class CreateFlightRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Flight::$rules;
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Page;
class CreatePageRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return Page::$rules;
}
}

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\PirepField;
use Illuminate\Foundation\Http\FormRequest;
class CreatePirepFieldRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return PirepField::$rules;
}

View File

@@ -2,29 +2,18 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Pirep;
use App\Repositories\PirepFieldRepository;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
class CreatePirepRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
// Don't run validations if it's just being saved
$action = strtolower(request('submit', 'submit'));

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Rank;
use Illuminate\Foundation\Http\FormRequest;
class CreateRankRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Rank::$rules;
}

View File

@@ -2,16 +2,11 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Role;
use Illuminate\Foundation\Http\FormRequest;
class CreateRoleRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return Role::$rules;

View File

@@ -2,21 +2,11 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Subfleet;
use Illuminate\Foundation\Http\FormRequest;
class CreateSubfleetRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*

View File

@@ -2,21 +2,10 @@
namespace App\Http\Requests;
use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;
class CreateUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*

View File

@@ -2,7 +2,7 @@
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use App\Contracts\FormRequest;
use Illuminate\Http\Request;
/**
@@ -24,11 +24,6 @@ class ImportRequest extends FormRequest
\Validator::make($request->all(), static::$rules)->validate();
}
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return static::$rules;

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Aircraft;
use Illuminate\Foundation\Http\FormRequest;
class UpdateAircraftRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Aircraft::$rules;
}

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Airline;
use Illuminate\Foundation\Http\FormRequest;
class UpdateAirlineRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Airline::$rules;
}

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Airport;
use Illuminate\Foundation\Http\FormRequest;
class UpdateAirportRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Airport::$rules;
}

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Award;
use Illuminate\Foundation\Http\FormRequest;
class UpdateAwardRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Award::$rules;
}

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Fare;
use Illuminate\Foundation\Http\FormRequest;
class UpdateFareRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Fare::$rules;
}

View File

@@ -2,23 +2,10 @@
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use App\Contracts\FormRequest;
/**
* Class CreateFilesRequest
*/
class UpdateFilesRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
@@ -29,8 +16,6 @@ class UpdateFilesRequest extends FormRequest
return [
'name' => 'required',
'file' => 'nullable|file',
//'files.*' => 'required|file',
];
}
}

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Flight;
use Illuminate\Foundation\Http\FormRequest;
class UpdateFlightRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Flight::$rules;
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use Illuminate\Validation\Rule;
class UpdatePageRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
'name' => [
'required',
Rule::unique('pages')->ignore($this->id, 'id'),
],
'body' => 'required',
];
}
}

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\PirepField;
use Illuminate\Foundation\Http\FormRequest;
class UpdatePirepFieldRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return PirepField::$rules;
}

View File

@@ -2,29 +2,19 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Pirep;
use App\Repositories\PirepFieldRepository;
use Illuminate\Foundation\Http\FormRequest;
use Log;
use Illuminate\Support\Facades\Log;
class UpdatePirepRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
// Don't run validations if it's just being saved
$action = strtolower(request('submit', 'submit'));

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Rank;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRankRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Rank::$rules;
}

View File

@@ -2,24 +2,14 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Role;
use Illuminate\Foundation\Http\FormRequest;
/**
* @property array permissions
*/
class UpdateRoleRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*

View File

@@ -2,27 +2,17 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\Subfleet;
use Illuminate\Foundation\Http\FormRequest;
class UpdateSubfleetRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
return Subfleet::$rules;
}

View File

@@ -2,28 +2,18 @@
namespace App\Http\Requests;
use App\Contracts\FormRequest;
use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;
use function request;
class UpdateUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
public function rules(): array
{
$rules = User::$rules;