On the courts page where there is a list of courts there are a number of things we can do each court. So far these options include show, edit and delete. These options work by passing the courtid selected by the user to the through the url to the relevant controller function.
The respective controller functions show($id), edit($id) and delete($id) receive the id as an argument to the function and process it accordingly. Now that we have a ratecourt($courtid) function we can modify the view above to include an icon for ratecourt. The glypicons above are part of Bootstrap. To add in an extra column for the ratecourt action we need only copy the approach taken for show edit and delete and modify it to display a different glyphicon and have it use the appropriate url which we got working in the last post - i.e. http://localhost:8000/courtratings/ratecourt/4. To do this modify resources\views\courts\table.blade.php to include the following code.
<a href="{!! route('courtratings.ratecourt', [$court->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-ok"></i></a>
Place this code in the view as follows
The route {!! route('courtratings.ratecourt', [$court->id]) !!} will generate the appropriate route http://localhost:8000/courtratings/ratecourt/$courtid where $courtid will be different for each row. The class glyphicon glypicon-ok will display a tick button for the ratecourt icon. Now the courts screen looks like this
Having created the courtrating screen and modified the courts view so we can pass the selected court through now all we need is to add a graphical star rating element to the screen to replace the simple number which is currently captured on the screen. I'll show this in the next post.