Update License util, add nameToId method

pull/2895/head
Daniel Supernault 4 years ago
parent f3d6023ef8
commit f6131ed764
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -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'];
}
}

Loading…
Cancel
Save