Update License util, add nameToId method

This commit is contained in:
Daniel Supernault 2021-07-25 03:29:22 -06:00
parent f3d6023ef8
commit f6131ed764
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 15 additions and 0 deletions

View File

@ -120,4 +120,19 @@ class License {
->values()
->toArray();
}
public static function nameToId($name)
{
$license = collect(self::get())
->filter(function($l) use($name) {
return $l['title'] == $name;
})
->first();
if(!$license || $license['id'] < 2) {
return null;
}
return $license['id'];
}
}