29 lines
622 B
PHP
29 lines
622 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Veranstaltung extends Model
|
|
{
|
|
protected $table = "veranstaltungen";
|
|
|
|
protected $fillable = ['name','beginn','ende','geaste','hinweise'];
|
|
|
|
protected $dates = ['beginn', 'ende', 'created_at', 'updated_at'];
|
|
|
|
public function eintragungen(){
|
|
return $this->hasMany('App\Eintragung');
|
|
}
|
|
|
|
public function einteilungen(){
|
|
return $this->hasMany('App\Einteilung');
|
|
}
|
|
|
|
public function getIstEingetragenAttribute(){
|
|
$amI = $this->eintragungen->count('user_id', "=", \Auth::id());
|
|
|
|
return $amI > 0;
|
|
}
|
|
}
|