Files
nutzwerte_fi4/app/Models/ProjektMerkmale.php
T
2026-09-17 08:35:36 +02:00

38 lines
762 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* @property int $id
* @property int $projekte_id
* @property int $projekt_objekte_id
* @property int $cloned_from_id
* @property int $added_manuel
* @property string $code
* @property string $name
*/
class ProjektMerkmale extends Model
{
protected $fillable = [
'projekte_id',
'cloned_from_id',
'added_manuel',
'code',
'name',
];
public static function getfreecode(int $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;
}
}