Update admin location routes and controller to use service

Needs tests written, uses new validation on model.
This commit is contained in:
Dane Everitt 2017-06-14 23:53:24 -05:00
parent 26e476a794
commit fe4977f0fa
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 293 additions and 60 deletions

View file

@ -25,9 +25,12 @@
namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Model;
use Watson\Validating\ValidatingTrait;
class Location extends Model
{
use ValidatingTrait;
/**
* The table associated with the model.
*
@ -42,6 +45,16 @@ class Location extends Model
*/
protected $guarded = ['id', 'created_at', 'updated_at'];
/**
* Validation rules to apply when attempting to save a model to the DB.
*
* @var array
*/
protected $rules = [
'short' => 'required|string|between:1,60|unique:locations,short',
'long' => 'required|string|between:1,255',
];
/**
* Gets the nodes in a specificed location.
*