In completing this assignment you MAY use/access the following resources:
You may NOT use/access:
- Resources not expressly listed above, including, but not limited to,
the following ...
- Source code not provided as part of this assignment. (Obviously, this
includes, but is not limited to, source code written by other students
whether current or in the past).
- Code-generating tools (of which ChatGPT is one example).
- Any web sites not directly linked to from the homework assignment.
Failure to abide by these guidelines will result in a zero for the assignment
and the incident will be reported to the university provost as a violation of
the university academic integrity policy. A second incident of academic
dishonesty (whether from this course or another computer science course) will
result in an F in the course.
You should complete each of these steps:
- If needed, install composer/laravel locally and update your .bashrc file to
include the laravel bin directory in your path. NOTE: This should have been
done as part of the prelab assignment.
- Use the laravel new command to create your hw07 directory. NOTE: Do
not have a separate project directory inside of hw07.
- Apply all of the permissions changes needed to be able to run the framework
without issue.
- Create a controller called BookController and define stub actions
for index, addbook, bookdetail, error, and deletebook. (We'll deal with login, logout,
and signup in a different controller in a later assignment).
- In the views directory, create a subdirectory called layouts. In
the layouts directory create a template called main.blade.php which
contains the header, menu, and footer that is common to each page of your
application. Leave placeholders for the page title (in head) and the
main content of the page.
- Copy your css and js directories from your previous project
into the public directory. Then modify the main layout to pull those
in (using the asset() function). Also, make sure that local hyperlinks
from the menu are working.
- Create a view for your index page that utilizes your main layout and
displays some content. For this assignment we won't be accessing the
database so you can remove or comment out commands that interact with the
database. Instead put a couple of placeholder entries so you can get.
- Establish a route for the index page that points to the index method in
your controller. Have the index method of the controller load the index
view.
- Now establish similar route/controller/view behaviors for: addbook,
bookdetail, and error. For error, have the controller extract the error
code from the query string and pass it on to the error page. That is, the
error page should be completely working. For the others pages just display
placeholder data for now.
- Take time to clean up the project by removing the default controllers,
views, and routes.
By the end of this assignment you should have a reasonably formatted application in
the hw07 directory of your web space that runs under Laravel and provides
this behavior:
- Styling should be done in an external CSS document.
- Each page has a Menu with Home, Add Book, and Login with working links
(except for Login)
- Use a single layout for all pages.
- These pages should be working: Home, Add Book, Book Detail, and Error.
None of the pages will access the database at this point, but they should
contain sample data with a hard-coded entries. The Error page should work
completely, though there won't be any code that currently redirects to it.