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; } }