Start working on the invite system for users

This commit is contained in:
Joseph Cohen
2015-10-31 15:33:11 -06:00
parent 6d52f49461
commit f6318409a7
13 changed files with 373 additions and 3 deletions

48
app/Models/Invite.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Invite extends Model
{
/**
* The attributes that should be casted to native types.
*
* @var string[]
*/
protected $casts = [
'email' => 'string',
];
/**
* The fillable properties.
*
* @var string[]
*/
protected $fillable = ['email'];
/**
* Overrides the models boot method.
*/
public static function boot()
{
parent::boot();
self::creating(function ($invite) {
if (!$invite->code) {
$invite->code = self::generateVerifyCode();
}
});
}
}