mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 23:52:08 +00:00
build the backend structure and the fe for the Game
This commit is contained in:
+5
-8
@@ -2,11 +2,9 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Override;
|
||||
|
||||
class Room extends Model
|
||||
{
|
||||
@@ -20,7 +18,7 @@ class Room extends Model
|
||||
'state_version',
|
||||
];
|
||||
|
||||
protected function casts() :array
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'current_round' => 'integer',
|
||||
@@ -37,15 +35,15 @@ class Room extends Model
|
||||
});
|
||||
}
|
||||
|
||||
private static function generateJoinCode(): string
|
||||
private static function generateJoinCode(): string
|
||||
{
|
||||
$alphabet = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
|
||||
|
||||
do {
|
||||
$code = '';
|
||||
|
||||
for($i = 0; $i < 6; $i++) {
|
||||
$code .= $alphabet[random_int(0,strlen($alphabet)-1)];
|
||||
for ($i = 0; $i < 6; $i++) {
|
||||
$code .= $alphabet[random_int(0, strlen($alphabet) - 1)];
|
||||
}
|
||||
} while (static::where('join_code', $code)->exists());
|
||||
|
||||
@@ -53,14 +51,13 @@ class Room extends Model
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function players(): HasMany
|
||||
{
|
||||
return $this->hasMany(Player::class);
|
||||
|
||||
}
|
||||
|
||||
public function vote(): HasMany
|
||||
public function votes(): HasMany
|
||||
{
|
||||
return $this->hasMany(Vote::class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user