I'm new to MVC, being RESTful, and CodeIgniter and I'm trying to get into it in my spare time, so this is largely an academic question. I'm trying to build a url that will display the availability of a particular hotel room, for a particular hotel. I figured the RESTful way to do this would be
http://url/Hotel/2/RoomAvailability/3/
- "Hotel" is the controller
- "2" is the hotel ID
- "RoomAvailability" is the Method
- "3" is the Room ID
How would I set up my controller in codeigniter to handle this? Currently I'm thinking i could either
- Do something with mod_rewrite to redirect to the RoomAvailability() method
- Do something with the index() method and redirect to the RoomAvailability() method
Really this is a pretty generic question, as I just want to be able to do
http://url/model/method-argument/method-name/more-method-arguments
But I'm honestly having a hard time coming up with search terms to find out what to use, other than "RESTful" and "CodeIgniter", which havent been too helpful.
I'm really just looking for guidance, not for someone to write my controller for me, thanks! Also, if this URL that I'm going for is horrible and not RESTful at all, please feel free to point out a better way.