Files
core/app/Models/User.php
T
Michal Kváček 2f7df75b83 FEATURE #1359: registration works now
Some basic form of registration is done. It does not look very nice, however I was able to create new user. This part will need a lots of other improvements, however new user was created. Yay!
2016-01-21 01:08:03 +01:00

57 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use App\Http\Requests\Request;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
use Symfony\Component\Process\Exception\InvalidArgumentException;
/**
* Class User
*/
class User extends Model
{
public $timestamps = false;
protected $fillable = [
'email',
'username',
'password',
'role',
'name',
'status'
];
protected $guarded = [];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
const STATE_DELETED = 'deleted';
const STATE_BLOCKED = 'blocked';
const STATE_ACTIVE = 'active';
const ROLE_VISITOR = 'visitor';
const ROLE_EDITOR = 'editor';
const ROLE_ADMIN = 'admin';
/**
* Validation method for input data
*
* @param array $data
*
* @return
*/
public static function validate(array $data)
{
$valid = true;
if (!$valid) {
throw new ValidationException(Validator::class, 'Invalid request');
}
}
}