Laravel 2 due Mon 05 Mar 11:00

\begin{purpose}
In completing this assignment you will:
\begin{itemize}
\ite...
... to handle the
complex logic of ISBN validation.
\end{itemize}
\end{purpose}

Details

At the end of this assignment a visit to http://csci.hsutx.edu/~youraccount/hw06/public/sell should present a form for adding a book to the listing table. The behavior should be the same as prescribed in homework #3.

Some considerations:

  1. Recall that validating ISBN in the earlier assignment was a fairly complex action:
    • Remove dashes and whitespace
    • Use regex to verify it contains proper digits
    • Perform check-digit calculations
    • Search for ISBN in local database
    • If ISBN found in local database then validation passes else search googleapis database.
    • If found in googleapis database extract data and insert into local database (validation passes). Else provide message that ISBN not found.

    Obviously there is no Laravel-provided validation rule to cover this so you'll need to write a custom rule. See https://laravel.com/docs/5.6/validation#custom-validation-rules.

  2. If the form doesn't validate appropriate error messages beside the offending item should appear. Also, form data should be restored when the form is re-loaded after validation.

  3. In the sell-post controller, after validation passes, you'll then need to insert the new listing.

  4. If validation passes you should return to a fresh/empty sell form but provide a conspicuous message at the top of the form indicating that the listing was successful.

  5. For now you can give credit for the listing to the person whose owner_id is 1.

Quick Links