Skip to content

Commit

Permalink
Update License util, add nameToId method
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Jul 25, 2021
1 parent f3d6023 commit f6131ed
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/Util/Media/License.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,19 @@ public static function names()
->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'];
}
}

0 comments on commit f6131ed

Please sign in to comment.