In this tutorial, we’ve built a simple e-commerce application. As you can see, thanks to Laravel’s template system and built-in authorization system, you can easily create huge applications. You can improve the application with third-party packages. the main package manager has been Composer. There is a huge library at http://packagist.org, which provides packages for image manipulating, social media APIs, and so on. The number of packages increase day-by-day, which are becoming, by default, Laravel compatible. We suggest that, before coding anything, you take a look at the Packagist website.
:) :)
Hi, just following this but noticed that:
php artisan make:migartion create_authors_table –table=authors –create
should be:
php artisan make:migration create_authors_table –table=authors –create
(make:migration)
sorry for spelling mistake !
After running php artisan db:seed I was receiving:
[ReflectionException]
Class UsersTableSeeder does not exist
I had to do the following:
composer dump-autoload
php artisan db:seed
After this I received:
[SymfonyComponentDebugExceptionFatalErrorException]
– Not sure how to resolve that error though?
I dont think the dump autoload is needed in 5? Is it referring to a missing class? if so make sure the use appclass is entered on top. I noticed this was missing for alot of things.
I’m seen composer autodump-auto is used in a few places around the web (mostly tuts as I’m learning laravel at the moment). You were right about the class though (just been swatting namespaces this evening) and I was missing the use AppClass from at the top of the file – thanks!
you should using command line to make users seeder :
php artisan make:seeder UsersTableSeeder
then in namespace :
use AppUser;
Its a good tutorial to get started but it had a few typos and omissions. I should have noted them. One thing I would say regarding the last paragraph on passwords is that i think the statement needs to be clarified a bit. it sort of implies that the passwords are also salted with the application key and that users should worry about figuring a way to store passwords, which may lead to additional security issues.
I think it should be noted that the passwords are hashed and salted via bCrypt and persons shoudl read up on how it works but it uses a per password salt not the single application key to salt the passwords. I’m not sure if thats what you meant but it was in the same paragraph.
The application key as I understand it is for other things like encrypting sessions etc. Also while users should know of how the passwords are hashed and salted, they should not be tempted into creating thier own password hashing/encryption algoriithm. bCrypt is solid and if a user wants to make it tougher they can increase the rounds Hash::make(‘thisisthepasswrd’, array(’rounds’ => 15)).
Otherwise thanks for the tut, good way for me to get my feet wet learning Laravel.
ok point noted
There seems to be an inconsistency between the routes file, the user and auth controllers and the blade file when it comes to logins.
“We need to code our login and logout functions in the UserController.php file located at app/controllers.”
Yes, the functions are in the UserController but in the routes file they point to the Auth/AuthController. Also the blades file refer to /user/login but the routes file refer to auth/login.
Also the routes file has this: Route::get(‘auth/login’, ‘AuthAuthController@getLogin’); and this function isnt defined anywhere (unless it is being extended from another class)..
So I think either the routes file should be saying ‘UserController@postLogin… or the login functions should be in the Auth controller. Then the blade file should be pointing to the correct one (either user/login or auth/login)..
i have missed one thing here i am not using built in auth function of laravel
Page 5 Books.php You have : return $this->belongsTo(‘Author’);
It seems to have problems recognizing Author so one may have to do this: ‘AppAuthor’ (or something similar. Also since its using relationships does it need a foreign key? It may need to end up looking like
return $this->belongsTo(‘AppAuthor’,’id’). (Only way I could have gotten it to work).
Cart.php (AppBooks may be needed).
Page 9. refers to the orders but says to save blade file as cart.blade.php
Last major thing I had problem with is the pivot.
It seems that the orders and books table having a many-to-many relationship by default will attempt an insert using the table name book_order. I got a ” Base table or view not found: 1146 Table” error. I did some reading and Laravels documentation gives a clue: ” The role_user table is derived from the alphabetical order of the related model names” So I created a table called book_order and it worked.
So in case anyone else has these issues this may help.
thanks again
may i know , what version of laravel in this tutorial?
laravel 5
5.1?
yes !
Done a tutorial , but after i ran , get too may errors, are you sure this tutorial using laravel 5.1?
please share Errors you got !
FatalErrorException in Model.php line 827:Class ‘Author’ not found
sorry for late reply ! lets solve your problem
TokenMismatchException in VerifyCsrfToken.php line 53:
will fix that ! btw thanks
in laravel5 we need to use make command instead of generate
I fail to see how this is an “e-commerce” tutorial when this “tutorial” doesn’t even cover charging the users card. Did I miss something here?
try out this tut https://dunebook.com/easily-develop-a-ecommerce-website-with-laravel/
Thank you for the link, Deven!
i have an error after seeding class user not found any help noting that there are too many errors in this tut
you need to add, use AppUser; above class at seeder file
hello, how is your AuthAuthController wrote?
UserInterface, RemindableInterface interfaces were removed from Laravel 5.0, how can you still be using them?
Source: https://laravel.com/docs/5.0/upgrade
What happens to the cart.blade.php in last page 4
Done with tutorial, but ‘Add to Cart’ button is not working.(problem in routes.php file)
I just finished this tutorial, and I integrated this e-commerce store with a working Stripe payment system, among some other bug fixes using Laravel 5.2. Who ever is the owner or editor of this website, would you want to upload a part 2 to this tutorial if I uploaded my project to Github using my code?
sure . we are intrested .. thankuuh so much . . shoot an email to hyguyz @outlook.com
There, I sent you an email
yeah. sent in my email [email protected]
thank you so much ,shoot an email [email protected]
please send me at [email protected]
Confused: why doesn’t he used a pivot table called book_order where just the order id and the book id are listed?
Wouldn’t their need to be a pivot table between Cart and Book since just like the relationship/pivot table between Order and Book, a Cart can have multiple books in it and a Book can be in multiple carts?
checkout code of this tutorial https://github.com/hydrogen11/store_ex
I have made a full e-commerce store using the shopping cart method from this tutorial: Here is the website:
http://davidtrushkov.com/store/
and here is the Github code
https://github.com/davidtrushkov/store
thanks , for sharing @davidtrushkov:disqus
Thanks a lot, that was a great help!
Awesome!!!
Thanks for that man
Much Appreciated
Really Good Work .. One of the most valuable comment
There is no administration page to allow the administrator to log in to add products, categories and others?
how to create migration file for the Book?
please upload source code to git.
pls put this command – php artisan make:migration create_books_table –table=books –create
It should be php artisan make:migration create_carts_table –table=carts –create
Hi. If I won’t put the order price on table, just the product and quantity, any idea how can we get the total price from Model ?
please get this project thank you !
[email protected]
Interface ‘IlluminateAuthUserInterface’ not found getting this error after running php artisan db:seed.
We created a similar article for Laravel enthusiasts who want to build a Laravel cart from grounds-up. Check https://therightsw.com/laravel-ecommerce-website-guidelines/
Please I can have the source code of the project?
my email : [email protected]
Its a good tutorial for beginners. but there are some mistakes like you give this “So first, we need a template file under app/controllers/, which is named main_layout.blade.php”. but its not correct to create templates in controllers folder. so document the tutorial according to the standards.
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Class ‘App\Http\Controllers\Book’ not found