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

View file

@ -120,4 +120,19 @@ class License {
->values() ->values()
->toArray(); ->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'];
}
} }