first commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class GameShot extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'game_session_id',
|
||||
'shot_number',
|
||||
'result',
|
||||
];
|
||||
|
||||
/*
|
||||
|---------------------------
|
||||
| Relationships
|
||||
|---------------------------
|
||||
*/
|
||||
|
||||
// Each shot belongs to a session
|
||||
public function session()
|
||||
{
|
||||
return $this->belongsTo(GameSession::class, 'game_session_id');
|
||||
}
|
||||
|
||||
/*
|
||||
|---------------------------
|
||||
| Helper methods
|
||||
|---------------------------
|
||||
*/
|
||||
|
||||
// Check if this shot is a goal
|
||||
public function isGoal()
|
||||
{
|
||||
return (bool) $this->result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user