Skip to content

Commit

Permalink
Merge pull request #29 from troccoli/dev
Browse files Browse the repository at this point in the history
Release Interactive Fixtures Loading (lva-22)
  • Loading branch information
troccoli authored Apr 14, 2017
2 parents d014184 + d22f5a6 commit 1bcec90
Show file tree
Hide file tree
Showing 202 changed files with 9,098 additions and 1,508 deletions.
5 changes: 1 addition & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
APP_URL=

DB_HOST=127.0.0.1
DB_DATABASE=homestead
Expand All @@ -11,10 +12,6 @@ CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ storage/

/.phpstorm.meta.php
/.idea
/lva-server
/.vagrant
/puphpet
/vendor
/node_modules
.env
.env.*
!.env.example
_ide_helper.php
_ide_helper_models.php
/Vagrantfile
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
branches:
only:
- master
- dev
notifications:
email:
on_success: always
on_failure: always
language: php
php:
- 5.6.30
Expand Down
7 changes: 5 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ dir = File.dirname(File.expand_path(__FILE__))

require 'yaml'
require "#{dir}/puphpet/ruby/deep_merge.rb"
require "#{dir}/puphpet/ruby/to_bool.rb"
require "#{dir}/puphpet/ruby/puppet.rb"

configValues = YAML.load_file("#{dir}/puphpet/config.yaml")

provider = ENV['VAGRANT_DEFAULT_PROVIDER']
provider = ENV['VAGRANT_DEFAULT_PROVIDER'] ? ENV['VAGRANT_DEFAULT_PROVIDER'] : 'local'
if File.file?("#{dir}/puphpet/config-#{provider}.yaml")
custom = YAML.load_file("#{dir}/puphpet/config-#{provider}.yaml")
configValues.deep_merge!(custom)
Expand All @@ -23,4 +24,6 @@ data = configValues['vagrantfile']

Vagrant.require_version '>= 1.8.1'

eval File.read("#{dir}/puphpet/vagrant/Vagrantfile-#{data['target']}")
Vagrant.configure('2') do |config|
eval File.read("#{dir}/puphpet/vagrant/Vagrantfile-#{data['target']}")
end
33 changes: 0 additions & 33 deletions app/Console/Commands/Inspire.php

This file was deleted.

51 changes: 51 additions & 0 deletions app/Console/Commands/PurgeUploadJobs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace LVA\Console\Commands;

use Illuminate\Console\Command;
use LVA\Models\UploadJob;
use LVA\Services\InteractiveFixturesUploadService;

class PurgeUploadJobs extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'lva:purge-upload-jobs';

/**
* The console command description.
*
* @var string
*/
protected $description = 'This command delete all jobs older than one week.';

private $uploadService;

/**
* PurgeUploadJobs constructor.
*
* @param InteractiveFixturesUploadService $uploadService
*/
public function __construct(InteractiveFixturesUploadService $uploadService)
{
parent::__construct();
$this->uploadService = $uploadService;
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$jobs = UploadJob::stale()->get();

foreach ($jobs as $job) {
$this->uploadService->cleanUp($job);
}
}
}
5 changes: 3 additions & 2 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

namespace App\Console;
namespace LVA\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use LVA\Console\Commands\PurgeUploadJobs;

class Kernel extends ConsoleKernel
{
Expand All @@ -13,7 +14,7 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
// Commands\Inspire::class,
PurgeUploadJobs::class
];

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Events/Event.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Events;
namespace LVA\Events;

abstract class Event
{
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Exceptions;
namespace LVA\Exceptions;

use Exception;
use Illuminate\Validation\ValidationException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
<?php

namespace App\Http\Controllers\Admin\DataManagement;
namespace LVA\Http\Controllers\Admin\DataManagement;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use LVA\Http\Requests\StoreAvailableAppointmentRequest as StoreRequest;
use LVA\Http\Requests\UpdateAvailableAppointmentRequest as UpdateRequest;
use LVA\Http\Controllers\Controller;

use App\Http\Requests\AvailableAppointmentRequest;
use Laracasts\Flash\Flash;

use App\Models\AvailableAppointment;
use App\Models\Fixture;
use App\Models\Role;
use LVA\Models\AvailableAppointment;
use LVA\Models\Fixture;
use LVA\Models\Role;

/**
* Class AvailableAppointmentsController
*
* @package LVA\Http\Controllers\Admin\DataManagement
*/
class AvailableAppointmentsController extends Controller
{

Expand Down Expand Up @@ -42,14 +48,15 @@ public function create()
/**
* Store a newly created resource in storage.
*
* @param AvailableAppointmentRequest $request
* @param StoreRequest $request
*
* @return mixed
*/
public function store(AvailableAppointmentRequest $request)
public function store(StoreRequest $request)
{
AvailableAppointment::create($request->all());

\Flash::success('Appointment added!');
Flash::success('Appointment added!');

return redirect('admin/data-management/available-appointments');
}
Expand Down Expand Up @@ -82,23 +89,25 @@ public function edit($id)
$fixtures = Fixture::all();
$roles = Role::all();

return view('admin.data-management.available-appointments.edit', compact('availableAppointment', 'fixtures', 'roles'));
return view('admin.data-management.available-appointments.edit',
compact('availableAppointment', 'fixtures', 'roles'));
}

/**
* Update the specified resource in storage.
*
* @param AvailableAppointmentRequest $request
* @param int $id
* @param UpdateRequest $request
* @param int $id
*
* @return mixed
*/
public function update(AvailableAppointmentRequest $request, $id)
public function update(UpdateRequest $request, $id)
{
/** @var AvailableAppointment $availableAppointment */
$availableAppointment = AvailableAppointment::findOrFail($id);
$availableAppointment->update($request->all());

\Flash::success('Appointment updated!');
Flash::success('Appointment updated!');

return redirect('admin/data-management/available-appointments');
}
Expand All @@ -114,7 +123,7 @@ public function destroy($id)
{
AvailableAppointment::destroy($id);

\Flash::success('Appointment deleted!');
Flash::success('Appointment deleted!');

return redirect('admin/data-management/available-appointments');
}
Expand Down
34 changes: 20 additions & 14 deletions app/Http/Controllers/Admin/DataManagement/ClubsController.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<?php

namespace App\Http\Controllers\Admin\DataManagement;
namespace LVA\Http\Controllers\Admin\DataManagement;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use App\Models\Club;
use Illuminate\Http\Request;
use LVA\Http\Controllers\Controller;

use Laracasts\Flash\Flash;
use LVA\Models\Club;

/**
* Class ClubsController
*
* @package LVA\Http\Controllers\Admin\DataManagement
*/
class ClubsController extends Controller
{

Expand Down Expand Up @@ -46,15 +51,15 @@ public function store(Request $request)

Club::create($request->all());

\Flash::success('Club added!');
Flash::success('Club added!');

return redirect('admin/data-management/clubs');
}

/**
* Display the specified resource.
*
* @param int $id
* @param int $id
*
* @return mixed
*/
Expand All @@ -68,7 +73,7 @@ public function show($id)
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param int $id
*
* @return mixed
*/
Expand All @@ -83,26 +88,27 @@ public function edit($id)
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @param int $id
*
* @return mixed
*/
public function update(Request $request, $id)
{
$this->validate($request, ['club' => 'required|unique:clubs,club,' . $id]);

/** @var Club $club */
$club = Club::findOrFail($id);
$club->update($request->all());

\Flash::success('Club updated!');
Flash::success('Club updated!');

return redirect('admin/data-management/clubs');
}

/**
* Remove the specified resource from storage.
*
* @param int $id
* @param int $id
*
* @return mixed
*/
Expand All @@ -111,11 +117,11 @@ public function destroy($id)
$canBeDeleted = empty(Club::find($id)->teams->toArray());
if ($canBeDeleted) {
Club::destroy($id);
\Flash::success('Club deleted!');
Flash::success('Club deleted!');
} else {
\Flash::error('Cannot delete because they are existing teams in this club.');
Flash::error('Cannot delete because they are existing teams in this club.');
}

return redirect('admin/data-management/clubs');
}

Expand Down
Loading

0 comments on commit 1bcec90

Please sign in to comment.