Revert "Revert "Release 20200823.1100""

This reverts commit 1b5f690f4e.
This commit is contained in:
shibafu
2020-08-30 13:57:02 +09:00
parent 46449a2836
commit 407fd192bd
71 changed files with 4372 additions and 1200 deletions

39
app/CheckinWebhook.php Normal file
View File

@@ -0,0 +1,39 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Str;
class CheckinWebhook extends Model
{
use SoftDeletes;
/** @var int ユーザーごとの作成数制限 */
const PER_USER_LIMIT = 10;
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = ['name'];
protected static function boot()
{
parent::boot();
self::creating(function (CheckinWebhook $webhook) {
$webhook->id = Str::random(64);
});
}
public function user()
{
return $this->belongsTo(User::class);
}
public function isAvailable()
{
return $this->user !== null;
}
}