Skip to content

Adishumla/laravel-tips

Repository files navigation

Laravel Logo

Build Status Total Downloads Latest Stable Version License

Resturant Tips:

This is an webapp made by Adam and Emma where you as a user can post your best resturant tips, view others tips and even vote for the ones you think are the best ones. Amazing! You will never have to think about where you should eat again, just look at the tips and you will for sure know where to eat.

Instructions:

  1. Clone down the repo
  2. npm install
  3. composer install
  4. run npm run dev
  5. php artisan serve to run the project

Code review:

  • Tips use DatabaseSeeder and factories to automate putting data in your db.
  • Add error handling on register.blade.php
  • Add validate on Controllers\LoginController.php
    $request->validate([
            'email' => 'required|email',
            'password' => 'required',
        ]);
  • Make relationships this way so you can use MySQL error handling.
    Schema::table('posts', function (Blueprint $table) {
        $table->foreignId('user_id')->constrained();
    });
  • Make use of resource controllers for example to auth
  • This controllers don´t make any thing. Consider removing them.
    • CategorieController
    • PostResturantController
    • PriceController
  • Be consequence with @CSRF in yours form.
  • Category migration be in plural category to categorys.
  • Some tests are missing the "use RefreshDatabse" which is good practice to use.
  • Make shore to use test_ in the name of every test function in the test file.
  • Comment in DB_CONNECTION and DB_DATABASE in phpunit.xml. So it doesn't use MySQL.
  • Welcome.blade.php not in use.
  • LikesController.php instead of only redirect back to index use an withError().
  • LikesController.php on line 27 write
    Like::create([
        'user_id' => $user_id,
        'resturant_id' => $resturant_id,
    ]);
    instedd of:
    $likes = Like::create([
        'user_id' => $user_id,
        'resturant_id' => $resturant_id,
    ]);
  • Follow Laravels recommendations on logging out an user
  • Move all the logic in index.blade.php and dashboard.blade.php to an controller if possible.
  • Be sure when to use redirect()->intended() and only redirect()
  • In your prices table consider to change price column to int. It makes it easier to use it in blade file when it is a int type
  • In resturant migration filen add unique() to name colum so it looks like this $table->string('name')->unique(). It means that there cannot be more than one restaurant with that name.
  • You have miss out comment. Are you stil using it?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages