forked from mirror/pixelfed
Update License util, add nameToId method
This commit is contained in:
parent
f3d6023ef8
commit
f6131ed764
1 changed files with 15 additions and 0 deletions
|
@ -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…
Reference in a new issue