A group assignment with the purpose of better understanding backend applications in Laravel. Our group decided to create a social platform on which people can register as either pet owners, pet walkers or both and exchange services to one another.
Required Laravel features:
- Controllers
- Migrations
- HTTP Tests (on all routes)
- Laravel Mix
- Middleware
- Models (with relationships)
- Routes (with route model binding)
- Eloquent
- Relationships
- Validation
- Views (Blade)
Other requirements:
- The application idea should be discussed with the teacher and be given an OK before you get started.
- Each group should write a code review of at least 20 comments on the next groups project the day before presentations.
- The code syntax must adhere to the PSR-12 standard. If not, your project wont be approved and you'll get an extra assignment.
- Install the Clockwork extension in order to find issues such as N+1 problem in your Laravel application.
- Oh, by the way, you can't use any fancy-pantzy JavaScript frameworks, this is a backend assignment. If you do want to write JavaScript it should be vanilla and just some basic stuff. Discuss this with your teacher.
Prerequisites: You will need to have Composer, NPM and PHP installed in order to open up this project on your computer.
How to access:
- Press the green 'Code' button on GitHub to download it locally.
- Open up your CLI and
cd
into the project folder. - In your CLI, copy the
.env
file by typing in:cp .env.example .env
. - In your CLI, generate a key by typing:
php artisan key:generate
. - Go to the
.env
file that you created and set your preferred database settings plus the generated key. - In your CLI, run database migrations by typing:
php artisan migrate
. - In your CLI, type
composer update
followed byphp artisan serve
. Your command line should now have opened up a localhost for you, where you can see the application.
By Jakob Gustafsson:
- 1.
UpdateUserController.php
When updating your information you can send a success message with likereturn redirect('dashboard')->with('success', 'Your profile has been updated')
and add@if(session('success')) -- display message -- @endif
to yourdashboard.blade.php
. - 2. When you update your email to one that already exists, you get redirected to a
SQLSTATE[23000]
, try to add a similar@error-handling
to your accountsettings-form as you have in your registrationform. - 3. Your password comfirmation in account settings doesn't work. It doesn't need to match and is always changed to the comfirmation input. We see that you have commented out one of the input fields in your
accountsettings.blade.php
. - 4. When deleting your account you don't get a comfirmation if it was successfull or not.
- 5. Nice job with your DB queries, no N+1 problems here.
- 6. It could be a nice touch to add the option of uploading an image of your pet and share it with other users that might be interested to take it for a walk. We see that you have a 'profile_img'-tab in your
Pet.php
. - 7. Good job following the PSR-12 standard!
- 8. Clean and accessible website.
- 9. Nice going with your Unit Testing, no error in sight!
- 11. What if a user makes a mistake when adding their pet information? Maybe Doggo hates fetch! It might be a good idea to create a
UpdatePetController
and add this option in the future. :) - 11. You get a
SQLSTATE[HY000] ERROR
When entering characters instead of the intended integers in the phone input field. Try to create a validation in yourUpdateUserController
so that is requires integers like$validate = $request->validate(['phone' => 'integer',]);
- 12. You should add the
public/css
to your.gitignore
, so autogenerated files are not included. - 13. In
web.php:47
, you can useRoute::delete
instead ofRoute::post
to delete your account. - 14. Nice work on commenting everything in your
blade-files
, easy to find what you are looking for. - 15.
accountsettings.blade
When entering to many characters in the info-input, they don't get an error message, but gets sent to Laravels own error page. Try to add an error message and redirect the user back to the page. - 16. If the user enters an incorrect password when logging in, they have to rewrite the email. Save the email in a session to prevent this from happening.
- 17. Try and tell the user what specifically went wrong when logging in, was the email wrong? Or the password?**
- 18. If there are a lot of users showing on the dashboard, it can be hard to find yourself. Maybe there is a way to show the logged in user at the very top or make it stand out in the list.
- 19. Is the name of the user supposed both first name and last name? It seems to be the case as the placeholder is
Person Personson
, but the minimum amount of characters required are 2. It might be nitpicking at best, but maybe it's less confusing to make one input for the first name and one for the last name? - 20. Great job! You have created a fun an imaginative app!