Database Check: As mentioned before, you must run this in your database (e.g., phpMyAdmin) so it stops looking for a slug:
ALTER TABLE courses DROP INDEX slug;
(If you don't do this, MySQL might still throw an error if it finds a duplicate value in that column).
Once you replace the method with the one above and delete the helper function at the bottom, the undefined method error will disappear. Does it work now?