From f6d17d15fe9be38ac31cd71d1ada471b47ff9ba5 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 16 Jun 2020 18:58:30 +0200 Subject: [PATCH] wip #3712 --- src/app/Magic/Fields/APIToken.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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); + } } -- 2.39.5