mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
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()
|
->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'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue