This is a quick project for an interview test that I've got once in one of local company. Since I think there were still few example on how Laravel 5 do basic CRUD, I put it as public source. Feel free to grab and modify it for your own use.
Story of the test :
- Create a Laravel project with name of basiccrud
- Create a simple login page
- After login, please redirect the page to basiccrud/admin
- Admin page will contain 3 menus, products, orders and reporting
- The products page will have list of products that each of product can have multiple details of variation (color, size, stocks, price and weight). Please provide link to add and remove the product.
- The orders page will have list of orders (date, order numbers, purchased product, total price) and also link to add and remove the order. One order can contain different products. On adding an order, product can be picked by listing all the available products and then provide a checkbox to choose which product that will be purchased.
- Reporting page will provide report : Product name and total product that being sold on certain time frame (montly filter) ordered by the biggest sales.
With all the story, validation, style, details, etc etc, it takes me around 13-15 hours to finished it.
PHP, Laravel 5 & MySQL
In order to use this example, make sure to update .env.example become .env with your own db settings
DB_HOST=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
For a fresh DB install just migrate all the tables with prepared seed :
php artisan migrate --seed
Or you can use predefined data by importing DB using backup SQL :
database/sql/basiccrud.sql
After you configure all DB setup, run the app using :
php artisan serve
I use Elixir for CSS and JS compiler, you can see all the setup configuration in here. After finished with the setup, run this command at terminal :
gulp watch
If you want to modify CSS or JS take a look at /resources folder.
Go to your browser and hit the page :
http://localhost:8000
You will see a basic login page before go through the example, input the predefined default email and password :
email: admin@admin.com password: admin
That's all.