* Add public/private pages #641 * Cleanup the form requests
This commit is contained in:
38
app/Http/Composers/PageLinksComposer.php
Normal file
38
app/Http/Composers/PageLinksComposer.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Composers;
|
||||
|
||||
use App\Contracts\Composer;
|
||||
use App\Repositories\PageRepository;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class PageLinksComposer extends Composer
|
||||
{
|
||||
protected $pageRepo;
|
||||
|
||||
/**
|
||||
* PageLinksComposer constructor.
|
||||
*
|
||||
* @param \App\Repositories\PageRepository $pageRepo
|
||||
*/
|
||||
public function __construct(PageRepository $pageRepo)
|
||||
{
|
||||
$this->pageRepo = $pageRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\View\View $view
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
// If not logged in, then only get the public pages
|
||||
$w = ['enabled' => true];
|
||||
if (!Auth::check()) {
|
||||
$w = ['public' => true];
|
||||
}
|
||||
|
||||
$pages = $this->pageRepo->findWhere($w, ['id', 'name', 'slug', 'icon']);
|
||||
$view->with('page_links', $pages);
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace App\Http\Composers;
|
||||
|
||||
use App\Contracts\Composer;
|
||||
use App\Services\VersionService;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class VersionComposer
|
||||
class VersionComposer extends Composer
|
||||
{
|
||||
protected $versionSvc;
|
||||
|
||||
|
||||
152
app/Http/Controllers/Admin/PagesController.php
Normal file
152
app/Http/Controllers/Admin/PagesController.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Http\Requests\CreatePageRequest;
|
||||
use App\Http\Requests\UpdatePageRequest;
|
||||
use App\Repositories\PageRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Laracasts\Flash\Flash;
|
||||
|
||||
class PagesController extends Controller
|
||||
{
|
||||
private $pageRepo;
|
||||
|
||||
/**
|
||||
* @param PageRepository $pageRepo
|
||||
*/
|
||||
public function __construct(PageRepository $pageRepo)
|
||||
{
|
||||
$this->pageRepo = $pageRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$pages = $this->pageRepo->all();
|
||||
|
||||
return view('admin.pages.index', [
|
||||
'pages' => $pages,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new Airlines.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.pages.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created Airlines in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\CreatePageRequest $request
|
||||
*
|
||||
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function store(CreatePageRequest $request)
|
||||
{
|
||||
$input = $request->all();
|
||||
$this->pageRepo->create($input);
|
||||
|
||||
Flash::success('Page saved successfully.');
|
||||
return redirect(route('admin.pages.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified page
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$pages = $this->pageRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($pages)) {
|
||||
Flash::error('Page not found');
|
||||
return redirect(route('admin.page.index'));
|
||||
}
|
||||
|
||||
return view('admin.pages.show', [
|
||||
'pages' => $pages,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified pages
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$page = $this->pageRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($page)) {
|
||||
Flash::error('Page not found');
|
||||
return redirect(route('admin.pages.index'));
|
||||
}
|
||||
|
||||
return view('admin.pages.edit', [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified Airlines in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @param UpdatePageRequest $request
|
||||
*
|
||||
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function update($id, UpdatePageRequest $request)
|
||||
{
|
||||
$page = $this->pageRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($page)) {
|
||||
Flash::error('page not found');
|
||||
return redirect(route('admin.pages.index'));
|
||||
}
|
||||
|
||||
$this->pageRepo->update($request->all(), $id);
|
||||
|
||||
Flash::success('pages updated successfully.');
|
||||
return redirect(route('admin.pages.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified Airlines from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$pages = $this->pageRepo->findWithoutFail($id);
|
||||
|
||||
if (empty($pages)) {
|
||||
Flash::error('Page not found');
|
||||
return redirect(route('admin.pages.index'));
|
||||
}
|
||||
|
||||
$this->pageRepo->delete($id);
|
||||
|
||||
Flash::success('page deleted successfully.');
|
||||
return redirect(route('admin.pages.index'));
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,8 @@ namespace App\Http\Controllers\Frontend;
|
||||
use App\Contracts\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Log;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class HomeController
|
||||
*/
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
|
||||
38
app/Http/Controllers/Frontend/PageController.php
Normal file
38
app/Http/Controllers/Frontend/PageController.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Exceptions\PageNotFound;
|
||||
use App\Repositories\PageRepository;
|
||||
use Exception;
|
||||
|
||||
class PageController extends Controller
|
||||
{
|
||||
private $pageRepo;
|
||||
|
||||
/**
|
||||
* @param \App\Repositories\PageRepository $pageRepo
|
||||
*/
|
||||
public function __construct(PageRepository $pageRepo)
|
||||
{
|
||||
$this->pageRepo = $pageRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the page
|
||||
*
|
||||
* @param $slug
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function show($slug)
|
||||
{
|
||||
$page = $this->pageRepo->findWhere(['slug' => $slug])->first();
|
||||
if (!$page) {
|
||||
throw new PageNotFound(new Exception('Page not found'));
|
||||
}
|
||||
|
||||
return view('pages.index', ['page' => $page]);
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,9 @@ class CommentRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
return [
|
||||
'comment' => 'required',
|
||||
'created_at' => 'sometimes|date',
|
||||
];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,6 @@ namespace App\Http\Requests\Acars;
|
||||
|
||||
use App\Contracts\FormRequest;
|
||||
|
||||
/**
|
||||
* Class PrefileRequest
|
||||
*/
|
||||
class FieldsRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
19
app/Http/Requests/CreatePageRequest.php
Normal file
19
app/Http/Requests/CreatePageRequest.php
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
25
app/Http/Requests/UpdatePageRequest.php
Normal file
25
app/Http/Requests/UpdatePageRequest.php
Normal 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',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user