wip orientierung
This commit is contained in:
1 parent
0df1017cb7
commit
79c0b14bb5
11 files changed
+284
-12259
No files matched your search
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Merkmale extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'projekte_id',
|
||||
'code',
|
||||
'name',
|
||||
];
|
||||
|
||||
public static function map($projekte_id)
|
||||
{
|
||||
return static::getModel()::where('projekte_id', $projekte_id)->pluck('name', 'code')->toArray();
|
||||
}
|
||||
|
||||
public static function getfreecode($projekte_id)
|
||||
{
|
||||
|
||||
$possible = range('a', 'j');
|
||||
|
||||
$have = static::getModel()::where('projekte_id', $projekte_id)->pluck('code')->toArray();
|
||||
|
||||
$left = array_diff($possible, $have);
|
||||
|
||||
return array_shift($left) ?? false;
|
||||
}
|
||||
}
|
||||
@@ -23,4 +23,9 @@ class OrientierungZuAbschlaege extends Model
|
||||
'i',
|
||||
'j',
|
||||
];
|
||||
|
||||
public function orientierung()
|
||||
{
|
||||
return $this->hasOne(Orientierung::class, 'id', 'orientierung_id');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user