Laravel 5.2 PHP - Build a Shopping Cart - #8 Cart Model & Session Storage

  Рет қаралды 117,383

Academind

Academind

Күн бұрын

Пікірлер: 224
@WebDevMatics
@WebDevMatics 8 жыл бұрын
Awesome ! Not too fast not too slow. You are good teacher man.
@academind
@academind 8 жыл бұрын
Amazing feedback! Thanks so much!
@einarbragigumundsson2128
@einarbragigumundsson2128 7 жыл бұрын
php artisan migrate:refresh --seed it rolls back the migration, then runs them again and finally seeds the database, cheers :)
@jota4914
@jota4914 4 жыл бұрын
why to do find product again if already i have the product id? her can pass the object produc completly
@TechLunar
@TechLunar 5 жыл бұрын
Great tutorial and everything is very well explained. I am wondering on 8:14, what were the shortcuts you used to copy the current line into the next 2 lines. I am pretty sure this is a function built on the IDE you are using, but I would like to confirm. Thanks!
@academind
@academind 5 жыл бұрын
Thank you! Please have a look at this article regarding the shortcuts => academind.com/learn/web-dev/visual-studio-code-introduction/#selected-shortcuts-where-to-configure-them
@keithcarrillo8238
@keithcarrillo8238 6 жыл бұрын
Hey Max, when you mention cart key at @16:10 'Session::('cart') , how is that stored? Would it be stored by laravel checking if the 'cart' model had been used to store a cart item? Not sure how session::has & ::get pulls data. Thanks for the vids.
@faisalfaiz64
@faisalfaiz64 4 жыл бұрын
can you please explain to me this $oldCart = Session::has('cart') ? Session::get('cart') : null; where we have to create session ? in your video you are not creating it anywhere, so where we have to create it?
@pratikdahal7156
@pratikdahal7156 5 жыл бұрын
Hello there! What will I have to do for storing the color and size of the product as well?
@jeremiahmuhoho733
@jeremiahmuhoho733 6 жыл бұрын
thank-you Mindsapace .... how can I add a variant like color in the cart and to make each product with different color a different item?
@sheerasai5948
@sheerasai5948 6 жыл бұрын
Hi bro I am watching ur series creates upto add to cart it works fine..but add to cart section the code which u wrote In the cart model and product controller I could not able to understand can u pls help me on that?
@metodejhrdlicka
@metodejhrdlicka 4 жыл бұрын
Why create new variable $cart each time I want to add item to it? Wouldn't be better to update old session variable instead?
@SkyZed_Sz
@SkyZed_Sz 5 жыл бұрын
How can I do if I want to add more things than product. Like I add product on the cart and can add another service too. So in the route I need to add ServiceController@addToCart ? but 'uses' takes just 1 parameter ?
@exoticwoodpen
@exoticwoodpen 5 жыл бұрын
I'm new to Laravel and i'm using version 5.8. I've been following the code line by line and trying to understand but still get this error. shopcart\app\Cart.php public function __construct($oldCart) { if ($oldCart) { $this->items = $oldCart->items; $this->$totalQty = $oldCart->totalQty; $this->totalPrice = $oldCart->totalPrice; } } "Undefined variable: totalQty"
@ajmalhossainbappi5370
@ajmalhossainbappi5370 8 жыл бұрын
Thanks for coming back. You are such a great teacher. Advanced thanks for rest of the videos.
@academind
@academind 8 жыл бұрын
Many thanks, that's awesome to hear! :)
@mattsteffler4427
@mattsteffler4427 6 жыл бұрын
Please help I’m getting an error that says “Class ‘App\Http\controllers\Cart’ not found” I’ve gone over the tutorial a couple times and can’t see what I’ve done wrong
@atypical_blk_guy
@atypical_blk_guy 4 жыл бұрын
I'm getting this error when my page loads; Symfony\Component\Routing\Exception\RouteNotFoundException Route [product.addToCart] not defined. (View: C:\xampp\htdocs\proshop esources\views\products\productDetails.blade.php)
8 жыл бұрын
This tutorial is amazingly clear and well structured. You saved me a lot of time and most important, helped me to understand how Laravel works. If you come to Majorca I will invite you a kingsize beer.
@academind
@academind 8 жыл бұрын
Awesome to hear this - and I'll definitely come back to that the next time I'm there!
@guardrover
@guardrover 8 жыл бұрын
Since you are using PHPStorm, the use statements are automatically added when you pick from the dropdown as you type.
@academind
@academind 8 жыл бұрын
I know, but since not everybody uses PHPStorm, I try to highlight those imports the best I can.
@brayanangarita7816
@brayanangarita7816 5 жыл бұрын
Hi there. How can I add a size in case the product is a shoe or a blouse?
@SazaYT
@SazaYT 4 жыл бұрын
So when i added my first item, lets name it "chicken"..and then i try to add 'beef' in the basket as well, what will happen is the qty of chicken will go to 2 instead off adding the beef. Something must be wrong in my Basket.php class. Any ideas?
@sdshsjg
@sdshsjg 4 жыл бұрын
hello , i have a problem when i hosted it on a shared hosting, when i click add to cart, then i click the menu href to cart page, suddenly my session gone
4 жыл бұрын
Please, how to reduce the Qtd in produt table?
@archeronx1
@archeronx1 8 жыл бұрын
Another great tutorial. Also, great mention on the $request->session part. I wasn't aware the 2 were interchangeable. Thank you!
@academind
@academind 8 жыл бұрын
Yeah I think those tiny things help a lot since that were the things I also struggled with when learning Laravel. Actually, Laravel has a lot of those interchangeable things, I'm happy that it was helpful to you :)
@jatinparekh2094
@jatinparekh2094 5 жыл бұрын
hey ! when i logout and again login add the added products deleted! why? and how to save that added product in cart save in database ..? thank you
@yashonathreddy1810
@yashonathreddy1810 8 жыл бұрын
i want to store my cart both in session and database, so that user can get his cart on from any device . can u help me?
@heshananupama3409
@heshananupama3409 8 жыл бұрын
my cart always replaces with new item added. So theres only one item in the cart every time. why is that. I worked for hours and still couldnt figure it out. I used the same code of yours. but still its the same :( could you please help me? i am using laravel 5.3
@alifatahi7952
@alifatahi7952 8 жыл бұрын
Hey Im Using Laravel 5.3 and i dont have problem can you send your Cart Code here
@alifatahi7952
@alifatahi7952 8 жыл бұрын
Hi Your Cart Class is correct Can you Send ProductContoller Class
@spoccobeech
@spoccobeech 7 жыл бұрын
I was wondering, where did you get the $item variable that you passed on the add function? (or I'm just confused) because it doesn't make any changes. thanks for the response
@unpr3dict2ble
@unpr3dict2ble 6 жыл бұрын
You can call the argument anything you want. He chose to call it $item in the add() method. Anything that gets passed into the method from that point on will be referred to as $item protected function add($item, $id) { ......}
@aoonraza2906
@aoonraza2906 7 жыл бұрын
Sir i have a error in code its show error like this FatalThrowableError in ProductsController.php line 44: Call to undefined function App\Http\Controllers\add() please help i am stuck in this part
@CabConHD
@CabConHD 5 жыл бұрын
Does anyone know a good tutorial for the following: - How to count views with cronjobs and use them instead to count them if a user request any view count?
@ahmedhussin5704
@ahmedhussin5704 7 жыл бұрын
i wonder how you check Session::has('cart') before you putting it ?
@shem2382
@shem2382 8 жыл бұрын
hey do you have info on a star rating system, basically where user rates items. would you implement it in later tutorial if not, can you point me to some sources so i can learn how to implement this feature.
@academind
@academind 8 жыл бұрын
I probably won't implement that in this series. I would basically simply google for it, then threads like this might be helpful: stackoverflow.com/questions/23383650/creating-a-star-rating-percentage-in-laravel
@shem2382
@shem2382 8 жыл бұрын
I think you were alluding to the need of a cms for a shopping cart or maybe I didn't quite get it. I think it was in the first video of this series.
@academind
@academind 8 жыл бұрын
Hm, there might've been a little misunderstanding, I always planned to build everything on my own.
@shem2382
@shem2382 8 жыл бұрын
+Mindspace yeah I think I got that wrong my apologies. lol.
@amjadiqbal5353
@amjadiqbal5353 6 жыл бұрын
i am getting error on this line , $this->items[$id] = $storedItem; Cannot use object of type App\Cart as array
@animeuncaged3553
@animeuncaged3553 4 жыл бұрын
hi, can you please do this with Ajax please?
@judealvarez6171
@judealvarez6171 7 жыл бұрын
Im gettng a "Cannot use object of type stdClass as array" error on "{{ $product['item']['name'] }}" i cant get it right please help
@tadeupagliarini5311
@tadeupagliarini5311 8 жыл бұрын
After doing this class, it doesn't show my index page anymore, neither can I use the header, the last one happens just if i'm not logged in and I must be on the Profile page. Trought URL I can go to the user's page, sign in and sign up though.
@academind
@academind 8 жыл бұрын
Hi Tadeu, maybe some kind of wrong place @if statement in the blade view? Do you get an error instead?
@tadeupagliarini5311
@tadeupagliarini5311 8 жыл бұрын
The error is the following Maximum function nesting level of 100 reached, aborting! Ps: I can only see this error if I look at the source-code on the browser.
@tadeupagliarini5311
@tadeupagliarini5311 8 жыл бұрын
I've managed to fix it. I had to change the php.ini file, adding the following code into the it xdebug.max_nesting_level = 200. Everything is working now. Thanks anyway and keep with the classes, they're great.
@academind
@academind 8 жыл бұрын
Great to hear that everything's working now! :)
@ceylontwowheels4016
@ceylontwowheels4016 4 жыл бұрын
Is it Work with Laravel 7
@ijvseptianardi3616
@ijvseptianardi3616 7 жыл бұрын
Help me ! i cannot add qty on session its still one item qty , i use laravel 5.4 #thx
@Expolrethelife168
@Expolrethelife168 7 жыл бұрын
same problem
@mazt1981
@mazt1981 7 жыл бұрын
Hi, I solved writting some changes. (I use laravel 5.4 too) I Don't know why but when I get cart from session, that give a complete Cart object, I' don't need to create a new cart object with old cart object, instead that I use it. Hope to help you!
@mazt1981
@mazt1981 7 жыл бұрын
PD: I use productid for products, use id if you create with that name
@احمدثابت-ث8خ
@احمدثابت-ث8خ 7 жыл бұрын
you can try $request->session()->save() this function will force laravel to store session
@gourishankarrpujar9940
@gourishankarrpujar9940 7 жыл бұрын
Thanks Bro it saved my day.
@kallaldeveloper9072
@kallaldeveloper9072 8 жыл бұрын
When I sign up a user, this shows, but it added data to database ErrorException in SessionGuard.php line 439: Argument 1 passed to Illuminate\Auth\SessionGuard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, none given
@kallaldeveloper9072
@kallaldeveloper9072 8 жыл бұрын
I fixed the problem, there is error in my userController code
@fduch07
@fduch07 8 жыл бұрын
ErrorException in Cart.php line 21: Trying to get property of non-object
@vaibhavmohan775
@vaibhavmohan775 7 жыл бұрын
why are migrations necessary can't we just work without them will there be some problem if we create database by ourself and use it
@unpr3dict2ble
@unpr3dict2ble 6 жыл бұрын
yes, but why not let laravel handle the db manipulation? I too thought the same thing when I started out, as it seems one more thing to learn, but in the end, it's so much easier.
@haroonattock2272
@haroonattock2272 8 жыл бұрын
Trying to get property of non object .....this error occured :( plz tell me how to fix it
@academind
@academind 8 жыл бұрын
Hi Muhammad, I don't know your code and as I'm no magician, I also have no chance of knowing when it occurred. So please provide a more detailed error message as well as your relevant source code (i.e. the code triggering the error). :)
@haroonattock2272
@haroonattock2272 8 жыл бұрын
+Mindspace I have fixed it thanx :)
@mohamedmounir9686
@mohamedmounir9686 8 жыл бұрын
can you tell me how fixed it plz?
@mohamedmetwaly2361
@mohamedmetwaly2361 8 жыл бұрын
i have same problem here how have you fixed it???
@konstantingub
@konstantingub 6 жыл бұрын
Bro, how did you fix it ? Can you remember ?
@mehmettepeli1403
@mehmettepeli1403 6 жыл бұрын
hi, how can i remove or update one product ?
@biresths3126
@biresths3126 8 жыл бұрын
Aren't you providing full source code of this series on github??? i have downloaded it from github but there is no full source code
@academind
@academind 8 жыл бұрын
Many question marks not always make a question better ... make sure to pick the right branch on the Github repo, all the source code is available there.
@biresths3126
@biresths3126 8 жыл бұрын
please merge different branch into master branch.so that we can downlaod full sourcecode from same branch
@academind
@academind 8 жыл бұрын
No, I won't do that because then the old code of the other videos would be lost (of course accessible by diving into the commits, but that's way to complicated)
@shahrukh631
@shahrukh631 7 жыл бұрын
I don't know why but Cart Session is always evaluating to null on each addToCart request. Funny thing is I run that code on tinker and it worked perfectly fine, the session was being created and then items were being added to it. laravel 5.4
@mtzrmzia
@mtzrmzia 6 жыл бұрын
the code in GitHub its incomplete ... why?
@AmritKafleYoutubeChannel
@AmritKafleYoutubeChannel 6 жыл бұрын
hello i want to update and delete shopping cart item tutorial too ?
@johnb8739
@johnb8739 8 жыл бұрын
How would you output the user's name in the navbar upon authentication? So that it outputs something like Welcome, {{name}}? Great tutorial btw!
@amjadc
@amjadc 8 жыл бұрын
since we are not saving the user's name but could be implemented by adding name variable to createUsersTable, and user model. At the Signup you should add another input field asking for user name.
@ardaktileu4481
@ardaktileu4481 8 жыл бұрын
Please,can you help me!After reloading of page i got error message like(ErrorException in Cart.php line 17: Undefined property: App\Cart::$price)?What is it?
@academind
@academind 8 жыл бұрын
Are you using this code "App\Cart::$price"? That would be wrong, check your code and compare it with the video. Looking at this error message, specifically have a look at your price property. Is it set up correctly?
@ardaktileu4481
@ardaktileu4481 8 жыл бұрын
+Mindspace ok,Ty!
@ivalajk6807
@ivalajk6807 8 жыл бұрын
Have you managed to fix it? I am encountering the same problem...
@ivalajk6807
@ivalajk6807 8 жыл бұрын
Fixed... Somehow I managed to type $this->price instead of $item->price
@ardaktileu4481
@ardaktileu4481 8 жыл бұрын
iva lajk big thanks!
@thomasg2058
@thomasg2058 7 жыл бұрын
i'm building an eshop with clothes and i want each product have multiple colors..how can i store the same procuct with different color in session??can someone help me?
@jeremiahmuhoho733
@jeremiahmuhoho733 6 жыл бұрын
did you get a way out on this. I need the same
@jeremiahmuhoho733
@jeremiahmuhoho733 6 жыл бұрын
Academind could you please help us here?
@sankalp-will9371
@sankalp-will9371 6 жыл бұрын
This add to cart method works only if user is logged in, what if user is just surfing without logging in and he clicks on add to cart? redirect him to login page, that's too bad
@sankalp-will9371
@sankalp-will9371 6 жыл бұрын
You need to use cookies for that
@marcoantonio7634
@marcoantonio7634 6 жыл бұрын
where can i find the database?
@ceylontwowheels4016
@ceylontwowheels4016 4 жыл бұрын
Is it work with laravel 7 please tell mw guys 😥😥😥😥😥😥😥😥😥😥😥😥
@mdhemelrana8282
@mdhemelrana8282 8 жыл бұрын
Thanks for this valuable series. You are such a great teacher. Hope you will be able to complete this series soon becoz we'r waiting for you. Many thanks for rest of the videos. Good Luck.
@academind
@academind 8 жыл бұрын
I'm happy to hear that you're enjoying the series! :)
@mdhemelrana8282
@mdhemelrana8282 8 жыл бұрын
You deserve it becoz you have earned it.
@MrDeveloper
@MrDeveloper 8 жыл бұрын
Hello, this is very nice tutorial. Are you uploading tutorial everyday ?
@gidimotje
@gidimotje 8 жыл бұрын
Awesome tutorial! I completed it and it was very clear. Thanks! Just one question. Is it possible to do the same thing without saving the price in a database? See it as kinda like a dynamic price.
@academind
@academind 8 жыл бұрын
Of course, you could fetch/ calculate the price however you want.
@gidimotje
@gidimotje 8 жыл бұрын
Okay! Do I have to do that in my Cart model? Because I wouldn't know how to get the value of a input field hidden and set the price equal to that. Greetings from the Netherlands!
@academind
@academind 8 жыл бұрын
Can't really explain this here as it's a bit too far beyond the scope of the video. If you get the value from an input field, why don't you just submit a form as you submit all forms in a PHP/ Laravel app?
@minhtaitrinh8109
@minhtaitrinh8109 8 жыл бұрын
Hey ,in line 27 that is allowed to assign or create a session?
@academind
@academind 8 жыл бұрын
What do you mean with "allowed to assign or create a session"? I'm using the Session which gets created and managed by Laravel and of course it's allowed to add items to that session if you mean that.
@minhtaitrinh8109
@minhtaitrinh8109 8 жыл бұрын
$this->items=$a->items; I do not understand this place.
@academind
@academind 8 жыл бұрын
Could you tell me where (minute mark) this code gets used?
@minhtaitrinh8109
@minhtaitrinh8109 8 жыл бұрын
line 14
@academind
@academind 8 жыл бұрын
Hm, not able to find the code you're having problems with. At which minute in the video does it appear?
@bainapallisankar1193
@bainapallisankar1193 6 жыл бұрын
when i will be trying addcart getting this error "Type error: Too few arguments to function App\Http\Controllers\ProductsController::getAdd(), 1 passed and exactly 2 expected" THis is my code please help me public function getAdd(Request $request,$id){ $products = Product::find($id); $oldCart = Session::has('cart') ? Session::get('cart'):null; $cart = new Cart($oldCart); $cart->add($products,$products->id); $request->session()->put('cart',$cart); dd($request->session()->get('cart')); return redirect('/'); }
@davidogheneovoedijala4597
@davidogheneovoedijala4597 6 жыл бұрын
Great Tutorial. Please can anyone share any resource on how to add colors and dynamic quantity to the cart? Thanks in Advance
@prabinbajracharya3488
@prabinbajracharya3488 8 жыл бұрын
Invalid argument supplied for foreach() (View: C:\Users\prabin\blog esources\views\shop\shopping-cart.blade.php)....i get this error
@academind
@academind 8 жыл бұрын
Check your foreach loop there and also compare it to my code (link in video description). Maybe some typo.
@juandaniel2838
@juandaniel2838 8 жыл бұрын
Im having the same problem :/, did you find where is the error?
@kennychansin
@kennychansin 8 жыл бұрын
Hello, nice video, how many tutorial you still have for that?
@academind
@academind 8 жыл бұрын
I can't tell, I don't produce them in one big recording session. I'll see what I'll add :)
@kennychansin
@kennychansin 8 жыл бұрын
Oh!! i think you do a oneshot before upload it. still keep up because it's so coool I learn so much :)
@kennexmasaoy3026
@kennexmasaoy3026 6 жыл бұрын
How to remove 1 item in the cart?
@ShakirAli-wb5ho
@ShakirAli-wb5ho 4 жыл бұрын
Really Lot's of thanks sir, Your explanation is very perfect
@akilraza11
@akilraza11 5 жыл бұрын
Hello, Lovely tutorial , cleared my concept of adding to session really quick, but can you help me with how to delete a product from session ? please :)
@Codefide
@Codefide 4 жыл бұрын
did you figure this out yet?
@mehmetcelik9911
@mehmetcelik9911 8 жыл бұрын
Hello, when will you push the codes to github?
@academind
@academind 8 жыл бұрын
Sorry if I forgot that, code should be available now (make sure to pick the right branch). Max
@mehmetcelik9911
@mehmetcelik9911 8 жыл бұрын
Thank you, btw i like your tutorials :)
@academind
@academind 8 жыл бұрын
That's really great to hear Mehmet! :)
@SigfriedSeldeslachts
@SigfriedSeldeslachts 8 жыл бұрын
Why do you first type php arisan migrate:reset and then php artisan migrate you can just do php artisan migrate:refresh, It will do the same
@academind
@academind 8 жыл бұрын
Absolutely correct. May I be honest? I mistakenly used the wrong one (wanted to use refresh) and then thought: "Well, let's go from there, then I show these two commands". When the time comes, I'll also show the other ;-)
@shem2382
@shem2382 8 жыл бұрын
php artisan migrate:refresh --seed
@SigfriedSeldeslachts
@SigfriedSeldeslachts 8 жыл бұрын
Mindspace Haha was just wondering :)
@shem2382
@shem2382 8 жыл бұрын
Do you really have to build a cms to handle a shopping cart??
@academind
@academind 8 жыл бұрын
What do you mean with CMS? I won't use a CMS in this series, but I won't build one either :-)
@josiahilesanmi8144
@josiahilesanmi8144 8 жыл бұрын
whats wrong building a CMS to handle a shopping cart?
@R6M3
@R6M3 8 жыл бұрын
One of the line in the ProductController should be like this: @16:30 $oldcart = Session::has('cart')?$request->session()->get('cart'):null; so that it will not replace the old item with new item, and will allow new items to be stored. As for the quantity, you can do it like this: public function add($item, $id, $qty) { $storedItem = ['qty'=>0, 'price'=>$item->price, 'item'=> $item]; if($this->items) { if(array_key_exists($id, $this->items)) { $storedItem = $this->items[$id]; } } $storedItem['qty'] += $qty; $storedItem['price'] = $item->price * $storedItem['qty']; $this->items[$id] = $storedItem; $this->totalQty += $qty; $this->totalPrice += $item->price; }
@minhtaitrinh8109
@minhtaitrinh8109 8 жыл бұрын
dd($value) it used to do?
@academind
@academind 8 жыл бұрын
It's helpful to print out the value of a certain variable to the screen. Some quick debugging basically
@justinangeloperez8789
@justinangeloperez8789 7 жыл бұрын
What editor are you using?
@academind
@academind 7 жыл бұрын
I'm using PHPStorm by Jetbrains in this video
@justinangeloperez8789
@justinangeloperez8789 7 жыл бұрын
thank you
@gazmirsulcaj5196
@gazmirsulcaj5196 4 жыл бұрын
someone have this error : "Must provide source or customer" , when trying for checkout request?
@sheerasai5948
@sheerasai5948 6 жыл бұрын
God Bless You, Your Efforts Creates Many web developers To The LimeLight.
@louisham6998
@louisham6998 6 жыл бұрын
"syntax error, unexpected '$storedItem' (T_VARIABLE), expecting function (T_FUNCTION) or const (T_CONST)" $storedItem['qty']++; has a syntax error
@ilhamsabar3628
@ilhamsabar3628 8 жыл бұрын
i get array is null. why ? please help me to solved this :D thanks before
@academind
@academind 8 жыл бұрын
It's best if you compare your code to mine (code can be found in Github repo in video description). You most likely forget to set your shopping cart at some point or something like that
@Sarahnjeri354
@Sarahnjeri354 8 жыл бұрын
Hello. Did your code work. I had similar problem where my code was returning null but I solved it after a petty mistake.
@blackcaller9
@blackcaller9 6 жыл бұрын
for people still wondering about this one, check your cart model line4line there is prbly something different. in my case it was a $this that had 2 be $items
@mehtabhabib
@mehtabhabib 8 жыл бұрын
Awesome... been waiting for this one for a long time... because of node tutorials... Please update/complete laravel's eCommerce tutorial ASAP as you have been so easy to follow... :-)
@academind
@academind 8 жыл бұрын
Happy to hear that you're liking it, but it'll still take some time as I got loads of other things to do as well ;-)
@ardaktileu4481
@ardaktileu4481 8 жыл бұрын
Thank you mate!
@retardiran87
@retardiran87 8 жыл бұрын
Excellent video! And an excellent course overall!
@academind
@academind 8 жыл бұрын
Many thanks! :)
@motgamer768
@motgamer768 4 жыл бұрын
i have this error in construct """"Unresolvable dependency resolving [Parameter #0 [ $oldPanier ]] in class App\Panier
@ilng2007
@ilng2007 3 жыл бұрын
I'm having the same error, did you fix it?
@juancruzalric5771
@juancruzalric5771 8 жыл бұрын
when i try to access my product view i've got this error "syntax error, unexpected '$oldCart' (T_VARIABLE)" please someone can help me
@mehrdadgolestani3112
@mehrdadgolestani3112 4 жыл бұрын
probably syntax error caused by typing "public __construct()" instead of "public function __construct()".not much help after 3 years:D
@kurtduane
@kurtduane 7 жыл бұрын
Session store not set on request how to fix it
@RichardOpokuEngineer
@RichardOpokuEngineer 6 жыл бұрын
use middlewareGroups 'web'
@minjon56
@minjon56 8 жыл бұрын
I'm wondering why we would add an item one by one? What if we want to buy i.e.10 items of one type and 20 items of another type? Imagine how many times we should have to click add-to-cart button? Well, I guess it's the easiest way to create a shopping cart, but it's not the way how things work in the real word where there is a quantity field for a customer to make their choice of quantity.
@UzomaUmekwe
@UzomaUmekwe 8 жыл бұрын
what you are talking about is quite easy to implement. I believe the tutor was intending to give us the basics on developing an e-commerce store so we can extend as we wish. Infact, i implemented this feature you talk about in less than 20mins including testing. I think we should appreciate him cos he has really done an excellent job with this tutorial.
@davidogheneovoedijala4597
@davidogheneovoedijala4597 6 жыл бұрын
Please can you share how you did this or a link to a resource that can. Thanks!
@PerryPalmtree
@PerryPalmtree 6 жыл бұрын
Guys, where is 'cart' coming from? how does getAddToCart know what 'cart' is?
@Perasis
@Perasis 6 жыл бұрын
use App\Cart;
@RazvanTSibiu
@RazvanTSibiu 6 жыл бұрын
you store all 'cart' information in a session called 'cart'
@shem2382
@shem2382 8 жыл бұрын
your angular 2 tutorial are very good as well. This one is awesome. Also JavaScript isn't my strong point should i just learn type script instead?? since the angular team seems to be pushing type script. honestly i prefer type script so far to JavaScript. What's your opinion on this matter??
@academind
@academind 8 жыл бұрын
I prefer TypeScript, too, but there's no way around learning JavaScript. In the end TypeScript is based on it and you're still using built-in JS "commands"/ Objects. You might not have to be an expert but basic knowledge is certainly required and helpful
@shem2382
@shem2382 8 жыл бұрын
OK. Yeah I definitely agree
@nguyentrucxjnh
@nguyentrucxjnh 8 жыл бұрын
@shemmarah john, me too. I scare JS and i learned TS instead, thank @Mindspace
@rizwanzafar1628
@rizwanzafar1628 5 жыл бұрын
Helo sir it's next tutorial link....?
@jebbush2964
@jebbush2964 8 жыл бұрын
One questions, Can you make a tutorial on HOW TO DEPLOY A LARAVEL application to the cloud, Digital Ocean, AWS3, Heroku, etc. I have seen thousands of Laravel tutorials but there is not even a decent one on How to deploy. Can you teach us how to deploy using a MySQL database?
@traciedavid8092
@traciedavid8092 8 жыл бұрын
devmarketer.io/learn/deploy-laravel-5-app-lemp-stack-ubuntu-nginx/
@mooodddy1
@mooodddy1 8 жыл бұрын
how to remove item from cart ?
@academind
@academind 8 жыл бұрын
Will add that functionality in the future. You may of course try implementing this feature on your own as a little challenge though ;)
@mooodddy1
@mooodddy1 8 жыл бұрын
thanks for cooperative with me I waited complemented course I hope that is not delayed download more videos Thanks again :)
@digicat5851
@digicat5851 7 жыл бұрын
Laraver offers better way then "php artisan migrate:reset" and then "php artisan migrate" just type "php artisan migrate:fresh"
@arfin5079
@arfin5079 8 жыл бұрын
Hello #Mindspace Another nice tutorial when will you upload the next tutorial ??
@academind
@academind 8 жыл бұрын
Thanks a lot. In a couple of days probably.
@MAHOSSAN1
@MAHOSSAN1 5 жыл бұрын
Can you please upload the code into github
@partikelking
@partikelking 3 жыл бұрын
your a master.. great thanks bro
@cccrockabilly
@cccrockabilly 5 жыл бұрын
thanks for the great tutorial, in laraval 5.8 use if (!session()->has('cart'))
@juanlucky8168
@juanlucky8168 5 жыл бұрын
be more spesific please, how about the Session::get? or the oldCart before?
@cccrockabilly
@cccrockabilly 5 жыл бұрын
@@juanlucky8168 This was to check if your session allready had a cart, when following the tutorial with a new laravel version, you get an error
@gheorghiinita3278
@gheorghiinita3278 8 жыл бұрын
Thank you very much for this tutorial - nice work!
@academind
@academind 8 жыл бұрын
Thanks so much! :)
@shakinahazmansa
@shakinahazmansa 7 жыл бұрын
hey guys. if you guys have the same problem as me on increment quantity on the shopping cart, you could try to change the $oldCart and the Session. somehow i dont know why or whats the reason of changing the codes make it work. try to view my codes and try to apply it okay. BTW im using Laravel 5.4. change in your ProductController.php the // is the codes from the tutorial i comment it so that you can know which one that i change. Good luck! public function getAddToCart(Request $request, $id){ $product = Product::find($id); $cart = Session::has('cart') ? Session::get('cart') : null; //$cart = new Cart($oldCart); if(!$cart) { $cart = new Cart($cart); } //$product = $product->id; $cart->add($product, $product->id); Session::put('cart', $cart); //$request->session()->put('cart', $cart); //var_dump($request->session()->get('cart')); return redirect()->route('products.index'); }
@newplayer1313
@newplayer1313 7 жыл бұрын
Shakinah Azman thanx!!
@abdullahsaid8561
@abdullahsaid8561 7 жыл бұрын
still not work, mine 5.2
@keithcarrillo8238
@keithcarrillo8238 6 жыл бұрын
is '$product = $product->id;' your code, instead?
@Ali-nj1tv
@Ali-nj1tv 5 жыл бұрын
I would appreciate if it is possible for you to add a comment on each line in "cart.php" page, due to this page is really a bit confused how this process works each step by it would help if you could put comment ane end of each line for us to understand each step of each line what is all about. please let me know, many thanks. AM
@Jesse-ty9ln
@Jesse-ty9ln 3 жыл бұрын
thanks alot u rly helped me out
@sankalp-will9371
@sankalp-will9371 6 жыл бұрын
Use laravel's gloudemans cart package...
@niccubagonoc2153
@niccubagonoc2153 6 жыл бұрын
Has anyone here extended this feature with AJAX? I've extended this project with user role management, product management, order status management features. All that is left is implementing AJAX when adding a product to cart.
@najmeddinhaidar9641
@najmeddinhaidar9641 2 жыл бұрын
hey, great tutorial, I've been searching the internet to solve my cart variation issue without any luck so far, i was wondering if your could update the cart.php class or maybe share the code where a user can add product variations that affects the price (size, Color, ... etc).
@Slav0v
@Slav0v 7 жыл бұрын
God bless you man ! Really helpful all your videos. Really tnx ! Regards!!!
@academind
@academind 7 жыл бұрын
Thanks so much Hristiqn, happy to hear you're liking my content!
@Slav0v
@Slav0v 7 жыл бұрын
Incredible helpful, really ! Greeting from Bulgaria! Good luck!
@oma3714
@oma3714 7 жыл бұрын
3:50 ф? xD
@jebbush2964
@jebbush2964 8 жыл бұрын
To all beginners PLEASE THE MOST IMPORTANT THING IS TO LEARN HOW TO DEPLOY A LARAVEL APP, if you are just learning but do not want to deploy it is ok to watch videos, do not make my same mistake, I have watched thousand of laravel tutorials but right b4 I was able to deploy I realized it is extremely difficult on the cloud, nobody is teaching how to deploy in the cloud, I do not why.
@academind
@academind 8 жыл бұрын
But that's not true in my opinion. It's actually really simply. Of course I don't know what you mean with "the cloud", but simply googling for AWS (which I would call "the cloud") + Laravel, yields this article as a first result: docs.aws.amazon.com/elasticbeanstalk/latest/dg/php-laravel-tutorial.html
@jebbush2964
@jebbush2964 8 жыл бұрын
Thank you for your prompt reply, if it is so simple WHY nobody creates a complete deployment tutorial on this, All tutorials I watched suck big time, if you decide to create a complete tutorial on how to deploy a complete laravel app on AWS and migrate the database please let me know...
@academind
@academind 8 жыл бұрын
I certainly will do some videos on the deployment in the future, but I can't tell when
@abhimanyuambastha2595
@abhimanyuambastha2595 8 жыл бұрын
@Jeb Bush: I had a php app on my localhost and was able to deploy it on AWS just by watching their 'basic deploy a complete web app' instructions. It's almost same as working on localhost except you ssh in and you have to put some firewalls for your VM and DB server. And to migrate your db, you create a backup and restore it on your db server after copying your file on it (using SCP). Now, I don't know how different it would be with Laravel, but I'm assuming it wouldn't be that hard, especially if you know a bit on sys admin. If you cant find out a good tutorial, just give it a try and learn it the hard way :)
@jebbush2964
@jebbush2964 8 жыл бұрын
@Abhimanyu Ambastha: Thank you for your reply, Could you make a video tutorial on how to deploy a PHP app on AWS, I know thousands of people would be interested in watching a video about this subject..
@jtech04
@jtech04 2 жыл бұрын
items:null in my case
Laravel 5.2 PHP - Build a Shopping Cart - #9 Cart Views
13:01
Academind
Рет қаралды 58 М.
Build a shopping cart with Laravel Cashier and Vue
55:07
Andrew Schmelyun
Рет қаралды 48 М.
Their Boat Engine Fell Off
0:13
Newsflare
Рет қаралды 15 МЛН
Air Sigma Girl #sigma
0:32
Jin and Hattie
Рет қаралды 45 МЛН
Caleb Pressley Shows TSA How It’s Done
0:28
Barstool Sports
Рет қаралды 60 МЛН
You might not need useEffect() ...
21:45
Academind
Рет қаралды 177 М.
Junior Code Review: Laravel Routes, Middleware, Validation and more
19:57
Laravel 10 Add To Shopping Cart
17:18
Cairocoders
Рет қаралды 12 М.
Session Management in Laravel - Beyond the Basics
11:30
Mohamed Said
Рет қаралды 28 М.
Laravel E-Commerce - Making Things Dynamic - Part 1
28:58
Andre Madarang
Рет қаралды 164 М.
[Live-Coding] Refactor Laravel Controller to be Much Shorter
14:55
Laravel Daily
Рет қаралды 77 М.
Laravel Language Switcher
27:58
Andre Madarang
Рет қаралды 88 М.
Laravel 5.2 PHP Build a social network - Setup & Introduction
26:56
Their Boat Engine Fell Off
0:13
Newsflare
Рет қаралды 15 МЛН