From: Vincent Vanwaelscappel Date: Tue, 16 Jun 2020 16:58:30 +0000 (+0200) Subject: wip #3712 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f6d17d15fe9be38ac31cd71d1ada471b47ff9ba5;p=cubist_cms-back.git wip #3712 --- diff --git a/src/app/Magic/Fields/APIToken.php b/src/app/Magic/Fields/APIToken.php index 05e8f23..da365b6 100644 --- a/src/app/Magic/Fields/APIToken.php +++ b/src/app/Magic/Fields/APIToken.php @@ -4,9 +4,17 @@ namespace Cubist\Backpack\app\Magic\Fields; +use Illuminate\Support\Str; + class APIToken extends Text { + protected $_databaseUnique = true; protected $_databaseAttributes = ['length' => 60]; + public function __construct($attributes) + { + $attributes['default'] = Str::random(60); + parent::__construct($attributes); + } }