├── .env.example
├── .gitattributes
├── .gitignore
├── .idea
├── .name
├── blade.xml
├── laravel.iml
├── misc.xml
├── modules.xml
├── vcs.xml
└── workspace.xml
├── app
├── Cart.php
├── CartItem.php
├── Console
│ ├── Commands
│ │ └── Inspire.php
│ └── Kernel.php
├── Events
│ └── Event.php
├── Exceptions
│ └── Handler.php
├── File.php
├── Http
│ ├── Controllers
│ │ ├── Auth
│ │ │ ├── AuthController.php
│ │ │ └── PasswordController.php
│ │ ├── CartController.php
│ │ ├── Controller.php
│ │ ├── MainController.php
│ │ ├── OrderController.php
│ │ └── ProductController.php
│ ├── Kernel.php
│ ├── Middleware
│ │ ├── Authenticate.php
│ │ ├── EncryptCookies.php
│ │ ├── RedirectIfAuthenticated.php
│ │ └── VerifyCsrfToken.php
│ ├── Requests
│ │ └── Request.php
│ └── routes.php
├── Jobs
│ └── Job.php
├── Listeners
│ └── .gitkeep
├── Order.php
├── OrderItem.php
├── Policies
│ └── .gitkeep
├── Product.php
├── Providers
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
└── User.php
├── artisan
├── bootstrap
├── app.php
├── autoload.php
└── cache
│ └── .gitignore
├── composer.json
├── composer.lock
├── config
├── app.php
├── auth.php
├── broadcasting.php
├── cache.php
├── compile.php
├── database.php
├── filesystems.php
├── mail.php
├── queue.php
├── services.php
├── session.php
└── view.php
├── database
├── .gitignore
├── factories
│ └── ModelFactory.php
├── migrations
│ ├── .gitkeep
│ ├── 2014_10_12_000000_create_users_table.php
│ ├── 2014_10_12_100000_create_password_resets_table.php
│ ├── 2015_09_14_190324_create_table_products.php
│ ├── 2015_09_14_190329_create_table_files.php
│ ├── 2015_09_15_184232_create_table_carts.php
│ ├── 2015_09_15_184236_create_table_carts_item.php
│ ├── 2015_09_19_191803_create_table_orders.php
│ └── 2015_09_19_191807_create_table_order_items.php
└── seeds
│ ├── .gitkeep
│ └── DatabaseSeeder.php
├── gulpfile.js
├── package.json
├── phpspec.yml
├── phpunit.xml
├── public
├── .htaccess
├── css
│ └── style.css
├── favicon.ico
├── index.php
└── robots.txt
├── readme.md
├── resources
├── assets
│ └── sass
│ │ └── app.scss
├── lang
│ └── en
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
└── views
│ ├── admin
│ ├── new.blade.php
│ └── products.blade.php
│ ├── auth
│ ├── login.blade.php
│ └── register.blade.php
│ ├── cart
│ └── view.blade.php
│ ├── errors
│ └── 503.blade.php
│ ├── layouts
│ └── master.blade.php
│ ├── main
│ └── index.blade.php
│ ├── order
│ ├── list.blade.php
│ └── view.blade.php
│ ├── vendor
│ └── .gitkeep
│ └── welcome.blade.php
├── server.php
├── storage
├── app
│ └── .gitignore
├── framework
│ ├── .gitignore
│ ├── cache
│ │ └── .gitignore
│ ├── sessions
│ │ └── .gitignore
│ └── views
│ │ └── .gitignore
└── logs
│ └── .gitignore
└── tests
├── ExampleTest.php
└── TestCase.php
/.env.example:
--------------------------------------------------------------------------------
1 | APP_ENV=local
2 | APP_DEBUG=true
3 | APP_KEY=SomeRandomString
4 |
5 | DB_HOST=localhost
6 | DB_DATABASE=homestead
7 | DB_USERNAME=homestead
8 | DB_PASSWORD=secret
9 |
10 | CACHE_DRIVER=file
11 | SESSION_DRIVER=file
12 | QUEUE_DRIVER=sync
13 |
14 | MAIL_DRIVER=smtp
15 | MAIL_HOST=mailtrap.io
16 | MAIL_PORT=2525
17 | MAIL_USERNAME=null
18 | MAIL_PASSWORD=null
19 | MAIL_ENCRYPTION=null
20 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.less linguist-vendored
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | /node_modules
3 | Homestead.yaml
4 | Homestead.json
5 | .env
6 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | laravel
--------------------------------------------------------------------------------
/.idea/blade.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/.idea/laravel.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 | true
177 |
178 |
179 | $PROJECT_DIR$/gulpfile.js
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 | true
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 | 1442256021623
598 |
599 | 1442256021623
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
930 |
931 |
932 |
933 |
934 |
935 |
936 |
937 |
938 |
939 |
940 |
941 |
942 |
943 |
944 |
945 |
946 |
947 |
948 |
949 |
950 |
951 |
952 |
953 |
954 |
955 |
956 |
957 |
958 |
959 |
960 |
961 |
962 |
963 |
964 |
965 |
966 |
967 |
968 |
969 |
970 |
971 |
972 |
973 |
974 |
975 |
976 |
977 |
978 |
979 |
980 |
981 |
982 |
983 |
984 |
985 |
986 |
987 |
988 |
989 |
990 |
991 |
992 |
993 |
994 |
995 |
996 |
997 |
998 |
999 |
1000 |
1001 |
1002 |
--------------------------------------------------------------------------------
/app/Cart.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\User');
12 | }
13 |
14 | public function cartItems()
15 | {
16 | return $this->hasMany('App\CartItem');
17 | }
18 |
19 |
20 | }
--------------------------------------------------------------------------------
/app/CartItem.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\Cart');
12 | }
13 |
14 | public function product()
15 | {
16 | return $this->belongsTo('App\Product');
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/Console/Commands/Inspire.php:
--------------------------------------------------------------------------------
1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')
28 | ->hourly();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/Events/Event.php:
--------------------------------------------------------------------------------
1 | getMessage(), $e);
47 | }
48 |
49 | return parent::render($request, $e);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/File.php:
--------------------------------------------------------------------------------
1 | middleware('guest', ['except' => 'getLogout']);
34 | }
35 |
36 | /**
37 | * Get a validator for an incoming registration request.
38 | *
39 | * @param array $data
40 | * @return \Illuminate\Contracts\Validation\Validator
41 | */
42 | protected function validator(array $data)
43 | {
44 | return Validator::make($data, [
45 | 'name' => 'required|max:255',
46 | 'email' => 'required|email|max:255|unique:users',
47 | 'password' => 'required|confirmed|min:6',
48 | ]);
49 | }
50 |
51 | /**
52 | * Create a new user instance after a valid registration.
53 | *
54 | * @param array $data
55 | * @return User
56 | */
57 | protected function create(array $data)
58 | {
59 | return User::create([
60 | 'name' => $data['name'],
61 | 'email' => $data['email'],
62 | 'password' => bcrypt($data['password']),
63 | ]);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/PasswordController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/Http/Controllers/CartController.php:
--------------------------------------------------------------------------------
1 | middleware('auth');
19 | }
20 |
21 | public function addItem ($productId){
22 |
23 | $cart = Cart::where('user_id',Auth::user()->id)->first();
24 |
25 | if(!$cart){
26 | $cart = new Cart();
27 | $cart->user_id=Auth::user()->id;
28 | $cart->save();
29 | }
30 |
31 | $cartItem = new Cartitem();
32 | $cartItem->product_id=$productId;
33 | $cartItem->cart_id= $cart->id;
34 | $cartItem->save();
35 |
36 | return redirect('/cart');
37 |
38 | }
39 |
40 | public function showCart(){
41 | $cart = Cart::where('user_id',Auth::user()->id)->first();
42 |
43 | if(!$cart){
44 | $cart = new Cart();
45 | $cart->user_id=Auth::user()->id;
46 | $cart->save();
47 | }
48 |
49 | $items = $cart->cartItems;
50 | $total=0;
51 | foreach($items as $item){
52 | $total+=$item->product->price;
53 | }
54 |
55 | return view('cart.view',['items'=>$items,'total'=>$total]);
56 | }
57 |
58 | public function removeItem($id){
59 |
60 | CartItem::destroy($id);
61 | return redirect('/cart');
62 | }
63 |
64 | }
--------------------------------------------------------------------------------
/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | $products]);
17 |
18 | }
19 | }
--------------------------------------------------------------------------------
/app/Http/Controllers/OrderController.php:
--------------------------------------------------------------------------------
1 | middleware('auth');
24 | }
25 |
26 | public function checkout(Request $request)
27 | {
28 | $token = $request->input('stripeToken');
29 |
30 | //Retriieve cart information
31 | $cart = Cart::where('user_id',Auth::user()->id)->first();
32 | $items = $cart->cartItems;
33 | $total=0;
34 | foreach($items as $item){
35 | $total+=$item->product->price;
36 | }
37 |
38 |
39 | if(
40 | Auth::user()->charge($total*100, [
41 | 'source' => $token,
42 | 'receipt_email' => Auth::user()->email,
43 | ])){
44 |
45 | $order = new Order();
46 | $order->total_paid= $total;
47 | $order->user_id=Auth::user()->id;
48 | $order->save();
49 |
50 | foreach($items as $item){
51 | $orderItem = new OrderItem();
52 | $orderItem->order_id=$order->id;
53 | $orderItem->product_id=$item->product->id;
54 | $orderItem->file_id=$item->product->file->id;
55 | $orderItem->save();
56 |
57 | CartItem::destroy($item->id);
58 | }
59 | return redirect('/order/'.$order->id);
60 |
61 | }else{
62 | return redirect('/cart');
63 | }
64 |
65 | }
66 |
67 | public function index(){
68 | $orders = Order::where('user_id',Auth::user()->id)->get();
69 |
70 | return view('order.list',['orders'=>$orders]);
71 | }
72 |
73 | public function viewOrder($orderId){
74 | $order = Order::find($orderId);
75 | return view('order.view',['order'=>$order]);
76 | }
77 |
78 |
79 | public function download($orderId,$filename){
80 |
81 | $fileid=\App\File::where('filename',$filename)->first();
82 |
83 | $orderItem = OrderItem::where('order_id','=',$orderId)->where('file_id',$fileid->id)->first();
84 |
85 |
86 | if(!$orderItem){
87 | redirect('/failed');
88 | }
89 |
90 | $entry = \App\File::where('filename',$filename)->first();
91 | $file = Storage::disk('local')->get($entry->filename);
92 |
93 | return (new Response($file, 200))
94 | ->header('Content-Type', $entry->mime);
95 |
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/app/Http/Controllers/ProductController.php:
--------------------------------------------------------------------------------
1 | $products]);
21 | }
22 |
23 | public function destroy($id){
24 |
25 | Product::destroy($id);
26 | return redirect('/admin/products');
27 | }
28 |
29 | public function newProduct(){
30 | return view('admin.new');
31 | }
32 |
33 | public function add() {
34 |
35 | $file = Request::file('file');
36 | $extension = $file->getClientOriginalExtension();
37 | Storage::disk('local')->put($file->getFilename().'.'.$extension, File::get($file));
38 |
39 | $entry = new \App\File();
40 | $entry->mime = $file->getClientMimeType();
41 | $entry->original_filename = $file->getClientOriginalName();
42 | $entry->filename = $file->getFilename().'.'.$extension;
43 |
44 | $entry->save();
45 |
46 | $product = new Product();
47 | $product->file_id=$entry->id;
48 | $product->name =Request::input('name');
49 | $product->description =Request::input('description');
50 | $product->price =Request::input('price');
51 | $product->imageurl =Request::input('imageurl');
52 |
53 | $product->save();
54 |
55 | return redirect('/admin/products');
56 |
57 | }
58 |
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/app/Http/Kernel.php:
--------------------------------------------------------------------------------
1 | \App\Http\Middleware\Authenticate::class,
30 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
31 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
32 | ];
33 | }
34 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | auth = $auth;
26 | }
27 |
28 | /**
29 | * Handle an incoming request.
30 | *
31 | * @param \Illuminate\Http\Request $request
32 | * @param \Closure $next
33 | * @return mixed
34 | */
35 | public function handle($request, Closure $next)
36 | {
37 | if ($this->auth->guest()) {
38 | if ($request->ajax()) {
39 | return response('Unauthorized.', 401);
40 | } else {
41 | return redirect()->guest('auth/login');
42 | }
43 | }
44 |
45 | return $next($request);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | auth = $auth;
26 | }
27 |
28 | /**
29 | * Handle an incoming request.
30 | *
31 | * @param \Illuminate\Http\Request $request
32 | * @param \Closure $next
33 | * @return mixed
34 | */
35 | public function handle($request, Closure $next)
36 | {
37 | if ($this->auth->check()) {
38 | return redirect('/home');
39 | }
40 |
41 | return $next($request);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/Http/Middleware/VerifyCsrfToken.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\User');
12 | }
13 |
14 | public function orderItems()
15 | {
16 | return $this->hasMany('App\OrderItem');
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/OrderItem.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\Product');
13 | }
14 |
15 | public function file()
16 | {
17 | return $this->belongsTo('App\File');
18 | }
19 |
20 |
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/app/Policies/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andbet39/laravelShop/c9391b1ad95cbc75b1d391e18f2d59ff97a1a1eb/app/Policies/.gitkeep
--------------------------------------------------------------------------------
/app/Product.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\File');
12 | }
13 | }
--------------------------------------------------------------------------------
/app/Providers/AppServiceProvider.php:
--------------------------------------------------------------------------------
1 | 'App\Policies\ModelPolicy',
17 | ];
18 |
19 | /**
20 | * Register any application authentication / authorization services.
21 | *
22 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate
23 | * @return void
24 | */
25 | public function boot(GateContract $gate)
26 | {
27 | parent::registerPolicies($gate);
28 |
29 | //
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
17 | 'App\Listeners\EventListener',
18 | ],
19 | ];
20 |
21 | /**
22 | * Register any other events for your application.
23 | *
24 | * @param \Illuminate\Contracts\Events\Dispatcher $events
25 | * @return void
26 | */
27 | public function boot(DispatcherContract $events)
28 | {
29 | parent::boot($events);
30 |
31 | //
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | group(['namespace' => $this->namespace], function ($router) {
41 | require app_path('Http/routes.php');
42 | });
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/User.php:
--------------------------------------------------------------------------------
1 | make(Illuminate\Contracts\Console\Kernel::class);
32 |
33 | $status = $kernel->handle(
34 | $input = new Symfony\Component\Console\Input\ArgvInput,
35 | new Symfony\Component\Console\Output\ConsoleOutput
36 | );
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Shutdown The Application
41 | |--------------------------------------------------------------------------
42 | |
43 | | Once Artisan has finished running. We will fire off the shutdown events
44 | | so that any final work may be done by the application before we shut
45 | | down the process. This is the last thing to happen to the request.
46 | |
47 | */
48 |
49 | $kernel->terminate($input, $status);
50 |
51 | exit($status);
52 |
--------------------------------------------------------------------------------
/bootstrap/app.php:
--------------------------------------------------------------------------------
1 | singleton(
30 | Illuminate\Contracts\Http\Kernel::class,
31 | App\Http\Kernel::class
32 | );
33 |
34 | $app->singleton(
35 | Illuminate\Contracts\Console\Kernel::class,
36 | App\Console\Kernel::class
37 | );
38 |
39 | $app->singleton(
40 | Illuminate\Contracts\Debug\ExceptionHandler::class,
41 | App\Exceptions\Handler::class
42 | );
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Return The Application
47 | |--------------------------------------------------------------------------
48 | |
49 | | This script returns the application instance. The instance is given to
50 | | the calling script so we can separate the building of the instances
51 | | from the actual running of the application and sending responses.
52 | |
53 | */
54 |
55 | return $app;
56 |
--------------------------------------------------------------------------------
/bootstrap/autoload.php:
--------------------------------------------------------------------------------
1 | =5.5.9",
9 | "laravel/framework": "5.1.*"
10 | },
11 | "require-dev": {
12 | "fzaninotto/faker": "~1.4",
13 | "mockery/mockery": "0.9.*",
14 | "phpunit/phpunit": "~4.0",
15 | "phpspec/phpspec": "~2.1",
16 | "laravel/cashier": "~5.0"
17 |
18 | },
19 | "autoload": {
20 | "classmap": [
21 | "database"
22 | ],
23 | "psr-4": {
24 | "App\\": "app/"
25 | }
26 | },
27 | "autoload-dev": {
28 | "classmap": [
29 | "tests/TestCase.php"
30 | ]
31 | },
32 | "scripts": {
33 | "post-install-cmd": [
34 | "php artisan clear-compiled",
35 | "php artisan optimize"
36 | ],
37 | "pre-update-cmd": [
38 | "php artisan clear-compiled"
39 | ],
40 | "post-update-cmd": [
41 | "php artisan optimize"
42 | ],
43 | "post-root-package-install": [
44 | "php -r \"copy('.env.example', '.env');\""
45 | ],
46 | "post-create-project-cmd": [
47 | "php artisan key:generate"
48 | ]
49 | },
50 | "config": {
51 | "preferred-install": "dist"
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/config/app.php:
--------------------------------------------------------------------------------
1 | env('APP_DEBUG', false),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Application URL
21 | |--------------------------------------------------------------------------
22 | |
23 | | This URL is used by the console to properly generate URLs when using
24 | | the Artisan command line tool. You should set this to the root of
25 | | your application so that it is used when running Artisan tasks.
26 | |
27 | */
28 |
29 | 'url' => 'http://localhost',
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Application Timezone
34 | |--------------------------------------------------------------------------
35 | |
36 | | Here you may specify the default timezone for your application, which
37 | | will be used by the PHP date and date-time functions. We have gone
38 | | ahead and set this to a sensible default for you out of the box.
39 | |
40 | */
41 |
42 | 'timezone' => 'UTC',
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Application Locale Configuration
47 | |--------------------------------------------------------------------------
48 | |
49 | | The application locale determines the default locale that will be used
50 | | by the translation service provider. You are free to set this value
51 | | to any of the locales which will be supported by the application.
52 | |
53 | */
54 |
55 | 'locale' => 'en',
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | Application Fallback Locale
60 | |--------------------------------------------------------------------------
61 | |
62 | | The fallback locale determines the locale to use when the current one
63 | | is not available. You may change the value to correspond to any of
64 | | the language folders that are provided through your application.
65 | |
66 | */
67 |
68 | 'fallback_locale' => 'en',
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Encryption Key
73 | |--------------------------------------------------------------------------
74 | |
75 | | This key is used by the Illuminate encrypter service and should be set
76 | | to a random, 32 character string, otherwise these encrypted strings
77 | | will not be safe. Please do this before deploying an application!
78 | |
79 | */
80 |
81 | 'key' => env('APP_KEY', 'SomeRandomString'),
82 |
83 | 'cipher' => 'AES-256-CBC',
84 |
85 | /*
86 | |--------------------------------------------------------------------------
87 | | Logging Configuration
88 | |--------------------------------------------------------------------------
89 | |
90 | | Here you may configure the log settings for your application. Out of
91 | | the box, Laravel uses the Monolog PHP logging library. This gives
92 | | you a variety of powerful log handlers / formatters to utilize.
93 | |
94 | | Available Settings: "single", "daily", "syslog", "errorlog"
95 | |
96 | */
97 |
98 | 'log' => 'single',
99 |
100 | /*
101 | |--------------------------------------------------------------------------
102 | | Autoloaded Service Providers
103 | |--------------------------------------------------------------------------
104 | |
105 | | The service providers listed here will be automatically loaded on the
106 | | request to your application. Feel free to add your own services to
107 | | this array to grant expanded functionality to your applications.
108 | |
109 | */
110 |
111 | 'providers' => [
112 |
113 | /*
114 | * Laravel Framework Service Providers...
115 | */
116 | Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
117 | Illuminate\Auth\AuthServiceProvider::class,
118 | Illuminate\Broadcasting\BroadcastServiceProvider::class,
119 | Illuminate\Bus\BusServiceProvider::class,
120 | Illuminate\Cache\CacheServiceProvider::class,
121 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
122 | Illuminate\Routing\ControllerServiceProvider::class,
123 | Illuminate\Cookie\CookieServiceProvider::class,
124 | Illuminate\Database\DatabaseServiceProvider::class,
125 | Illuminate\Encryption\EncryptionServiceProvider::class,
126 | Illuminate\Filesystem\FilesystemServiceProvider::class,
127 | Illuminate\Foundation\Providers\FoundationServiceProvider::class,
128 | Illuminate\Hashing\HashServiceProvider::class,
129 | Illuminate\Mail\MailServiceProvider::class,
130 | Illuminate\Pagination\PaginationServiceProvider::class,
131 | Illuminate\Pipeline\PipelineServiceProvider::class,
132 | Illuminate\Queue\QueueServiceProvider::class,
133 | Illuminate\Redis\RedisServiceProvider::class,
134 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
135 | Illuminate\Session\SessionServiceProvider::class,
136 | Illuminate\Translation\TranslationServiceProvider::class,
137 | Illuminate\Validation\ValidationServiceProvider::class,
138 | Illuminate\View\ViewServiceProvider::class,
139 |
140 | /*
141 | * Application Service Providers...
142 | */
143 | App\Providers\AppServiceProvider::class,
144 | App\Providers\AuthServiceProvider::class,
145 | App\Providers\EventServiceProvider::class,
146 | App\Providers\RouteServiceProvider::class,
147 | Laravel\Cashier\CashierServiceProvider::class,
148 |
149 |
150 | ],
151 |
152 | /*
153 | |--------------------------------------------------------------------------
154 | | Class Aliases
155 | |--------------------------------------------------------------------------
156 | |
157 | | This array of class aliases will be registered when this application
158 | | is started. However, feel free to register as many as you wish as
159 | | the aliases are "lazy" loaded so they don't hinder performance.
160 | |
161 | */
162 |
163 | 'aliases' => [
164 |
165 | 'App' => Illuminate\Support\Facades\App::class,
166 | 'Artisan' => Illuminate\Support\Facades\Artisan::class,
167 | 'Auth' => Illuminate\Support\Facades\Auth::class,
168 | 'Blade' => Illuminate\Support\Facades\Blade::class,
169 | 'Bus' => Illuminate\Support\Facades\Bus::class,
170 | 'Cache' => Illuminate\Support\Facades\Cache::class,
171 | 'Config' => Illuminate\Support\Facades\Config::class,
172 | 'Cookie' => Illuminate\Support\Facades\Cookie::class,
173 | 'Crypt' => Illuminate\Support\Facades\Crypt::class,
174 | 'DB' => Illuminate\Support\Facades\DB::class,
175 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
176 | 'Event' => Illuminate\Support\Facades\Event::class,
177 | 'File' => Illuminate\Support\Facades\File::class,
178 | 'Gate' => Illuminate\Support\Facades\Gate::class,
179 | 'Hash' => Illuminate\Support\Facades\Hash::class,
180 | 'Input' => Illuminate\Support\Facades\Input::class,
181 | 'Inspiring' => Illuminate\Foundation\Inspiring::class,
182 | 'Lang' => Illuminate\Support\Facades\Lang::class,
183 | 'Log' => Illuminate\Support\Facades\Log::class,
184 | 'Mail' => Illuminate\Support\Facades\Mail::class,
185 | 'Password' => Illuminate\Support\Facades\Password::class,
186 | 'Queue' => Illuminate\Support\Facades\Queue::class,
187 | 'Redirect' => Illuminate\Support\Facades\Redirect::class,
188 | 'Redis' => Illuminate\Support\Facades\Redis::class,
189 | 'Request' => Illuminate\Support\Facades\Request::class,
190 | 'Response' => Illuminate\Support\Facades\Response::class,
191 | 'Route' => Illuminate\Support\Facades\Route::class,
192 | 'Schema' => Illuminate\Support\Facades\Schema::class,
193 | 'Session' => Illuminate\Support\Facades\Session::class,
194 | 'Storage' => Illuminate\Support\Facades\Storage::class,
195 | 'URL' => Illuminate\Support\Facades\URL::class,
196 | 'Validator' => Illuminate\Support\Facades\Validator::class,
197 | 'View' => Illuminate\Support\Facades\View::class,
198 |
199 | ],
200 |
201 | ];
202 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | 'eloquent',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Authentication Model
23 | |--------------------------------------------------------------------------
24 | |
25 | | When using the "Eloquent" authentication driver, we need to know which
26 | | Eloquent model should be used to retrieve your users. Of course, it
27 | | is often just the "User" model but you may use whatever you like.
28 | |
29 | */
30 |
31 | 'model' => App\User::class,
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | Authentication Table
36 | |--------------------------------------------------------------------------
37 | |
38 | | When using the "Database" authentication driver, we need to know which
39 | | table should be used to retrieve your users. We have chosen a basic
40 | | default value but you may easily change it to any table you like.
41 | |
42 | */
43 |
44 | 'table' => 'users',
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Password Reset Settings
49 | |--------------------------------------------------------------------------
50 | |
51 | | Here you may set the options for resetting passwords including the view
52 | | that is your password reset e-mail. You can also set the name of the
53 | | table that maintains all of the reset tokens for your application.
54 | |
55 | | The expire time is the number of minutes that the reset token should be
56 | | considered valid. This security feature keeps tokens short-lived so
57 | | they have less time to be guessed. You may change this as needed.
58 | |
59 | */
60 |
61 | 'password' => [
62 | 'email' => 'emails.password',
63 | 'table' => 'password_resets',
64 | 'expire' => 60,
65 | ],
66 |
67 | ];
68 |
--------------------------------------------------------------------------------
/config/broadcasting.php:
--------------------------------------------------------------------------------
1 | env('BROADCAST_DRIVER', 'pusher'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Broadcast Connections
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may define all of the broadcast connections that will be used
24 | | to broadcast events to other systems or over websockets. Samples of
25 | | each available type of connection are provided inside this array.
26 | |
27 | */
28 |
29 | 'connections' => [
30 |
31 | 'pusher' => [
32 | 'driver' => 'pusher',
33 | 'key' => env('PUSHER_KEY'),
34 | 'secret' => env('PUSHER_SECRET'),
35 | 'app_id' => env('PUSHER_APP_ID'),
36 | ],
37 |
38 | 'redis' => [
39 | 'driver' => 'redis',
40 | 'connection' => 'default',
41 | ],
42 |
43 | 'log' => [
44 | 'driver' => 'log',
45 | ],
46 |
47 | ],
48 |
49 | ];
50 |
--------------------------------------------------------------------------------
/config/cache.php:
--------------------------------------------------------------------------------
1 | env('CACHE_DRIVER', 'file'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Cache Stores
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may define all of the cache "stores" for your application as
24 | | well as their drivers. You may even define multiple stores for the
25 | | same cache driver to group types of items stored in your caches.
26 | |
27 | */
28 |
29 | 'stores' => [
30 |
31 | 'apc' => [
32 | 'driver' => 'apc',
33 | ],
34 |
35 | 'array' => [
36 | 'driver' => 'array',
37 | ],
38 |
39 | 'database' => [
40 | 'driver' => 'database',
41 | 'table' => 'cache',
42 | 'connection' => null,
43 | ],
44 |
45 | 'file' => [
46 | 'driver' => 'file',
47 | 'path' => storage_path('framework/cache'),
48 | ],
49 |
50 | 'memcached' => [
51 | 'driver' => 'memcached',
52 | 'servers' => [
53 | [
54 | 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
55 | ],
56 | ],
57 | ],
58 |
59 | 'redis' => [
60 | 'driver' => 'redis',
61 | 'connection' => 'default',
62 | ],
63 |
64 | ],
65 |
66 | /*
67 | |--------------------------------------------------------------------------
68 | | Cache Key Prefix
69 | |--------------------------------------------------------------------------
70 | |
71 | | When utilizing a RAM based store such as APC or Memcached, there might
72 | | be other applications utilizing the same cache. So, we'll specify a
73 | | value to get prefixed to all our keys so we can avoid collisions.
74 | |
75 | */
76 |
77 | 'prefix' => 'laravel',
78 |
79 | ];
80 |
--------------------------------------------------------------------------------
/config/compile.php:
--------------------------------------------------------------------------------
1 | [
17 | //
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled File Providers
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may list service providers which define a "compiles" function
26 | | that returns additional files that should be compiled, providing an
27 | | easy way to get common files from any packages you are utilizing.
28 | |
29 | */
30 |
31 | 'providers' => [
32 | //
33 | ],
34 |
35 | ];
36 |
--------------------------------------------------------------------------------
/config/database.php:
--------------------------------------------------------------------------------
1 | PDO::FETCH_CLASS,
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Default Database Connection Name
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may specify which of the database connections below you wish
24 | | to use as your default connection for all database work. Of course
25 | | you may use many connections at once using the Database library.
26 | |
27 | */
28 |
29 | 'default' => env('DB_CONNECTION', 'mysql'),
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Database Connections
34 | |--------------------------------------------------------------------------
35 | |
36 | | Here are each of the database connections setup for your application.
37 | | Of course, examples of configuring each database platform that is
38 | | supported by Laravel is shown below to make development simple.
39 | |
40 | |
41 | | All database work in Laravel is done through the PHP PDO facilities
42 | | so make sure you have the driver for your particular database of
43 | | choice installed on your machine before you begin development.
44 | |
45 | */
46 |
47 | 'connections' => [
48 |
49 | 'sqlite' => [
50 | 'driver' => 'sqlite',
51 | 'database' => storage_path('database.sqlite'),
52 | 'prefix' => '',
53 | ],
54 |
55 | 'mysql' => [
56 | 'driver' => 'mysql',
57 | 'host' => env('DB_HOST', 'localhost'),
58 | 'database' => env('DB_DATABASE', 'forge'),
59 | 'username' => env('DB_USERNAME', 'forge'),
60 | 'password' => env('DB_PASSWORD', ''),
61 | 'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
62 |
63 | 'charset' => 'utf8',
64 | 'collation' => 'utf8_unicode_ci',
65 | 'prefix' => '',
66 | 'strict' => false,
67 | ],
68 |
69 | 'pgsql' => [
70 | 'driver' => 'pgsql',
71 | 'host' => env('DB_HOST', 'localhost'),
72 | 'database' => env('DB_DATABASE', 'forge'),
73 | 'username' => env('DB_USERNAME', 'forge'),
74 | 'password' => env('DB_PASSWORD', ''),
75 | 'charset' => 'utf8',
76 | 'prefix' => '',
77 | 'schema' => 'public',
78 | ],
79 |
80 | 'sqlsrv' => [
81 | 'driver' => 'sqlsrv',
82 | 'host' => env('DB_HOST', 'localhost'),
83 | 'database' => env('DB_DATABASE', 'forge'),
84 | 'username' => env('DB_USERNAME', 'forge'),
85 | 'password' => env('DB_PASSWORD', ''),
86 | 'charset' => 'utf8',
87 | 'prefix' => '',
88 | ],
89 |
90 | ],
91 |
92 | /*
93 | |--------------------------------------------------------------------------
94 | | Migration Repository Table
95 | |--------------------------------------------------------------------------
96 | |
97 | | This table keeps track of all the migrations that have already run for
98 | | your application. Using this information, we can determine which of
99 | | the migrations on disk haven't actually been run in the database.
100 | |
101 | */
102 |
103 | 'migrations' => 'migrations',
104 |
105 | /*
106 | |--------------------------------------------------------------------------
107 | | Redis Databases
108 | |--------------------------------------------------------------------------
109 | |
110 | | Redis is an open source, fast, and advanced key-value store that also
111 | | provides a richer set of commands than a typical key-value systems
112 | | such as APC or Memcached. Laravel makes it easy to dig right in.
113 | |
114 | */
115 |
116 | 'redis' => [
117 |
118 | 'cluster' => false,
119 |
120 | 'default' => [
121 | 'host' => '127.0.0.1',
122 | 'port' => 6379,
123 | 'database' => 0,
124 | ],
125 |
126 | ],
127 |
128 | ];
129 |
--------------------------------------------------------------------------------
/config/filesystems.php:
--------------------------------------------------------------------------------
1 | 'local',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Default Cloud Filesystem Disk
23 | |--------------------------------------------------------------------------
24 | |
25 | | Many applications store files both locally and in the cloud. For this
26 | | reason, you may specify a default "cloud" driver here. This driver
27 | | will be bound as the Cloud disk implementation in the container.
28 | |
29 | */
30 |
31 | 'cloud' => 's3',
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | Filesystem Disks
36 | |--------------------------------------------------------------------------
37 | |
38 | | Here you may configure as many filesystem "disks" as you wish, and you
39 | | may even configure multiple disks of the same driver. Defaults have
40 | | been setup for each driver as an example of the required options.
41 | |
42 | */
43 |
44 | 'disks' => [
45 |
46 | 'local' => [
47 | 'driver' => 'local',
48 | 'root' => storage_path('app'),
49 | ],
50 |
51 | 'ftp' => [
52 | 'driver' => 'ftp',
53 | 'host' => 'ftp.example.com',
54 | 'username' => 'your-username',
55 | 'password' => 'your-password',
56 |
57 | // Optional FTP Settings...
58 | // 'port' => 21,
59 | // 'root' => '',
60 | // 'passive' => true,
61 | // 'ssl' => true,
62 | // 'timeout' => 30,
63 | ],
64 |
65 | 's3' => [
66 | 'driver' => 's3',
67 | 'key' => 'your-key',
68 | 'secret' => 'your-secret',
69 | 'region' => 'your-region',
70 | 'bucket' => 'your-bucket',
71 | ],
72 |
73 | 'rackspace' => [
74 | 'driver' => 'rackspace',
75 | 'username' => 'your-username',
76 | 'key' => 'your-key',
77 | 'container' => 'your-container',
78 | 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
79 | 'region' => 'IAD',
80 | 'url_type' => 'publicURL',
81 | ],
82 |
83 | ],
84 |
85 | ];
86 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_DRIVER', 'smtp'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | SMTP Host Address
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may provide the host address of the SMTP server used by your
26 | | applications. A default option is provided that is compatible with
27 | | the Mailgun mail service which will provide reliable deliveries.
28 | |
29 | */
30 |
31 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | SMTP Host Port
36 | |--------------------------------------------------------------------------
37 | |
38 | | This is the SMTP port used by your application to deliver e-mails to
39 | | users of the application. Like the host we have set this value to
40 | | stay compatible with the Mailgun e-mail application by default.
41 | |
42 | */
43 |
44 | 'port' => env('MAIL_PORT', 587),
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Global "From" Address
49 | |--------------------------------------------------------------------------
50 | |
51 | | You may wish for all e-mails sent by your application to be sent from
52 | | the same address. Here, you may specify a name and address that is
53 | | used globally for all e-mails that are sent by your application.
54 | |
55 | */
56 |
57 | 'from' => ['address' => null, 'name' => null],
58 |
59 | /*
60 | |--------------------------------------------------------------------------
61 | | E-Mail Encryption Protocol
62 | |--------------------------------------------------------------------------
63 | |
64 | | Here you may specify the encryption protocol that should be used when
65 | | the application send e-mail messages. A sensible default using the
66 | | transport layer security protocol should provide great security.
67 | |
68 | */
69 |
70 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
71 |
72 | /*
73 | |--------------------------------------------------------------------------
74 | | SMTP Server Username
75 | |--------------------------------------------------------------------------
76 | |
77 | | If your SMTP server requires a username for authentication, you should
78 | | set it here. This will get used to authenticate with your server on
79 | | connection. You may also set the "password" value below this one.
80 | |
81 | */
82 |
83 | 'username' => env('MAIL_USERNAME'),
84 |
85 | /*
86 | |--------------------------------------------------------------------------
87 | | SMTP Server Password
88 | |--------------------------------------------------------------------------
89 | |
90 | | Here you may set the password required by your SMTP server to send out
91 | | messages from your application. This will be given to the server on
92 | | connection so that the application will be able to send messages.
93 | |
94 | */
95 |
96 | 'password' => env('MAIL_PASSWORD'),
97 |
98 | /*
99 | |--------------------------------------------------------------------------
100 | | Sendmail System Path
101 | |--------------------------------------------------------------------------
102 | |
103 | | When using the "sendmail" driver to send e-mails, we will need to know
104 | | the path to where Sendmail lives on this server. A default path has
105 | | been provided here, which will work well on most of your systems.
106 | |
107 | */
108 |
109 | 'sendmail' => '/usr/sbin/sendmail -bs',
110 |
111 | /*
112 | |--------------------------------------------------------------------------
113 | | Mail "Pretend"
114 | |--------------------------------------------------------------------------
115 | |
116 | | When this option is enabled, e-mail will not actually be sent over the
117 | | web and will instead be written to your application's logs files so
118 | | you may inspect the message. This is great for local development.
119 | |
120 | */
121 |
122 | 'pretend' => false,
123 |
124 | ];
125 |
--------------------------------------------------------------------------------
/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_DRIVER', 'sync'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Queue Connections
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may configure the connection information for each server that
27 | | is used by your application. A default configuration has been added
28 | | for each back-end shipped with Laravel. You are free to add more.
29 | |
30 | */
31 |
32 | 'connections' => [
33 |
34 | 'sync' => [
35 | 'driver' => 'sync',
36 | ],
37 |
38 | 'database' => [
39 | 'driver' => 'database',
40 | 'table' => 'jobs',
41 | 'queue' => 'default',
42 | 'expire' => 60,
43 | ],
44 |
45 | 'beanstalkd' => [
46 | 'driver' => 'beanstalkd',
47 | 'host' => 'localhost',
48 | 'queue' => 'default',
49 | 'ttr' => 60,
50 | ],
51 |
52 | 'sqs' => [
53 | 'driver' => 'sqs',
54 | 'key' => 'your-public-key',
55 | 'secret' => 'your-secret-key',
56 | 'queue' => 'your-queue-url',
57 | 'region' => 'us-east-1',
58 | ],
59 |
60 | 'iron' => [
61 | 'driver' => 'iron',
62 | 'host' => 'mq-aws-us-east-1.iron.io',
63 | 'token' => 'your-token',
64 | 'project' => 'your-project-id',
65 | 'queue' => 'your-queue-name',
66 | 'encrypt' => true,
67 | ],
68 |
69 | 'redis' => [
70 | 'driver' => 'redis',
71 | 'connection' => 'default',
72 | 'queue' => 'default',
73 | 'expire' => 60,
74 | ],
75 |
76 | ],
77 |
78 | /*
79 | |--------------------------------------------------------------------------
80 | | Failed Queue Jobs
81 | |--------------------------------------------------------------------------
82 | |
83 | | These options configure the behavior of failed queue job logging so you
84 | | can control which database and table are used to store the jobs that
85 | | have failed. You may change them to any database / table you wish.
86 | |
87 | */
88 |
89 | 'failed' => [
90 | 'database' => 'mysql', 'table' => 'failed_jobs',
91 | ],
92 |
93 | ];
94 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | ],
21 |
22 | 'mandrill' => [
23 | 'secret' => env('MANDRILL_SECRET'),
24 | ],
25 |
26 | 'ses' => [
27 | 'key' => env('SES_KEY'),
28 | 'secret' => env('SES_SECRET'),
29 | 'region' => 'us-east-1',
30 | ],
31 |
32 | 'stripe' => [
33 | 'model' => App\User::class,
34 | 'key' => env('STRIPE_KEY'),
35 | 'secret' => env('STRIPE_SECRET'),
36 | ],
37 |
38 | ];
39 |
--------------------------------------------------------------------------------
/config/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Session Lifetime
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may specify the number of minutes that you wish the session
27 | | to be allowed to remain idle before it expires. If you want them
28 | | to immediately expire on the browser closing, set that option.
29 | |
30 | */
31 |
32 | 'lifetime' => 120,
33 |
34 | 'expire_on_close' => false,
35 |
36 | /*
37 | |--------------------------------------------------------------------------
38 | | Session Encryption
39 | |--------------------------------------------------------------------------
40 | |
41 | | This option allows you to easily specify that all of your session data
42 | | should be encrypted before it is stored. All encryption will be run
43 | | automatically by Laravel and you can use the Session like normal.
44 | |
45 | */
46 |
47 | 'encrypt' => false,
48 |
49 | /*
50 | |--------------------------------------------------------------------------
51 | | Session File Location
52 | |--------------------------------------------------------------------------
53 | |
54 | | When using the native session driver, we need a location where session
55 | | files may be stored. A default has been set for you but a different
56 | | location may be specified. This is only needed for file sessions.
57 | |
58 | */
59 |
60 | 'files' => storage_path('framework/sessions'),
61 |
62 | /*
63 | |--------------------------------------------------------------------------
64 | | Session Database Connection
65 | |--------------------------------------------------------------------------
66 | |
67 | | When using the "database" or "redis" session drivers, you may specify a
68 | | connection that should be used to manage these sessions. This should
69 | | correspond to a connection in your database configuration options.
70 | |
71 | */
72 |
73 | 'connection' => null,
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Session Database Table
78 | |--------------------------------------------------------------------------
79 | |
80 | | When using the "database" session driver, you may specify the table we
81 | | should use to manage the sessions. Of course, a sensible default is
82 | | provided for you; however, you are free to change this as needed.
83 | |
84 | */
85 |
86 | 'table' => 'sessions',
87 |
88 | /*
89 | |--------------------------------------------------------------------------
90 | | Session Sweeping Lottery
91 | |--------------------------------------------------------------------------
92 | |
93 | | Some session drivers must manually sweep their storage location to get
94 | | rid of old sessions from storage. Here are the chances that it will
95 | | happen on a given request. By default, the odds are 2 out of 100.
96 | |
97 | */
98 |
99 | 'lottery' => [2, 100],
100 |
101 | /*
102 | |--------------------------------------------------------------------------
103 | | Session Cookie Name
104 | |--------------------------------------------------------------------------
105 | |
106 | | Here you may change the name of the cookie used to identify a session
107 | | instance by ID. The name specified here will get used every time a
108 | | new session cookie is created by the framework for every driver.
109 | |
110 | */
111 |
112 | 'cookie' => 'laravel_session',
113 |
114 | /*
115 | |--------------------------------------------------------------------------
116 | | Session Cookie Path
117 | |--------------------------------------------------------------------------
118 | |
119 | | The session cookie path determines the path for which the cookie will
120 | | be regarded as available. Typically, this will be the root path of
121 | | your application but you are free to change this when necessary.
122 | |
123 | */
124 |
125 | 'path' => '/',
126 |
127 | /*
128 | |--------------------------------------------------------------------------
129 | | Session Cookie Domain
130 | |--------------------------------------------------------------------------
131 | |
132 | | Here you may change the domain of the cookie used to identify a session
133 | | in your application. This will determine which domains the cookie is
134 | | available to in your application. A sensible default has been set.
135 | |
136 | */
137 |
138 | 'domain' => null,
139 |
140 | /*
141 | |--------------------------------------------------------------------------
142 | | HTTPS Only Cookies
143 | |--------------------------------------------------------------------------
144 | |
145 | | By setting this option to true, session cookies will only be sent back
146 | | to the server if the browser has a HTTPS connection. This will keep
147 | | the cookie from being sent to you if it can not be done securely.
148 | |
149 | */
150 |
151 | 'secure' => false,
152 |
153 | ];
154 |
--------------------------------------------------------------------------------
/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | realpath(base_path('resources/views')),
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled View Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | This option determines where all the compiled Blade templates will be
26 | | stored for your application. Typically, this is within the storage
27 | | directory. However, as usual, you are free to change this value.
28 | |
29 | */
30 |
31 | 'compiled' => realpath(storage_path('framework/views')),
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite
2 |
--------------------------------------------------------------------------------
/database/factories/ModelFactory.php:
--------------------------------------------------------------------------------
1 | define(App\User::class, function (Faker\Generator $faker) {
15 | return [
16 | 'name' => $faker->name,
17 | 'email' => $faker->email,
18 | 'password' => bcrypt(str_random(10)),
19 | 'remember_token' => str_random(10),
20 | ];
21 | });
22 |
--------------------------------------------------------------------------------
/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andbet39/laravelShop/c9391b1ad95cbc75b1d391e18f2d59ff97a1a1eb/database/migrations/.gitkeep
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->string('email')->unique();
19 | $table->string('password', 60);
20 | $table->rememberToken();
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::drop('users');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
17 | $table->string('token')->index();
18 | $table->timestamp('created_at');
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::drop('password_resets');
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/database/migrations/2015_09_14_190324_create_table_products.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->string('description');
19 | $table->float('price');
20 | $table->string('imageurl');
21 | $table->string('file_id');
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::drop('products');
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/database/migrations/2015_09_14_190329_create_table_files.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('filename');
19 | $table->string('mime');
20 | $table->string('original_filename');
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::drop('files');
33 | }
34 | }
--------------------------------------------------------------------------------
/database/migrations/2015_09_15_184232_create_table_carts.php:
--------------------------------------------------------------------------------
1 | increments('id');
12 | $table->integer('user_id');
13 | $table->timestamps();
14 | });
15 | }
16 |
17 | public function down()
18 | {
19 | Schema::drop('cart');
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/database/migrations/2015_09_15_184236_create_table_carts_item.php:
--------------------------------------------------------------------------------
1 | increments('id');
12 | $table->integer('cart_id');
13 | $table->integer('product_id');
14 | $table->timestamps();
15 | });
16 | }
17 |
18 | public function down()
19 | {
20 | Schema::drop('cart_items');
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/database/migrations/2015_09_19_191803_create_table_orders.php:
--------------------------------------------------------------------------------
1 | increments('id');
14 | $table->integer('user_id');
15 | $table->float('total_paid');
16 | $table->timestamps();
17 | });
18 | }
19 |
20 | public function down()
21 | {
22 | Schema::drop('orders');
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/database/migrations/2015_09_19_191807_create_table_order_items.php:
--------------------------------------------------------------------------------
1 | increments('id');
14 | $table->integer('order_id');
15 | $table->integer('product_id');
16 | $table->integer('file_id');
17 | $table->timestamps();
18 | });
19 | }
20 |
21 |
22 | public function down()
23 | {
24 | Schema::drop('order_items');
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/database/seeds/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andbet39/laravelShop/c9391b1ad95cbc75b1d391e18f2d59ff97a1a1eb/database/seeds/.gitkeep
--------------------------------------------------------------------------------
/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call(UserTableSeeder::class);
18 |
19 | Model::reguard();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | var elixir = require('laravel-elixir');
2 |
3 | /*
4 | |--------------------------------------------------------------------------
5 | | Elixir Asset Management
6 | |--------------------------------------------------------------------------
7 | |
8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks
9 | | for your Laravel application. By default, we are compiling the Sass
10 | | file for our application, as well as publishing vendor resources.
11 | |
12 | */
13 |
14 | elixir(function(mix) {
15 | mix.sass('app.scss');
16 | });
17 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "devDependencies": {
4 | "gulp": "^3.8.8"
5 | },
6 | "dependencies": {
7 | "laravel-elixir": "^3.0.0",
8 | "bootstrap-sass": "^3.0.0"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/phpspec.yml:
--------------------------------------------------------------------------------
1 | suites:
2 | main:
3 | namespace: App
4 | psr4_prefix: App
5 | src_path: app
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 | ./tests/
15 |
16 |
17 |
18 |
19 | app/
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Redirect Trailing Slashes If Not A Folder...
9 | RewriteCond %{REQUEST_FILENAME} !-d
10 | RewriteRule ^(.*)/$ /$1 [L,R=301]
11 |
12 | # Handle Front Controller...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_FILENAME} !-f
15 | RewriteRule ^ index.php [L]
16 |
17 |
--------------------------------------------------------------------------------
/public/css/style.css:
--------------------------------------------------------------------------------
1 | body{
2 | padding-top: 70px;
3 | }
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andbet39/laravelShop/c9391b1ad95cbc75b1d391e18f2d59ff97a1a1eb/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | /*
11 | |--------------------------------------------------------------------------
12 | | Register The Auto Loader
13 | |--------------------------------------------------------------------------
14 | |
15 | | Composer provides a convenient, automatically generated class loader for
16 | | our application. We just need to utilize it! We'll simply require it
17 | | into the script here so that we don't have to worry about manual
18 | | loading any of our classes later on. It feels nice to relax.
19 | |
20 | */
21 |
22 | require __DIR__.'/../bootstrap/autoload.php';
23 |
24 | /*
25 | |--------------------------------------------------------------------------
26 | | Turn On The Lights
27 | |--------------------------------------------------------------------------
28 | |
29 | | We need to illuminate PHP development, so let us turn on the lights.
30 | | This bootstraps the framework and gets it ready for use, then it
31 | | will load up this application so that we can run it and send
32 | | the responses back to the browser and delight our users.
33 | |
34 | */
35 |
36 | $app = require_once __DIR__.'/../bootstrap/app.php';
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Run The Application
41 | |--------------------------------------------------------------------------
42 | |
43 | | Once we have the application, we can handle the incoming request
44 | | through the kernel, and send the associated response back to
45 | | the client's browser allowing them to enjoy the creative
46 | | and wonderful application we have prepared for them.
47 | |
48 | */
49 |
50 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
51 |
52 | $response = $kernel->handle(
53 | $request = Illuminate\Http\Request::capture()
54 | );
55 |
56 | $response->send();
57 |
58 | $kernel->terminate($request, $response);
59 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ## How to build a digital goods eshops with Laravel 5.1
2 | A tutorial series from [CODETutorial.io](http://codetutorial.io) .
3 |
4 | In this tutorial series we are going to build a simple but complete digital goods e-shop using Laravel 5.1. The shop will sell only digital articles in a zipped file format, downloadable by the customer once the order and the payment is done. It will be something like ThemeForest or other site where you can buy files.
5 |
6 | ## Tutorial articles
7 | * [Part 1 - Setup Laravel application and product catalog](http://www.codetutorial.io/how-to-craft-a-digital-e-shop-with-laravel/)
8 | * [Part 2 - Create the shopping cart and customer managment](http://www.codetutorial.io/the-shopping-cart-how-to-craft-an-e-shop-with-laravel/)
9 | * [Part 3 - Complete the order. Payment with Stripe and Cashier ](http://www.codetutorial.io/make-order-laravel-e-shop-part-3/)
10 |
11 |
--------------------------------------------------------------------------------
/resources/assets/sass/app.scss:
--------------------------------------------------------------------------------
1 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
2 |
3 |
--------------------------------------------------------------------------------
/resources/lang/en/auth.php:
--------------------------------------------------------------------------------
1 | 'These credentials do not match our records.',
17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/resources/lang/en/pagination.php:
--------------------------------------------------------------------------------
1 | '« Previous',
17 | 'next' => 'Next »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/resources/lang/en/passwords.php:
--------------------------------------------------------------------------------
1 | 'Passwords must be at least six characters and match the confirmation.',
17 | 'reset' => 'Your password has been reset!',
18 | 'sent' => 'We have e-mailed your password reset link!',
19 | 'token' => 'This password reset token is invalid.',
20 | 'user' => "We can't find a user with that e-mail address.",
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/resources/lang/en/validation.php:
--------------------------------------------------------------------------------
1 | 'The :attribute must be accepted.',
17 | 'active_url' => 'The :attribute is not a valid URL.',
18 | 'after' => 'The :attribute must be a date after :date.',
19 | 'alpha' => 'The :attribute may only contain letters.',
20 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
21 | 'alpha_num' => 'The :attribute may only contain letters and numbers.',
22 | 'array' => 'The :attribute must be an array.',
23 | 'before' => 'The :attribute must be a date before :date.',
24 | 'between' => [
25 | 'numeric' => 'The :attribute must be between :min and :max.',
26 | 'file' => 'The :attribute must be between :min and :max kilobytes.',
27 | 'string' => 'The :attribute must be between :min and :max characters.',
28 | 'array' => 'The :attribute must have between :min and :max items.',
29 | ],
30 | 'boolean' => 'The :attribute field must be true or false.',
31 | 'confirmed' => 'The :attribute confirmation does not match.',
32 | 'date' => 'The :attribute is not a valid date.',
33 | 'date_format' => 'The :attribute does not match the format :format.',
34 | 'different' => 'The :attribute and :other must be different.',
35 | 'digits' => 'The :attribute must be :digits digits.',
36 | 'digits_between' => 'The :attribute must be between :min and :max digits.',
37 | 'email' => 'The :attribute must be a valid email address.',
38 | 'exists' => 'The selected :attribute is invalid.',
39 | 'filled' => 'The :attribute field is required.',
40 | 'image' => 'The :attribute must be an image.',
41 | 'in' => 'The selected :attribute is invalid.',
42 | 'integer' => 'The :attribute must be an integer.',
43 | 'ip' => 'The :attribute must be a valid IP address.',
44 | 'json' => 'The :attribute must be a valid JSON string.',
45 | 'max' => [
46 | 'numeric' => 'The :attribute may not be greater than :max.',
47 | 'file' => 'The :attribute may not be greater than :max kilobytes.',
48 | 'string' => 'The :attribute may not be greater than :max characters.',
49 | 'array' => 'The :attribute may not have more than :max items.',
50 | ],
51 | 'mimes' => 'The :attribute must be a file of type: :values.',
52 | 'min' => [
53 | 'numeric' => 'The :attribute must be at least :min.',
54 | 'file' => 'The :attribute must be at least :min kilobytes.',
55 | 'string' => 'The :attribute must be at least :min characters.',
56 | 'array' => 'The :attribute must have at least :min items.',
57 | ],
58 | 'not_in' => 'The selected :attribute is invalid.',
59 | 'numeric' => 'The :attribute must be a number.',
60 | 'regex' => 'The :attribute format is invalid.',
61 | 'required' => 'The :attribute field is required.',
62 | 'required_if' => 'The :attribute field is required when :other is :value.',
63 | 'required_with' => 'The :attribute field is required when :values is present.',
64 | 'required_with_all' => 'The :attribute field is required when :values is present.',
65 | 'required_without' => 'The :attribute field is required when :values is not present.',
66 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
67 | 'same' => 'The :attribute and :other must match.',
68 | 'size' => [
69 | 'numeric' => 'The :attribute must be :size.',
70 | 'file' => 'The :attribute must be :size kilobytes.',
71 | 'string' => 'The :attribute must be :size characters.',
72 | 'array' => 'The :attribute must contain :size items.',
73 | ],
74 | 'string' => 'The :attribute must be a string.',
75 | 'timezone' => 'The :attribute must be a valid zone.',
76 | 'unique' => 'The :attribute has already been taken.',
77 | 'url' => 'The :attribute format is invalid.',
78 |
79 | /*
80 | |--------------------------------------------------------------------------
81 | | Custom Validation Language Lines
82 | |--------------------------------------------------------------------------
83 | |
84 | | Here you may specify custom validation messages for attributes using the
85 | | convention "attribute.rule" to name the lines. This makes it quick to
86 | | specify a specific custom language line for a given attribute rule.
87 | |
88 | */
89 |
90 | 'custom' => [
91 | 'attribute-name' => [
92 | 'rule-name' => 'custom-message',
93 | ],
94 | ],
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Custom Validation Attributes
99 | |--------------------------------------------------------------------------
100 | |
101 | | The following language lines are used to swap attribute place-holders
102 | | with something more reader friendly such as E-Mail Address instead
103 | | of "email". This simply helps us make messages a little cleaner.
104 | |
105 | */
106 |
107 | 'attributes' => [],
108 |
109 | ];
110 |
--------------------------------------------------------------------------------
/resources/views/admin/new.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | @extends('layouts.master')
4 |
5 | @section('New Product', 'Page Title')
6 |
7 | @section('sidebar')
8 | @parent
9 | @endsection
10 |
11 | @section('content')
12 |
66 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/products.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.master')
2 |
3 | @section('Admin shop', 'Page Title')
4 |
5 | @section('sidebar')
6 | @parent
7 | @endsection
8 |
9 | @section('content')
10 |
11 |
12 |
17 |
18 |
19 |
20 |
21 | Name |
22 | Price |
23 | File |
24 | |
25 |
26 |
27 | @foreach ($products as $product)
28 |
29 | {{$product->name}} |
30 | {{$product->price}}$ |
31 | {{$product->file->original_filename}} |
32 | |
33 |
34 | @endforeach
35 |
36 |
37 |
38 |
39 |
40 |
41 | @endsection
--------------------------------------------------------------------------------
/resources/views/auth/login.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.master')
2 |
3 | @section('Digital shop', 'Page Title')
4 |
5 | @section('sidebar')
6 | @parent
7 | @endsection
8 |
9 | @section('content')
10 |
11 |
12 |
13 |
16 |
17 |
18 |
52 |
53 |
54 |
55 |
56 | @endsection
--------------------------------------------------------------------------------
/resources/views/auth/register.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.master')
2 |
3 | @section('Digital shop', 'Page Title')
4 |
5 | @section('sidebar')
6 | @parent
7 | @endsection
8 |
9 | @section('content')
10 |
11 |
12 |
13 |
17 |
18 |
51 |
52 |
53 |
54 |
55 | @endsection
--------------------------------------------------------------------------------
/resources/views/cart/view.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.master')
2 |
3 | @section('Digital shop', 'Page Title')
4 |
5 | @section('sidebar')
6 | @parent
7 | @endsection
8 |
9 | @section('content')
10 |
11 |
12 |
13 |
14 |
15 |
16 | Product |
17 | |
18 | |
19 | Total |
20 | |
21 |
22 |
23 |
24 | @foreach($items as $item)
25 |
26 |
27 | |
33 |
34 | |
35 | |
36 | ${{$item->product->price}} |
37 |
38 |
41 |
42 | |
43 |
44 | @endforeach
45 |
46 |
47 | |
48 | |
49 | |
50 | Total |
51 | ${{$total}} |
52 |
53 |
54 | |
55 | |
56 | |
57 |
58 |
61 | |
62 |
63 |
75 | |
76 |
77 |
78 |
79 |
80 |
81 |
82 | @endsection
--------------------------------------------------------------------------------
/resources/views/errors/503.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Be right back.
5 |
6 |
7 |
8 |
39 |
40 |
41 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/resources/views/layouts/master.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | Laravel eshop
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | @section('sidebar')
13 |
38 | @show
39 |
40 |
41 | @yield('content')
42 |
43 |
44 |
--------------------------------------------------------------------------------
/resources/views/main/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.master')
2 |
3 | @section('Digital shop', 'Page Title')
4 |
5 | @section('sidebar')
6 | @parent
7 | @endsection
8 |
9 | @section('content')
10 |
11 |
12 |
13 | @foreach ($products as $product)
14 |
15 |
16 |
17 |

18 |
19 |
20 |
21 |
{{$product->name}}
22 |
23 |
24 |
25 |
26 |
27 |
28 |
{{$product->description}}
29 |
33 |
34 |
35 |
36 | @endforeach
37 |
38 |
39 |
40 |
41 | @endsection
--------------------------------------------------------------------------------
/resources/views/order/list.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.master')
2 |
3 | @section('Digital shop', 'Page Title')
4 |
5 | @section('sidebar')
6 | @parent
7 | @endsection
8 |
9 | @section('content')
10 |
11 |
12 |
13 |
Your past orders
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Id |
22 | Date |
23 | |
24 |
25 |
26 | @foreach($orders as $order)
27 |
28 | {{$order->id}} |
29 | {{$order->created_at}} |
30 | |
31 |
32 | @endforeach
33 |
34 |
35 |
36 |
37 | @endsection
--------------------------------------------------------------------------------
/resources/views/order/view.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.master')
2 |
3 | @section('Digital shop', 'Page Title')
4 |
5 | @section('sidebar')
6 | @parent
7 | @endsection
8 |
9 | @section('content')
10 |
11 |
12 |
Order num : {{$order->id}}
13 | Made on : {{$order->created_at}}
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | Name |
22 | File |
23 | Price |
24 |
25 |
26 | @foreach($order->orderItems as $item)
27 |
28 | {{$item->product->name}} |
29 | {{$item->file->filename}} |
30 | $ {{number_format($item->product->price,2,',','')}} |
31 |
32 | @endforeach
33 |
34 |
35 |
36 | @endsection
--------------------------------------------------------------------------------
/resources/views/vendor/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andbet39/laravelShop/c9391b1ad95cbc75b1d391e18f2d59ff97a1a1eb/resources/views/vendor/.gitkeep
--------------------------------------------------------------------------------
/resources/views/welcome.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Laravel
5 |
6 |
7 |
8 |
37 |
38 |
39 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/server.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | $uri = urldecode(
11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
12 | );
13 |
14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the
15 | // built-in PHP web server. This provides a convenient way to test a Laravel
16 | // application without having installed a "real" web server software here.
17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
18 | return false;
19 | }
20 |
21 | require_once __DIR__.'/public/index.php';
22 |
--------------------------------------------------------------------------------
/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
--------------------------------------------------------------------------------
/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | config.php
2 | routes.php
3 | compiled.php
4 | services.json
5 | events.scanned.php
6 | routes.scanned.php
7 | down
8 |
--------------------------------------------------------------------------------
/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
--------------------------------------------------------------------------------
/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/tests/ExampleTest.php:
--------------------------------------------------------------------------------
1 | visit('/')
17 | ->see('Laravel 5');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tests/TestCase.php:
--------------------------------------------------------------------------------
1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
22 |
23 | return $app;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------