parent
866d95c945
commit
03cfc648b0
@ -5,6 +5,9 @@ namespace App\Contracts;
|
|||||||
use Illuminate\Validation\Validator;
|
use Illuminate\Validation\Validator;
|
||||||
use Prettus\Repository\Eloquent\BaseRepository;
|
use Prettus\Repository\Eloquent\BaseRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin \Prettus\Repository\Eloquent\BaseRepository
|
||||||
|
*/
|
||||||
abstract class Repository extends BaseRepository
|
abstract class Repository extends BaseRepository
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -47,6 +47,12 @@
|
|||||||
options: ''
|
options: ''
|
||||||
type: text
|
type: text
|
||||||
description: 'Enter your Google Analytics Tracking ID'
|
description: 'Enter your Google Analytics Tracking ID'
|
||||||
|
- key: units.currency
|
||||||
|
name: 'Currency'
|
||||||
|
group: units
|
||||||
|
value: USD
|
||||||
|
type: select
|
||||||
|
description: 'The currency to use'
|
||||||
- key: units.distance
|
- key: units.distance
|
||||||
name: 'Distance Units'
|
name: 'Distance Units'
|
||||||
group: units
|
group: units
|
||||||
|
@ -63,7 +63,7 @@ class AirlinesController extends Controller
|
|||||||
public function store(CreateAirlineRequest $request)
|
public function store(CreateAirlineRequest $request)
|
||||||
{
|
{
|
||||||
$input = $request->all();
|
$input = $request->all();
|
||||||
$airlines = $this->airlineRepo->create($input);
|
$this->airlineSvc->createAirline($input);
|
||||||
|
|
||||||
Flash::success('Airlines saved successfully.');
|
Flash::success('Airlines saved successfully.');
|
||||||
return redirect(route('admin.airlines.index'));
|
return redirect(route('admin.airlines.index'));
|
||||||
|
@ -7,6 +7,9 @@ use App\Models\Airline;
|
|||||||
use Prettus\Repository\Contracts\CacheableInterface;
|
use Prettus\Repository\Contracts\CacheableInterface;
|
||||||
use Prettus\Repository\Traits\CacheableRepository;
|
use Prettus\Repository\Traits\CacheableRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin \App\Models\Airline
|
||||||
|
*/
|
||||||
class AirlineRepository extends Repository implements CacheableInterface
|
class AirlineRepository extends Repository implements CacheableInterface
|
||||||
{
|
{
|
||||||
use CacheableRepository;
|
use CacheableRepository;
|
||||||
|
@ -28,6 +28,21 @@ class AirlineService extends Service
|
|||||||
$this->subfleetRepo = $subfleetRepo;
|
$this->subfleetRepo = $subfleetRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new airline, and initialize the journal
|
||||||
|
*
|
||||||
|
* @param array $attr
|
||||||
|
*
|
||||||
|
* @return \App\Models\Airline
|
||||||
|
*/
|
||||||
|
public function createAirline(array $attr): Airline
|
||||||
|
{
|
||||||
|
$airline = $this->airlineRepo->create($attr);
|
||||||
|
$airline->initJournal(setting('units.currency'));
|
||||||
|
|
||||||
|
return $airline;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the airline be deleted? Check if there are flights, etc associated with it
|
* Can the airline be deleted? Check if there are flights, etc associated with it
|
||||||
*
|
*
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
namespace Modules\Installer\Http\Controllers;
|
namespace Modules\Installer\Http\Controllers;
|
||||||
|
|
||||||
use App\Contracts\Controller;
|
use App\Contracts\Controller;
|
||||||
use App\Models\User;
|
use App\Services\AirlineService;
|
||||||
use App\Repositories\AirlineRepository;
|
|
||||||
use App\Services\AnalyticsService;
|
use App\Services\AnalyticsService;
|
||||||
use App\Services\Installer\DatabaseService;
|
use App\Services\Installer\DatabaseService;
|
||||||
use App\Services\Installer\InstallerService;
|
use App\Services\Installer\InstallerService;
|
||||||
@ -24,7 +23,7 @@ use Modules\Installer\Services\RequirementsService;
|
|||||||
|
|
||||||
class InstallerController extends Controller
|
class InstallerController extends Controller
|
||||||
{
|
{
|
||||||
private $airlineRepo;
|
private $airlineSvc;
|
||||||
private $analyticsSvc;
|
private $analyticsSvc;
|
||||||
private $dbSvc;
|
private $dbSvc;
|
||||||
private $envSvc;
|
private $envSvc;
|
||||||
@ -36,7 +35,7 @@ class InstallerController extends Controller
|
|||||||
/**
|
/**
|
||||||
* InstallerController constructor.
|
* InstallerController constructor.
|
||||||
*
|
*
|
||||||
* @param AirlineRepository $airlineRepo
|
* @param AirlineService $airlineSvc
|
||||||
* @param AnalyticsService $analyticsSvc
|
* @param AnalyticsService $analyticsSvc
|
||||||
* @param DatabaseService $dbService
|
* @param DatabaseService $dbService
|
||||||
* @param ConfigService $envService
|
* @param ConfigService $envService
|
||||||
@ -46,7 +45,7 @@ class InstallerController extends Controller
|
|||||||
* @param UserService $userService
|
* @param UserService $userService
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AirlineRepository $airlineRepo,
|
AirlineService $airlineRepo,
|
||||||
AnalyticsService $analyticsSvc,
|
AnalyticsService $analyticsSvc,
|
||||||
DatabaseService $dbService,
|
DatabaseService $dbService,
|
||||||
ConfigService $envService,
|
ConfigService $envService,
|
||||||
@ -311,7 +310,7 @@ class InstallerController extends Controller
|
|||||||
'country' => $request->get('airline_country'),
|
'country' => $request->get('airline_country'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$airline = $this->airlineRepo->create($attrs);
|
$airline = $this->airlineSvc->create($attrs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the user, and associate to the airline
|
* Create the user, and associate to the airline
|
||||||
|
Loading…
Reference in New Issue
Block a user