Skip to content

BogdanMarianC/laravelshop

Repository files navigation

##Install composer (for dependency management)

curl -sS https://getcomposer.org/installer | php
 sudo mv composer.phar /usr/local/bin/composer

Install

  • Step 1.
mkdir shoplaravel
  • Step 2.
sudo chmod 644 -R shoplaravel
  • Step 3.
cd shoplaravel
  • Step 4. Download the master branch
git clone https://github.com/aadiaconitei/laravelshop.git .
  • Step 5. Make sure you have a database :laravel_shop
  • Step 6. Make a copy .env.example and rename to .env and edit lines 12,13,14:
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
  • Step 7. Install the composer dependencies
composer install

or

php /usr/local/bin/composer.phar
  • Step 8. Run the migrations and seeds
php artisan migrate --seed

or

php artisan migrate
php artisan db:seed

The db:seed command will seed admin and settings table. If you want to pre-generate some mock data, run again with option --class=ProductsSeeder

  • Step 9.
chmod -R 755 storage
chmod -R 755 bootstrap/cache
  • Step 10. Generating the key
php artisan key:generate

[Optional:] php artisan cache:clear php artisan config:clear

  • Step 11.
http://localhost/shoplaravel/public/
http://localhost/shoplaravel/public/products/listProducts

Authentication

php artisan make:auth

You can type the route:list command to see all routes registered by your application:

php artisan route:list

##REST api

  • Step 1. I created new folder “API” in App\Http\Controllers folder
mkdir app/API

  • Step 2. Create new controller as APIBaseController and ProductAPIController, APIBaseController extend all api controller (not include the create or edit methods)
 php artisan make:controller API/ProductAPIController --api
 php artisan make:controller API/APIBaseController --api 
  • Step 3. Create resource routes for list, create, update and delete. so we open your routes/api.php file and put the code following api.php: routes/api.php
Route::resource('apiproducts', 'API\ProductAPIController');
  • Step 4. Postman requests

List: GET, URL:http://localhost/laravelshop/public/api/apiproducts

Create: POST, URL:http://localhost/laravelshop/public/api/apiproducts

Show: GET, URL:http://localhost/laravelshop/public/api/apiproducts/{id}

Update: PUT, URL:http://localhost/laravelshop/public/api/apiproducts/{id}

Delete: DELETE, URL: http://localhost/laravelshop/public/api/apiproducts/{id}

Build Status Total Downloads Latest Stable Version License

About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

Laravel is accessible, powerful, and provides tools required for large, robust applications.

Learning Laravel

Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

If you don't feel like reading, Laracasts can help. Laracasts contains over 1400 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

Laravel Sponsors

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Patreon page.

Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.

Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [email protected]. All security vulnerabilities will be promptly addressed.

License

The Laravel framework is open-source software licensed under the MIT license.

About

Demo CRUD Shop + REST API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published