Skip to content

Commit

Permalink
Merge pull request #35 from troccoli/dev
Browse files Browse the repository at this point in the history
Version 0.0.3
  • Loading branch information
troccoli authored Jun 6, 2017
2 parents 1bcec90 + 07aa2bd commit 68564f1
Show file tree
Hide file tree
Showing 99 changed files with 2,087 additions and 1,675 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

FAKER_LOCALE=en_GB
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ notifications:
email:
on_success: always
on_failure: always
slack:
secure: Rw4A1EOomJpWvwtlfvJg2pOtTjspKY+KS7eNGC0GISnolax1DJ0MIHugRvWfQ3bIDECK/+/p3uxFeMYB/6gNJ6294mnr68XaVxgbqtk8OHi4fMBkAX0Csb+tUM6/Wg+DVKdaOll6Qhz8qaWJWlpGJHVFYojfaKy8cv/xqqnmNASJlsZVZvocVxJPlH3YZr/Tu9MDpTmUJcyIgXdpCGvBHTqIowpaA6QVsTVN5aZU+zJ1lz+w7LXMp2KbcFSFlT23IoJXV4uR78SmVFktxNl8NQYG4Aow1gV1Uwsb8aYIK2nXUZIiy16AtFWi+oGG2X4yxFW0yf0zhrmEcUMwHvwiE9bO1RWzF+nfFA3wpT+tQywJOHo/qjIgMpJVBO2emvXrn6oyS5lq3oWfwni7ye3Bxs8iM4rs6Bmvm6rXo04jHG+il+NDVk6L0Qi95OsVILNSaPoPt7vG2keImPuMbUJUC4+x3S38IY9WjdQtAb1bgl8/cgQ5Cw7T6DJzqcDIu0/8rvbdO8+/zcU41IN/8W3c7Ib+sMiCxsQLMzdo6pvx5cr2RtZq1tfjRxx5UXodeiAX6fXe9vHXSA67GggnM8f/5G23VPG4E2Ud0SN+pjj77o6qFaKu0zrEZl8WabMDDOiFy+6FkzZfjGtiKW8G7dex7Zyf0UiwtE4JZMsQNvgCe44=
on_success: always
on_failure: always
language: php
php:
- 5.6.30
- 7.1
install:
- nvm install v5.12.0
Expand Down
29 changes: 0 additions & 29 deletions Vagrantfile

This file was deleted.

2 changes: 2 additions & 0 deletions app/Http/Controllers/Admin/DataManagement/TeamsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function store(Request $request)
$this->validate($request, [
'club_id' => 'required|exists:clubs,id',
'team' => 'required|unique:teams,team,NULL,id,club_id,' . $request->input('club_id'),
'trigram' => 'required|alpha|size:3|unique:teams,trigram',
]);

Team::create($request->all());
Expand Down Expand Up @@ -101,6 +102,7 @@ public function update(Request $request, $id)
$this->validate($request, [
'club_id' => 'required|exists:clubs,id',
'team' => 'required|unique:teams,team,' . $id . ',id,club_id,' . $request->input('club_id'),
'trigram' => 'required|alpha|size:3|unique:teams,trigram,' . $id . ',id',
]);

/** @var Team $team */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function create()
*/
public function store(Request $request)
{
$this->validate($request, ['venue' => 'required|unique:venues']);
$this->validate($request, ['venue' => 'required|unique:venues', 'postcode' => 'uk_postcode']);

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

Expand Down Expand Up @@ -93,7 +93,7 @@ public function edit($id)
*/
public function update(Request $request, $id)
{
$this->validate($request, ['venue' => 'required|unique:venues,venue,' . $id]);
$this->validate($request, ['venue' => 'required|unique:venues,venue,' . $id, 'postcode' => 'uk_postcode']);

/** @var Venue $venue */
$venue = Venue::findOrFail($id);
Expand Down
4 changes: 0 additions & 4 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
Route::post('login', ['as' => 'loginSubmit', 'uses' => 'AuthController@login']);
Route::get('logout', ['as' => 'logout', 'uses' => 'AuthController@logout']);

// Registration Routes...
Route::get('register', ['as' => 'register', 'uses' => 'AuthController@showRegistrationForm']);
Route::post('register', ['as' => 'registerSubmit', 'uses' => 'AuthController@register']);

// Password Reset Routes...
Route::get('password/reset/{token?}', ['as' => 'passwordReset', 'uses' => 'PasswordController@showResetForm']);
Route::post('password/email', ['as' => 'passwordResetEmail', 'uses' => 'PasswordController@sendResetLinkEmail']);
Expand Down
9 changes: 9 additions & 0 deletions app/Models/Fixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Fixture extends Model
'home_team_id',
'away_team_id',
'venue_id',
'notes',
];

/**
Expand Down Expand Up @@ -209,6 +210,14 @@ public function getMatchDateAttribute($date)
return Carbon::createFromFormat('Y-m-d', $date);
}

/**
* @return string
*/
public function getNotes()
{
return $this->notes;
}

/**
* @return string
*/
Expand Down
28 changes: 27 additions & 1 deletion app/Models/Team.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Team extends Model
*
* @var array
*/
protected $fillable = ['club_id', 'team'];
protected $fillable = ['club_id', 'team', 'trigram'];

/**
* @param string $team
Expand All @@ -35,6 +35,16 @@ public static function findByName($team)
return self::where('team', $team)->first();
}

/**
* @param string $trigram
*
* @return Team|null
*/
public static function findByTrigram($trigram)
{
return self::where('trigram', $trigram)->first();
}

/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
Expand Down Expand Up @@ -91,6 +101,22 @@ public function getName()
return $this->team;
}

/**
* @return string
*/
public function getTrigram()
{
return $this->trigram;
}

/**
* @param string $value
*/
public function setTrigramAttribute($value)
{
$this->attributes['trigram'] = strtoupper($value);
}

/**
* @return string
*/
Expand Down
32 changes: 31 additions & 1 deletion app/Models/Venue.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Venue extends Model
*
* @var array
*/
protected $fillable = ['venue'];
protected $fillable = ['venue', 'directions', 'postcode'];

/**
* @param string $venue
Expand Down Expand Up @@ -75,6 +75,36 @@ public function getName()
return $this->venue;
}

/**
* @return string
*/
public function getDirections()
{
return $this->directions;
}

public function setPostcodeAttribute($postcode)
{
//remove non alphanumeric characters
$cleanPostcode = preg_replace("/[^A-Za-z0-9]/", '', $postcode);

//make uppercase
$cleanPostcode = strtoupper($cleanPostcode);

//insert space
$postcode = substr($cleanPostcode, 0, -3) . " " . substr($cleanPostcode, -3);

$this->attributes['postcode'] = $postcode;
}

/**
* @return string
*/
public function getPostcode()
{
return $this->postcode;
}

/**
* @return string
*/
Expand Down
21 changes: 14 additions & 7 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace LVA\Providers;

use LVA\Validators\CustomValidators;
use Illuminate\Support\ServiceProvider;
use Validator;

Expand All @@ -15,8 +14,9 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
Validator::extend('required_headers', CustomValidators::class . '@requiredHeaders');
Validator::replacer('required_headers', CustomValidators::class . '@requiredHeadersMessage');
Validator::extend('required_headers', \LVA\Validators\CustomValidators::class . '@requiredHeaders');
Validator::replacer('required_headers', \LVA\Validators\CustomValidators::class . '@requiredHeadersMessage');
Validator::extend('uk_postcode', \LVA\Validators\CustomValidators::class . '@ukPostcode');
}

/**
Expand All @@ -26,10 +26,17 @@ public function boot()
*/
public function register()
{
if ($this->app->environment() == 'local')
{
$this->app->register('Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider');
$this->app->register('Appzcoder\CrudGenerator\CrudGeneratorServiceProvider');
if ($this->app->environment() == 'local') {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
$this->app->register(\Appzcoder\CrudGenerator\CrudGeneratorServiceProvider::class);


}

if ($this->app->environment() == 'testing') {
$this->app->bind(\Faker\Generator::class, function () {
return \Faker\Factory::create(config('app.faker_locale'));
});
}
}
}
5 changes: 5 additions & 0 deletions app/Validators/CustomValidators.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ public function requiredHeadersMessage($message, $attribute, $rule, $parameters)

return str_replace(':headers', $headers, $message);
}

public function ukPostcode($attribute, $value, $parameters, $validator)
{
return \Postcode::validate($value);
}
}
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"laravel/framework": "5.2.*",
"davejamesmiller/laravel-breadcrumbs": "^3.0",
"laravelcollective/html": "^5.2",
"laracasts/flash": "^2.0"
"laracasts/flash": "^2.0",
"doctrine/dbal": "^2.5",
"codescheme/postcodes": "^1.3"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
Expand All @@ -32,8 +34,7 @@
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*",
"barryvdh/laravel-ide-helper": "^2.1",
"appzcoder/crud-generator": "^1.0",
"doctrine/dbal": "~2.3"
"appzcoder/crud-generator": "^1.0"
},
"autoload": {
"classmap": [
Expand Down Expand Up @@ -64,8 +65,6 @@
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan ide-helper:generate",
"php artisan ide-helper:meta",
"php artisan optimize"
]
},
Expand Down
Loading

0 comments on commit 68564f1

Please sign in to comment.