<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

use Illuminate\Auth\Authenticatable;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;

class User extends Model implements AuthenticatableContract, AuthorizableContract
{
    use Authenticatable, Authorizable;
    protected $fillable = ['name', 'email', 'password'];

    // Users have user data
    public function data()
    {
        return $this->hasOne('App\Models\UserData');
    }

    // Users can have applications
    public function applications()
    {
        return $this->hasMany('App\Models\Application');
    }

    // Users can judge applications
    public function judged()
    {
        return $this->hasMany('App\Models\Judged');
    }
}

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

use Illuminate\Auth\Authenticatable;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;

class User extends Model implements AuthenticatableContract, AuthorizableContract
{
    use Authenticatable, Authorizable;
    protected $fillable = ['name', 'email', 'password', 'role'];

    // Users have user data
    public function data()
    {
        return $this->hasOne('App\Models\UserData');
    }

    // Users can have applications
    public function applications()
    {
        return $this->hasMany('App\Models\Application');
    }

    // Users can judge applications
    public function judged()
    {
        return $this->hasMany('App\Models\Judged');
    }
}

Allow the user role to be updated
Allow the user role to be updated

Add 'role' to fillable, as the admin may update the role with via a form.
This should be reviewed for security. There may be a better way to do this.

Signed-off-by: Marc Jones <bb1304e98184a66f7e15848bfbd0ff1c09583089@gmail.com>
