/** * Returns the ID of a role found via the title * * @return int|null */ public static function idFromTitle($role) { $role = Role::where('title', '=', $role)->first(); return !is_null($role) ? $role->id : null; }