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!
This commit is contained in:
+29
-7
@@ -2,34 +2,56 @@
|
||||
|
||||
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',
|
||||
'remember_token',
|
||||
'role',
|
||||
'name',
|
||||
'status'
|
||||
];
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
'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');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user