├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── .styleci.yml ├── app ├── Category.php ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── Admin │ │ │ ├── CategoryController.php │ │ │ ├── NotificationController.php │ │ │ ├── OrdersController.php │ │ │ ├── ProductController.php │ │ │ ├── ProductPhotoController.php │ │ │ └── StoreController.php │ │ ├── Auth │ │ │ ├── ForgotPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── RegisterController.php │ │ │ ├── ResetPasswordController.php │ │ │ └── VerificationController.php │ │ ├── CartController.php │ │ ├── CategoryController.php │ │ ├── CheckoutController.php │ │ ├── Controller.php │ │ ├── HomeController.php │ │ ├── StoreController.php │ │ └── UserOrderController.php │ ├── Kernel.php │ ├── Middleware │ │ ├── AccessControlStoreAdmin.php │ │ ├── Authenticate.php │ │ ├── CheckForMaintenanceMode.php │ │ ├── EncryptCookies.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustProxies.php │ │ ├── UserHasStoreMiddleware.php │ │ └── VerifyCsrfToken.php │ ├── Requests │ │ ├── CategoryRequest.php │ │ ├── ProductRequest.php │ │ └── StoreRequest.php │ └── Views │ │ └── CategoryViewComposer.php ├── Mail │ └── UserRegisteredEmail.php ├── Notifications │ └── StoreReceiveNewOrder.php ├── Payment │ └── PagSeguro │ │ ├── CreditCard.php │ │ └── Notification.php ├── Product.php ├── ProductPhoto.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── ComposerServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Store.php ├── Traits │ ├── Slug.php │ └── UploadTrait.php ├── User.php └── UserOrder.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── database.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── queue.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ ├── CategoryFactory.php │ ├── ProductFactory.php │ ├── StoreFactory.php │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2019_10_18_212717_create_table_store.php │ ├── 2019_10_18_214944_create_products_table.php │ ├── 2019_10_27_173536_create_categories_table.php │ ├── 2019_10_27_173744_create_category_product_table.php │ ├── 2019_12_04_201729_create_product_photos_table.php │ ├── 2019_12_04_202057_alter_table_stores_add_column_logo.php │ ├── 2019_12_28_140645_create_user_order_table.php │ ├── 2020_02_07_183221_create_order_store_table.php │ ├── 2020_02_09_153417_create_notifications_table.php │ └── 2020_02_22_165158_alter_users_table.php └── seeds │ ├── DatabaseSeeder.php │ ├── StoreTableSeeder.php │ └── UsersTableSeeder.php ├── helpers └── functions.php ├── package-lock.json ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── assets │ ├── img │ │ └── no-photo.jpg │ └── js │ │ └── jquery.ajax.js ├── css │ └── app.css ├── favicon.ico ├── index.php ├── js │ ├── app.js │ ├── pagseguro_events.js │ └── pagseguro_functions.js ├── mix-manifest.json └── robots.txt ├── resources ├── js │ ├── app.js │ ├── bootstrap.js │ ├── pagseguro_events.js │ └── pagseguro_functions.js ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php ├── sass │ ├── _variables.scss │ └── app.scss └── views │ ├── admin │ ├── categories │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── notifications.blade.php │ ├── orders │ │ └── index.blade.php │ ├── products │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ └── index.blade.php │ └── stores │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ └── index.blade.php │ ├── auth │ ├── login.blade.php │ ├── passwords │ │ ├── confirm.blade.php │ │ ├── email.blade.php │ │ └── reset.blade.php │ ├── register.blade.php │ └── verify.blade.php │ ├── cart.blade.php │ ├── category.blade.php │ ├── checkout.blade.php │ ├── emails │ └── user-registered.blade.php │ ├── layouts │ ├── app.blade.php │ └── front.blade.php │ ├── single.blade.php │ ├── store.blade.php │ ├── thanks.blade.php │ ├── user-orders.blade.php │ └── welcome.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── server.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tests ├── CreatesApplication.php ├── Feature │ └── ExampleTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── webpack.mix.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | 9 | DB_CONNECTION=mysql 10 | DB_HOST=127.0.0.1 11 | DB_PORT=3306 12 | DB_DATABASE=laravel 13 | DB_USERNAME=root 14 | DB_PASSWORD= 15 | 16 | BROADCAST_DRIVER=log 17 | CACHE_DRIVER=file 18 | QUEUE_CONNECTION=sync 19 | SESSION_DRIVER=file 20 | SESSION_LIFETIME=120 21 | 22 | REDIS_HOST=127.0.0.1 23 | REDIS_PASSWORD=null 24 | REDIS_PORT=6379 25 | 26 | MAIL_DRIVER=smtp 27 | MAIL_HOST=smtp.mailtrap.io 28 | MAIL_PORT=2525 29 | MAIL_USERNAME=null 30 | MAIL_PASSWORD=null 31 | MAIL_ENCRYPTION=null 32 | 33 | AWS_ACCESS_KEY_ID= 34 | AWS_SECRET_ACCESS_KEY= 35 | AWS_DEFAULT_REGION=us-east-1 36 | AWS_BUCKET= 37 | 38 | PUSHER_APP_ID= 39 | PUSHER_APP_KEY= 40 | PUSHER_APP_SECRET= 41 | PUSHER_APP_CLUSTER=mt1 42 | 43 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 44 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 45 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /storage/*.key 5 | /vendor 6 | .env 7 | .env.backup 8 | .phpunit.result.cache 9 | Homestead.json 10 | Homestead.yaml 11 | npm-debug.log 12 | yarn-error.log 13 | .idea/ 14 | .DS_Store 15 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | php: 2 | preset: laravel 3 | enabled: 4 | - alpha_ordered_imports 5 | disabled: 6 | - length_ordered_imports 7 | - unused_use 8 | finder: 9 | not-name: 10 | - index.php 11 | - server.php 12 | js: 13 | finder: 14 | not-name: 15 | - webpack.mix.js 16 | css: true 17 | -------------------------------------------------------------------------------- /app/Category.php: -------------------------------------------------------------------------------- 1 | belongsToMany(Product::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | 31 | /** 32 | * Register the commands for the application. 33 | * 34 | * @return void 35 | */ 36 | protected function commands() 37 | { 38 | $this->load(__DIR__.'/Commands'); 39 | 40 | require base_path('routes/console.php'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | category = $category; 19 | } 20 | 21 | /** 22 | * Display a listing of the resource. 23 | * 24 | * @return \Illuminate\Http\Response 25 | */ 26 | public function index() 27 | { 28 | $categories = $this->category->paginate(10); 29 | 30 | return view('admin.categories.index', compact('categories')); 31 | } 32 | 33 | /** 34 | * Show the form for creating a new resource. 35 | * 36 | * @return \Illuminate\Http\Response 37 | */ 38 | public function create() 39 | { 40 | return view('admin.categories.create'); 41 | } 42 | 43 | /** 44 | * Store a newly created resource in storage. 45 | * 46 | * @param CategoryRequest $request 47 | * 48 | * @return \Illuminate\Http\Response 49 | */ 50 | public function store(CategoryRequest $request) 51 | { 52 | $data = $request->all(); 53 | 54 | $category = $this->category->create($data); 55 | 56 | flash('Categoria Criado com Sucesso!')->success(); 57 | return redirect()->route('admin.categories.index'); 58 | } 59 | 60 | /** 61 | * Display the specified resource. 62 | * 63 | * @param int $id 64 | * @return \Illuminate\Http\Response 65 | */ 66 | public function show($id) 67 | { 68 | // 69 | } 70 | 71 | /** 72 | * Show the form for editing the specified resource. 73 | * 74 | * @param int $category 75 | * @return \Illuminate\Http\Response 76 | */ 77 | public function edit($category) 78 | { 79 | $category = $this->category->findOrFail($category); 80 | 81 | return view('admin.categories.edit', compact('category')); 82 | } 83 | 84 | /** 85 | * Update the specified resource in storage. 86 | * 87 | * @param CategoryRequest $request 88 | * @param int $category 89 | * 90 | * @return \Illuminate\Http\Response 91 | */ 92 | public function update(CategoryRequest $request, $category) 93 | { 94 | $data = $request->all(); 95 | 96 | $category = $this->category->find($category); 97 | $category->update($data); 98 | 99 | flash('Categoria Atualizada com Sucesso!')->success(); 100 | return redirect()->route('admin.categories.index'); 101 | } 102 | 103 | /** 104 | * Remove the specified resource from storage. 105 | * 106 | * @param int $category 107 | * @return \Illuminate\Http\Response 108 | */ 109 | public function destroy($category) 110 | { 111 | $category = $this->category->find($category); 112 | $category->delete(); 113 | 114 | flash('Categoria Removida com Sucesso!')->success(); 115 | return redirect()->route('admin.categories.index'); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /app/Http/Controllers/Admin/NotificationController.php: -------------------------------------------------------------------------------- 1 | user()->unreadNotifications; 13 | 14 | return view('admin.notifications', compact('unreadNotifications')); 15 | } 16 | 17 | public function readAll() 18 | { 19 | $unreadNotifications = auth()->user()->unreadNotifications; 20 | 21 | $unreadNotifications->each(function($notification){ 22 | $notification->markAsRead(); 23 | }); 24 | 25 | flash('Notificações lidas com sucesso!')->success(); 26 | return redirect()->back(); 27 | } 28 | 29 | public function read($notification) 30 | { 31 | $notification = auth()->user()->notifications()->find($notification); 32 | $notification->markAsRead(); 33 | 34 | flash('Notificação lida com sucesso!')->success(); 35 | return redirect()->back(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Http/Controllers/Admin/OrdersController.php: -------------------------------------------------------------------------------- 1 | order = $order; 16 | } 17 | 18 | public function index() 19 | { 20 | $orders = auth()->user()->store->orders()->paginate(15); 21 | 22 | return view('admin.orders.index', compact('orders')); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Http/Controllers/Admin/ProductController.php: -------------------------------------------------------------------------------- 1 | product = $product; 20 | } 21 | 22 | /** 23 | * Display a listing of the resource. 24 | * 25 | * @return \Illuminate\Http\Response 26 | */ 27 | public function index() 28 | { 29 | $user = auth()->user(); 30 | 31 | if(!$user->store()->exists()) { 32 | flash('É preciso criar uma loja para cadastrar produtos!')->warning(); 33 | return redirect()->route('admin.stores.index'); 34 | } 35 | 36 | $products = $user->store->products()->paginate(10); 37 | 38 | return view('admin.products.index', compact('products')); 39 | } 40 | 41 | /** 42 | * Show the form for creating a new resource. 43 | * 44 | * @return \Illuminate\Http\Response 45 | */ 46 | public function create() 47 | { 48 | $categories = \App\Category::all(['id', 'name']); 49 | 50 | return view('admin.products.create', compact('categories')); 51 | } 52 | 53 | /** 54 | * Store a newly created resource in storage. 55 | * 56 | * @param \Illuminate\Http\Request $request 57 | * @return \Illuminate\Http\Response 58 | */ 59 | public function store(ProductRequest $request) 60 | { 61 | $data = $request->all(); 62 | $categories = $request->get('categories', null); 63 | 64 | $data['price'] = formatPriceToDatabase($data['price']); 65 | 66 | $store = auth()->user()->store; 67 | $product = $store->products()->create($data); 68 | 69 | $product->categories()->sync($categories); 70 | 71 | if($request->hasFile('photos')) { 72 | $images = $this->imageUpload($request->file('photos'), 'image'); 73 | 74 | $product->photos()->createMany($images); 75 | } 76 | 77 | flash('Produto Criado com Sucesso!')->success(); 78 | return redirect()->route('admin.products.index'); 79 | } 80 | 81 | /** 82 | * Display the specified resource. 83 | * 84 | * @param int $id 85 | * @return \Illuminate\Http\Response 86 | */ 87 | public function show($id) 88 | { 89 | } 90 | 91 | /** 92 | * Show the form for editing the specified resource. 93 | * 94 | * @param int $product 95 | * @return \Illuminate\Http\Response 96 | */ 97 | public function edit($product) 98 | { 99 | $product = $this->product->findOrFail($product); 100 | $categories = \App\Category::all(['id', 'name']); 101 | 102 | return view('admin.products.edit', compact('product', 'categories')); 103 | } 104 | 105 | /** 106 | * Update the specified resource in storage. 107 | * 108 | * @param \Illuminate\Http\Request $request 109 | * @param int $product 110 | * @return \Illuminate\Http\Response 111 | */ 112 | public function update(ProductRequest $request, $product) 113 | { 114 | $data = $request->all(); 115 | $categories = $request->get('categories', null); 116 | 117 | $product = $this->product->find($product); 118 | $product->update($data); 119 | 120 | if(!is_null($categories)) 121 | $product->categories()->sync($categories); 122 | 123 | if($request->hasFile('photos')) { 124 | $images = $this->imageUpload($request->file('photos'), 'image'); 125 | 126 | $product->photos()->createMany($images); 127 | } 128 | 129 | flash('Produto Atualizado com Sucesso!')->success(); 130 | return redirect()->route('admin.products.index'); 131 | } 132 | 133 | /** 134 | * Remove the specified resource from storage. 135 | * 136 | * @param int $product 137 | * @return \Illuminate\Http\Response 138 | */ 139 | public function destroy($product) 140 | { 141 | $product = $this->product->find($product); 142 | $product->delete(); 143 | 144 | flash('Produto Removido com Sucesso!')->success(); 145 | return redirect()->route('admin.products.index'); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /app/Http/Controllers/Admin/ProductPhotoController.php: -------------------------------------------------------------------------------- 1 | get('photoName'); 15 | 16 | //Removo dos arquivos 17 | if(Storage::disk('public')->exists($photoName)) { 18 | Storage::disk('public')->delete($photoName); 19 | } 20 | 21 | //Removo a imagem do banco 22 | $removePhoto = ProductPhoto::where('image', $photoName); 23 | 24 | $productId = $removePhoto->first()->product_id; 25 | 26 | $removePhoto->delete(); 27 | 28 | flash('Imagem removida com sucesso!')->success(); 29 | return redirect()->route('admin.products.edit', ['product' => $productId]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Http/Controllers/Admin/StoreController.php: -------------------------------------------------------------------------------- 1 | middleware('user.has.store')->only(['create', 'store']); 18 | } 19 | 20 | public function index() 21 | { 22 | $store = auth()->user()->store; 23 | 24 | return view('admin.stores.index', compact('store')); 25 | } 26 | 27 | public function create() 28 | { 29 | $users = \App\User::all(['id', 'name']); 30 | 31 | return view('admin.stores.create', compact('users')); 32 | } 33 | 34 | public function store(StoreRequest $request) 35 | { 36 | $data = $request->all(); 37 | $user = auth()->user(); 38 | 39 | if($request->hasFile('logo')) { 40 | $data['logo'] = $this->imageUpload($request->file('logo')); 41 | } 42 | 43 | $store = $user->store()->create($data); 44 | 45 | flash('Loja Criada com Sucesso')->success(); 46 | return redirect()->route('admin.stores.index'); 47 | } 48 | 49 | public function edit($store) 50 | { 51 | $store = \App\Store::find($store); 52 | 53 | return view('admin.stores.edit', compact('store')); 54 | } 55 | 56 | public function update(StoreRequest $request, $store) 57 | { 58 | $data = $request->all(); 59 | $store = \App\Store::find($store); 60 | 61 | if($request->hasFile('logo')) { 62 | if(Storage::disk('public')->exists($store->logo)) { 63 | Storage::disk('public')->delete($store->logo); 64 | } 65 | 66 | $data['logo'] = $this->imageUpload($request->file('logo')); 67 | } 68 | 69 | $store->update($data); 70 | 71 | flash('Loja Atualizada com Sucesso')->success(); 72 | return redirect()->route('admin.stores.index'); 73 | } 74 | 75 | public function destroy($store) 76 | { 77 | $store = \App\Store::find($store); 78 | $store->delete(); 79 | 80 | flash('Loja Removida com Sucesso')->success(); 81 | return redirect()->route('admin.stores.index'); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest')->except('logout'); 39 | } 40 | 41 | protected function authenticated(Request $request, $user) 42 | { 43 | if($user->role == 'ROLE_OWNER') 44 | return redirect()->route('admin.stores.index'); 45 | 46 | if($user->role == 'ROLE_USER' && session()->has('cart')) { 47 | return redirect()->route('checkout.index'); 48 | } else { 49 | return redirect()->route('home'); 50 | } 51 | 52 | return null; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 44 | } 45 | 46 | /** 47 | * Get a validator for an incoming registration request. 48 | * 49 | * @param array $data 50 | * @return \Illuminate\Contracts\Validation\Validator 51 | */ 52 | protected function validator(array $data) 53 | { 54 | return Validator::make($data, [ 55 | 'name' => ['required', 'string', 'max:255'], 56 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 57 | 'password' => ['required', 'string', 'min:8', 'confirmed'], 58 | ]); 59 | } 60 | 61 | /** 62 | * Create a new user instance after a valid registration. 63 | * 64 | * @param array $data 65 | * @return \App\User 66 | */ 67 | protected function create(array $data) 68 | { 69 | return User::create([ 70 | 'name' => $data['name'], 71 | 'email' => $data['email'], 72 | 'password' => Hash::make($data['password']), 73 | 'role' => 'ROLE_USER' 74 | ]); 75 | } 76 | 77 | protected function registered(Request $request, $user) 78 | { 79 | Mail::to($user->email)->send(new UserRegisteredEmail($user)); 80 | 81 | if($user->role == 'ROLE_OWNER') 82 | return redirect()->route('admin.stores.index'); 83 | 84 | if($user->role == 'ROLE_USER' && session()->has('cart')) { 85 | return redirect()->route('checkout.index'); 86 | } else { 87 | return redirect()->route('home'); 88 | } 89 | 90 | return null; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/VerificationController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 38 | $this->middleware('signed')->only('verify'); 39 | $this->middleware('throttle:6,1')->only('verify', 'resend'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Http/Controllers/CartController.php: -------------------------------------------------------------------------------- 1 | has('cart') ? session()->get('cart') : []; 12 | return view('cart', compact('cart')); 13 | } 14 | 15 | public function add(Request $request) 16 | { 17 | $productData = $request->get('product'); 18 | 19 | $product = \App\Product::whereSlug($productData['slug']); 20 | 21 | if(!$product->count() || $productData['amount'] <= 0) 22 | return redirect()->route('home'); 23 | 24 | $product = array_merge($productData, 25 | $product->first(['id', 'name', 'price', 'store_id'])->toArray()); 26 | 27 | if(session()->has('cart')) { 28 | 29 | $products = session()->get('cart'); 30 | $productsSlugs = array_column($products, 'slug'); 31 | 32 | if(in_array($product['slug'], $productsSlugs)) { 33 | 34 | $products = $this->productIncrement($product['slug'], $product['amount'], $products); 35 | 36 | session()->put('cart', $products); 37 | 38 | } else { 39 | 40 | session()->push('cart', $product); 41 | 42 | } 43 | 44 | } else { 45 | $products[] = $product; 46 | 47 | session()->put('cart', $products); 48 | } 49 | 50 | flash('Produto Adicionado no carrinho!')->success(); 51 | return redirect()->route('product.single', ['slug' => $product['slug']]); 52 | } 53 | 54 | public function remove($slug) 55 | { 56 | if(!session()->has('cart')) 57 | return redirect()->route('cart.index'); 58 | 59 | $products = session()->get('cart'); 60 | 61 | $products = array_filter($products, function($line) use($slug){ 62 | return $line['slug'] != $slug; 63 | }); 64 | 65 | session()->put('cart', $products); 66 | return redirect()->route('cart.index'); 67 | } 68 | 69 | public function cancel() 70 | { 71 | session()->forget('cart'); 72 | 73 | flash('Desistência da compra realizada com sucesso!')->success(); 74 | return redirect()->route('cart.index'); 75 | } 76 | 77 | private function productIncrement($slug, $amount, $products) 78 | { 79 | $products = array_map(function($line) use($slug, $amount){ 80 | if($slug == $line['slug']) { 81 | $line['amount'] += $amount; 82 | } 83 | return $line; 84 | }, $products); 85 | 86 | return $products; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/Http/Controllers/CategoryController.php: -------------------------------------------------------------------------------- 1 | category = $category; 15 | } 16 | 17 | public function index($slug) 18 | { 19 | $category = $this->category->whereSlug($slug)->first(); 20 | 21 | return view('category', compact('category')); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Http/Controllers/CheckoutController.php: -------------------------------------------------------------------------------- 1 | check()) { 18 | return redirect()->route('login'); 19 | } 20 | 21 | if(!session()->has('cart')) return redirect()->route('home'); 22 | 23 | $this->makePagSeguroSession(); 24 | 25 | $cartItems = array_map(function($line){ 26 | return $line['amount'] * $line['price']; 27 | }, session()->get('cart')); 28 | 29 | $cartItems = array_sum($cartItems); 30 | 31 | return view('checkout', compact('cartItems')); 32 | 33 | } catch (\Exception $e) { 34 | session()->forget('pagseguro_session_code'); 35 | redirect()->route('checkout.index'); 36 | } 37 | } 38 | 39 | public function proccess(Request $request) 40 | { 41 | try { 42 | $dataPost = $request->all(); 43 | $user = auth()->user(); 44 | $cartItems = session()->get('cart'); 45 | $stores = array_unique(array_column($cartItems, 'store_id')); 46 | $reference = Uuid::uuid4(); 47 | 48 | $creditCardPayment = new CreditCard($cartItems, $user, $dataPost, $reference); 49 | $result = $creditCardPayment->doPayment(); 50 | 51 | $userOrder = [ 52 | 'reference' => $reference, 53 | 'pagseguro_code' => $result->getCode(), 54 | 'pagseguro_status' => $result->getStatus(), 55 | 'items' => serialize($cartItems) 56 | ]; 57 | 58 | $userOrder = $user->orders()->create($userOrder); 59 | 60 | $userOrder->stores()->sync($stores); 61 | 62 | //Notificar loja de novo pedido 63 | $store = (new Store())->notifyStoreOwners($stores); 64 | 65 | session()->forget('cart'); 66 | session()->forget('pagseguro_session_code'); 67 | 68 | return response()->json([ 69 | 'data' => [ 70 | 'status' => true, 71 | 'message' => 'Pedido criado com sucesso!', 72 | 'order' => $reference 73 | ] 74 | ]); 75 | 76 | } catch (\Exception $e) { 77 | $message = env('APP_DEBUG') ? simplexml_load_string($e->getMessage()) : 'Erro ao processar pedido!'; 78 | 79 | return response()->json([ 80 | 'data' => [ 81 | 'status' => false, 82 | 'message' => $message 83 | ] 84 | ], 401); 85 | } 86 | } 87 | 88 | public function thanks() 89 | { 90 | return view('thanks'); 91 | } 92 | 93 | public function notification() 94 | { 95 | try{ 96 | $notification = new Notification(); 97 | $notification = $notification->getTransaction(); 98 | 99 | $reference = base64_decode($notification->getReference()); 100 | 101 | $userOrder = UserOrder::whereReference($reference); 102 | $userOrder->update([ 103 | 'pagseguro_status' => $notification->getStatus() 104 | ]); 105 | 106 | if($notification->getStatus() == 3) { 107 | // Liberar o pedido do usuário..., atualizar o status do pedido para em separação 108 | //Notificar o usuário que o pedido foi pago... 109 | //Notificar a loja da confirmação do pedido... 110 | } 111 | 112 | return response()->json([], 204); 113 | 114 | } catch (\Exception $e) { 115 | $message = env('APP_DEBUG') ? $e->getMessage() : ''; 116 | 117 | return response()->json(['error' => $message], 500); 118 | } 119 | } 120 | 121 | private function makePagSeguroSession() 122 | { 123 | if(!session()->has('pagseguro_session_code')) { 124 | 125 | $sessionCode = \PagSeguro\Services\Session::create( 126 | \PagSeguro\Configuration\Configure::getAccountCredentials() 127 | ); 128 | 129 | return session()->put('pagseguro_session_code', $sessionCode->getResult()); 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | product = $product; 14 | } 15 | 16 | public function index() 17 | { 18 | $products = $this->product->limit(6)->orderBy('id', 'DESC')->get(); 19 | $stores = \App\Store::limit(3)->orderBy('id', 'DESC')->get(); 20 | 21 | return view('welcome', compact('products', 'stores')); 22 | } 23 | 24 | public function single($slug) 25 | { 26 | $product = $this->product->whereSlug($slug)->first(); 27 | 28 | return view('single', compact('product')); 29 | } 30 | } 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/Http/Controllers/StoreController.php: -------------------------------------------------------------------------------- 1 | store = $store; 15 | } 16 | 17 | public function index($slug) 18 | { 19 | $store = $this->store->whereSlug($slug)->first(); 20 | return view('store', compact('store')); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Http/Controllers/UserOrderController.php: -------------------------------------------------------------------------------- 1 | user()->orders()->paginate(15); 12 | 13 | return view('user-orders', compact('userOrders')); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 31 | \App\Http\Middleware\EncryptCookies::class, 32 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 33 | \Illuminate\Session\Middleware\StartSession::class, 34 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 35 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 36 | \App\Http\Middleware\VerifyCsrfToken::class, 37 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 38 | ], 39 | 40 | 'api' => [ 41 | 'throttle:60,1', 42 | 'bindings', 43 | ], 44 | ]; 45 | 46 | /** 47 | * The application's route middleware. 48 | * 49 | * These middleware may be assigned to groups or used individually. 50 | * 51 | * @var array 52 | */ 53 | protected $routeMiddleware = [ 54 | 'auth' => \App\Http\Middleware\Authenticate::class, 55 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 56 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 57 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 58 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 59 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 60 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 61 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 62 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 63 | 'user.has.store' => \App\Http\Middleware\UserHasStoreMiddleware::class, 64 | 'access.control.store.admin' => \App\Http\Middleware\AccessControlStoreAdmin::class 65 | ]; 66 | 67 | /** 68 | * The priority-sorted list of middleware. 69 | * 70 | * This forces non-global middleware to always be in the given order. 71 | * 72 | * @var array 73 | */ 74 | protected $middlewarePriority = [ 75 | \Illuminate\Session\Middleware\StartSession::class, 76 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 77 | \App\Http\Middleware\Authenticate::class, 78 | \Illuminate\Routing\Middleware\ThrottleRequests::class, 79 | \Illuminate\Session\Middleware\AuthenticateSession::class, 80 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 81 | \Illuminate\Auth\Middleware\Authorize::class, 82 | ]; 83 | } 84 | -------------------------------------------------------------------------------- /app/Http/Middleware/AccessControlStoreAdmin.php: -------------------------------------------------------------------------------- 1 | user()->role == 'ROLE_USER') 19 | return redirect()->route('user.orders'); 20 | 21 | return $next($request); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/CheckForMaintenanceMode.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/home'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | user()->store()->count()) { 19 | flash('Você já possui uma loja!')->warning(); 20 | return redirect()->route('admin.stores.index'); 21 | } 22 | 23 | return $next($request); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 'required' 28 | ]; 29 | } 30 | 31 | public function messages() 32 | { 33 | return [ 34 | 'required' => 'Este campo é obrigatório!' 35 | ]; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Http/Requests/ProductRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 28 | 'description' => 'required|min:30', 29 | 'body' => 'required', 30 | 'price' => 'required', 31 | 'photos.*' => 'image' 32 | ]; 33 | } 34 | 35 | public function messages() 36 | { 37 | return [ 38 | 'required' => 'Este campo é obrigatório!', 39 | 'min' => 'Campo deve ter no mínimo :min caracteres', 40 | 'image' => 'Arquivo não é uma imagem válida!' 41 | ]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 28 | 'description' => 'required|min:10', 29 | 'phone' => 'required', 30 | 'mobile_phone' => 'required', 31 | 'logo' => 'image' 32 | ]; 33 | } 34 | 35 | public function messages() 36 | { 37 | return [ 38 | 'required' => 'Este campo é obrigatório', 39 | 'min' => 'Campo deve ter no mínimo :min caracteres', 40 | 'image' => 'Arquivo não é uma imagem válida!' 41 | ]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Http/Views/CategoryViewComposer.php: -------------------------------------------------------------------------------- 1 | category = $category; 13 | } 14 | 15 | public function compose($view) 16 | { 17 | return $view->with('categories', $this->category->all(['name', 'slug'])); 18 | } 19 | } -------------------------------------------------------------------------------- /app/Mail/UserRegisteredEmail.php: -------------------------------------------------------------------------------- 1 | user = $user; 25 | } 26 | 27 | /** 28 | * Build the message. 29 | * 30 | * @return $this 31 | */ 32 | public function build() 33 | { 34 | return $this 35 | ->subject('Conta Criada com Sucesso!') 36 | ->replyTo('contato@codeexperts.com.br') 37 | ->view('emails.user-registered'); 38 | // ->with(['user' => $this->user]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Notifications/StoreReceiveNewOrder.php: -------------------------------------------------------------------------------- 1 | subject('Você recebeu um novo pedido!') 46 | ->greeting('Olá vendedor, tudo bem?') 47 | ->line('Você recebeu um novo pedido na loja!') 48 | ->action('Ver pedido', route('admin.orders.my')); 49 | } 50 | 51 | /** 52 | * Get the array representation of the notification. 53 | * 54 | * @param mixed $notifiable 55 | * @return array 56 | */ 57 | public function toArray($notifiable) 58 | { 59 | return [ 60 | 'message' => 'Você têm um novo pedido solicitado' 61 | ]; 62 | } 63 | 64 | public function toNexmo($notifiable) 65 | { 66 | return (new NexmoMessage) 67 | ->content('Você recebeu um novo pedido em nosso site!') 68 | ->from('5598984284714') 69 | ->unicode() 70 | ; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/Payment/PagSeguro/CreditCard.php: -------------------------------------------------------------------------------- 1 | items = $items; 14 | $this->user = $user; 15 | $this->cardInfo = $cardInfo; 16 | $this->reference = $reference; 17 | } 18 | 19 | public function doPayment() 20 | { 21 | $creditCard = new \PagSeguro\Domains\Requests\DirectPayment\CreditCard(); 22 | 23 | $creditCard->setReceiverEmail(env('PAGSEGURO_EMAIL')); 24 | $creditCard->setReference(base64_encode($this->reference)); 25 | $creditCard->setCurrency("BRL"); 26 | 27 | foreach($this->items as $item) { 28 | $creditCard->addItems()->withParameters( 29 | $item['id'], 30 | $item['name'], 31 | $item['amount'], 32 | $item['price'] 33 | ); 34 | } 35 | 36 | $user = $this->user; 37 | $email = env('PAGSEGURO_ENV') == 'sandbox' ? 'test@sandbox.pagseguro.com.br' : $user->email; 38 | 39 | $creditCard->setSender()->setName($user->name); 40 | $creditCard->setSender()->setEmail($email); 41 | $creditCard->setSender()->setPhone()->withParameters( 42 | 11, 43 | 56273440 44 | ); 45 | $creditCard->setSender()->setDocument()->withParameters( 46 | 'CPF', 47 | '27121238918' 48 | ); 49 | $creditCard->setSender()->setHash($this->cardInfo['hash']); 50 | $creditCard->setSender()->setIp('127.0.0.0'); 51 | 52 | $creditCard->setShipping()->setAddress()->withParameters( 53 | 'Av. Brig. Faria Lima', 54 | '1384', 55 | 'Jardim Paulistano', 56 | '01452002', 57 | 'São Paulo', 58 | 'SP', 59 | 'BRA', 60 | 'apto. 114' 61 | ); 62 | 63 | $creditCard->setBilling()->setAddress()->withParameters( 64 | 'Av. Brig. Faria Lima', 65 | '1384', 66 | 'Jardim Paulistano', 67 | '01452002', 68 | 'São Paulo', 69 | 'SP', 70 | 'BRA', 71 | 'apto. 114' 72 | ); 73 | 74 | $creditCard->setToken($this->cardInfo['card_token']); 75 | list($quantity, $installmentAmount) = explode('|', $this->cardInfo['installment']); 76 | 77 | $installmentAmount = number_format($installmentAmount, 2, '.', ''); 78 | 79 | $creditCard->setInstallment()->withParameters($quantity, $installmentAmount); 80 | 81 | $creditCard->setHolder()->setBirthdate('01/10/1979'); 82 | $creditCard->setHolder()->setName($this->cardInfo['card_name']); 83 | $creditCard->setHolder()->setPhone()->withParameters( 84 | 11, 85 | 56273440 86 | ); 87 | $creditCard->setHolder()->setDocument()->withParameters( 88 | 'CPF', 89 | '27121238918' 90 | ); 91 | 92 | $creditCard->setMode('DEFAULT'); 93 | 94 | $result = $creditCard->register( 95 | \PagSeguro\Configuration\Configure::getAccountCredentials() 96 | ); 97 | 98 | return $result; 99 | } 100 | } -------------------------------------------------------------------------------- /app/Payment/PagSeguro/Notification.php: -------------------------------------------------------------------------------- 1 | photos->first()->image; 17 | } 18 | 19 | public function store() 20 | { 21 | return $this->belongsTo(Store::class); 22 | } 23 | 24 | public function categories() 25 | { 26 | return $this->belongsToMany(Category::class); 27 | } 28 | 29 | public function photos() 30 | { 31 | return $this->hasMany(ProductPhoto::class); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/ProductPhoto.php: -------------------------------------------------------------------------------- 1 | belongsTo(Product::class); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | setName("Marketplace")->setRelease("1.0.0"); 29 | \PagSeguro\Library::moduleVersion()->setName("Marketplace")->setRelease("1.0.0"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | share('categories', $categories); 29 | // view()->composer('*', function($view) use($categories){ 30 | // $view->with('categories', $categories); 31 | // }); 32 | 33 | view()->composer('layouts.front', 'App\Http\Views\CategoryViewComposer@compose'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | parent::boot(); 31 | 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 39 | 40 | $this->mapWebRoutes(); 41 | 42 | // 43 | } 44 | 45 | /** 46 | * Define the "web" routes for the application. 47 | * 48 | * These routes all receive session state, CSRF protection, etc. 49 | * 50 | * @return void 51 | */ 52 | protected function mapWebRoutes() 53 | { 54 | Route::middleware('web') 55 | ->namespace($this->namespace) 56 | ->group(base_path('routes/web.php')); 57 | } 58 | 59 | /** 60 | * Define the "api" routes for the application. 61 | * 62 | * These routes are typically stateless. 63 | * 64 | * @return void 65 | */ 66 | protected function mapApiRoutes() 67 | { 68 | Route::prefix('api') 69 | ->middleware('api') 70 | ->namespace($this->namespace) 71 | ->group(base_path('routes/api.php')); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Store.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class); 18 | } 19 | 20 | public function products() 21 | { 22 | return $this->hasMany(Product::class); 23 | } 24 | 25 | public function orders() 26 | { 27 | return $this->belongsToMany(UserOrder::class, 'order_store', null, 'order_id'); 28 | } 29 | 30 | public function notifyStoreOwners(array $storesId = []) 31 | { 32 | $stores = $this->whereIn('id', $storesId)->get(); 33 | 34 | $stores->map(function($store){ 35 | return $store->user; 36 | })->each->notify(new StoreReceiveNewOrder()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/Traits/Slug.php: -------------------------------------------------------------------------------- 1 | uniqueSlug($slug); 12 | 13 | $this->attributes['name'] = $value; 14 | $this->attributes['slug'] = $matchs ? $slug . '-' . $matchs : $slug; 15 | } 16 | 17 | public function uniqueSlug($slug) 18 | { 19 | $matchs = $this->whereRaw("slug REGEXP '^{$slug}(-[0-9]*)?$'")->count(); 20 | 21 | return $matchs; 22 | } 23 | } -------------------------------------------------------------------------------- /app/Traits/UploadTrait.php: -------------------------------------------------------------------------------- 1 | $image->store('products', 'public')]; 15 | } 16 | 17 | } else { 18 | $uploadedImages = $images->store('logo', 'public'); 19 | } 20 | 21 | return $uploadedImages; 22 | } 23 | } -------------------------------------------------------------------------------- /app/User.php: -------------------------------------------------------------------------------- 1 | 'datetime' 38 | ]; 39 | 40 | public function store() 41 | { 42 | return $this->hasOne(Store::class); 43 | } 44 | 45 | public function orders() 46 | { 47 | return $this->hasMany(UserOrder::class); 48 | } 49 | 50 | public function routeNotificationForNexmo($notification) 51 | { 52 | $storeMobilePhoneNumber = trim(str_replace(['(', ')', ' ', '-'], '', $this->store->mobile_phone)); 53 | return '55' . $storeMobilePhoneNumber; 54 | } 55 | } -------------------------------------------------------------------------------- /app/UserOrder.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class); 14 | } 15 | 16 | public function store() 17 | { 18 | return $this->belongsTo(Store::class); 19 | } 20 | 21 | public function stores() 22 | { 23 | return $this->belongsToMany(Store::class, 'order_store', 'order_id'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /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/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": [ 6 | "framework", 7 | "laravel" 8 | ], 9 | "license": "MIT", 10 | "require": { 11 | "php": "^7.2", 12 | "fideloper/proxy": "^4.0", 13 | "laracasts/flash": "^3.0", 14 | "laravel/framework": "^6.0", 15 | "laravel/nexmo-notification-channel": "^2.3", 16 | "laravel/tinker": "^1.0", 17 | "laravel/ui": "^1.1", 18 | "pagseguro/pagseguro-php-sdk": "^6.0", 19 | "ramsey/uuid": "^3.9", 20 | "spatie/laravel-sluggable": "^2.2" 21 | }, 22 | "require-dev": { 23 | "facade/ignition": "^1.4", 24 | "fzaninotto/faker": "^1.4", 25 | "mockery/mockery": "^1.0", 26 | "nunomaduro/collision": "^3.0", 27 | "phpunit/phpunit": "^8.0" 28 | }, 29 | "config": { 30 | "optimize-autoloader": true, 31 | "preferred-install": "dist", 32 | "sort-packages": true 33 | }, 34 | "extra": { 35 | "laravel": { 36 | "dont-discover": [] 37 | } 38 | }, 39 | "autoload": { 40 | "psr-4": { 41 | "App\\": "app/" 42 | }, 43 | "classmap": [ 44 | "database/seeds", 45 | "database/factories" 46 | ], 47 | "files": ["helpers/functions.php"] 48 | }, 49 | "autoload-dev": { 50 | "psr-4": { 51 | "Tests\\": "tests/" 52 | } 53 | }, 54 | "minimum-stability": "dev", 55 | "prefer-stable": true, 56 | "scripts": { 57 | "post-autoload-dump": [ 58 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 59 | "@php artisan package:discover --ansi" 60 | ], 61 | "post-root-package-install": [ 62 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 63 | ], 64 | "post-create-project-cmd": [ 65 | "@php artisan key:generate --ansi" 66 | ] 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session", "token" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 44 | 'api' => [ 45 | 'driver' => 'token', 46 | 'provider' => 'users', 47 | 'hash' => false, 48 | ], 49 | ], 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | User Providers 54 | |-------------------------------------------------------------------------- 55 | | 56 | | All authentication drivers have a user provider. This defines how the 57 | | users are actually retrieved out of your database or other storage 58 | | mechanisms used by this application to persist your user's data. 59 | | 60 | | If you have multiple user tables or models you may configure multiple 61 | | sources which represent each model / table. These sources may then 62 | | be assigned to any extra authentication guards you have defined. 63 | | 64 | | Supported: "database", "eloquent" 65 | | 66 | */ 67 | 68 | 'providers' => [ 69 | 'users' => [ 70 | 'driver' => 'eloquent', 71 | 'model' => App\User::class, 72 | ], 73 | 74 | // 'users' => [ 75 | // 'driver' => 'database', 76 | // 'table' => 'users', 77 | // ], 78 | ], 79 | 80 | /* 81 | |-------------------------------------------------------------------------- 82 | | Resetting Passwords 83 | |-------------------------------------------------------------------------- 84 | | 85 | | You may specify multiple password reset configurations if you have more 86 | | than one user table or model in the application and you want to have 87 | | separate password reset settings based on the specific user types. 88 | | 89 | | The expire time is the number of minutes that the reset token should be 90 | | considered valid. This security feature keeps tokens short-lived so 91 | | they have less time to be guessed. You may change this as needed. 92 | | 93 | */ 94 | 95 | 'passwords' => [ 96 | 'users' => [ 97 | 'provider' => 'users', 98 | 'table' => 'password_resets', 99 | 'expire' => 60, 100 | ], 101 | ], 102 | 103 | ]; 104 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'useTLS' => true, 41 | ], 42 | ], 43 | 44 | 'redis' => [ 45 | 'driver' => 'redis', 46 | 'connection' => 'default', 47 | ], 48 | 49 | 'log' => [ 50 | 'driver' => 'log', 51 | ], 52 | 53 | 'null' => [ 54 | 'driver' => 'null', 55 | ], 56 | 57 | ], 58 | 59 | ]; 60 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Cache Stores 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Here you may define all of the cache "stores" for your application as 29 | | well as their drivers. You may even define multiple stores for the 30 | | same cache driver to group types of items stored in your caches. 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | ], 43 | 44 | 'database' => [ 45 | 'driver' => 'database', 46 | 'table' => 'cache', 47 | 'connection' => null, 48 | ], 49 | 50 | 'file' => [ 51 | 'driver' => 'file', 52 | 'path' => storage_path('framework/cache/data'), 53 | ], 54 | 55 | 'memcached' => [ 56 | 'driver' => 'memcached', 57 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 58 | 'sasl' => [ 59 | env('MEMCACHED_USERNAME'), 60 | env('MEMCACHED_PASSWORD'), 61 | ], 62 | 'options' => [ 63 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 64 | ], 65 | 'servers' => [ 66 | [ 67 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 68 | 'port' => env('MEMCACHED_PORT', 11211), 69 | 'weight' => 100, 70 | ], 71 | ], 72 | ], 73 | 74 | 'redis' => [ 75 | 'driver' => 'redis', 76 | 'connection' => 'cache', 77 | ], 78 | 79 | 'dynamodb' => [ 80 | 'driver' => 'dynamodb', 81 | 'key' => env('AWS_ACCESS_KEY_ID'), 82 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 83 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 84 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 85 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 86 | ], 87 | 88 | ], 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Cache Key Prefix 93 | |-------------------------------------------------------------------------- 94 | | 95 | | When utilizing a RAM based store such as APC or Memcached, there might 96 | | be other applications utilizing the same cache. So, we'll specify a 97 | | value to get prefixed to all our keys so we can avoid collisions. 98 | | 99 | */ 100 | 101 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), 102 | 103 | ]; 104 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Database Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here are each of the database connections setup for your application. 26 | | Of course, examples of configuring each database platform that is 27 | | supported by Laravel is shown below to make development simple. 28 | | 29 | | 30 | | All database work in Laravel is done through the PHP PDO facilities 31 | | so make sure you have the driver for your particular database of 32 | | choice installed on your machine before you begin development. 33 | | 34 | */ 35 | 36 | 'connections' => [ 37 | 38 | 'sqlite' => [ 39 | 'driver' => 'sqlite', 40 | 'url' => env('DATABASE_URL'), 41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 42 | 'prefix' => '', 43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 44 | ], 45 | 46 | 'mysql' => [ 47 | 'driver' => 'mysql', 48 | 'url' => env('DATABASE_URL'), 49 | 'host' => env('DB_HOST', '127.0.0.1'), 50 | 'port' => env('DB_PORT', '3306'), 51 | 'database' => env('DB_DATABASE', 'forge'), 52 | 'username' => env('DB_USERNAME', 'forge'), 53 | 'password' => env('DB_PASSWORD', ''), 54 | 'unix_socket' => env('DB_SOCKET', ''), 55 | 'charset' => 'utf8mb4', 56 | 'collation' => 'utf8mb4_unicode_ci', 57 | 'prefix' => '', 58 | 'prefix_indexes' => true, 59 | 'strict' => true, 60 | 'engine' => null, 61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 63 | ]) : [], 64 | ], 65 | 66 | 'pgsql' => [ 67 | 'driver' => 'pgsql', 68 | 'url' => env('DATABASE_URL'), 69 | 'host' => env('DB_HOST', '127.0.0.1'), 70 | 'port' => env('DB_PORT', '5432'), 71 | 'database' => env('DB_DATABASE', 'forge'), 72 | 'username' => env('DB_USERNAME', 'forge'), 73 | 'password' => env('DB_PASSWORD', ''), 74 | 'charset' => 'utf8', 75 | 'prefix' => '', 76 | 'prefix_indexes' => true, 77 | 'schema' => 'public', 78 | 'sslmode' => 'prefer', 79 | ], 80 | 81 | 'sqlsrv' => [ 82 | 'driver' => 'sqlsrv', 83 | 'url' => env('DATABASE_URL'), 84 | 'host' => env('DB_HOST', 'localhost'), 85 | 'port' => env('DB_PORT', '1433'), 86 | 'database' => env('DB_DATABASE', 'forge'), 87 | 'username' => env('DB_USERNAME', 'forge'), 88 | 'password' => env('DB_PASSWORD', ''), 89 | 'charset' => 'utf8', 90 | 'prefix' => '', 91 | 'prefix_indexes' => true, 92 | ], 93 | 94 | ], 95 | 96 | /* 97 | |-------------------------------------------------------------------------- 98 | | Migration Repository Table 99 | |-------------------------------------------------------------------------- 100 | | 101 | | This table keeps track of all the migrations that have already run for 102 | | your application. Using this information, we can determine which of 103 | | the migrations on disk haven't actually been run in the database. 104 | | 105 | */ 106 | 107 | 'migrations' => 'migrations', 108 | 109 | /* 110 | |-------------------------------------------------------------------------- 111 | | Redis Databases 112 | |-------------------------------------------------------------------------- 113 | | 114 | | Redis is an open source, fast, and advanced key-value store that also 115 | | provides a richer body of commands than a typical key-value system 116 | | such as APC or Memcached. Laravel makes it easy to dig right in. 117 | | 118 | */ 119 | 120 | 'redis' => [ 121 | 122 | 'client' => env('REDIS_CLIENT', 'phpredis'), 123 | 124 | 'options' => [ 125 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 126 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 127 | ], 128 | 129 | 'default' => [ 130 | 'url' => env('REDIS_URL'), 131 | 'host' => env('REDIS_HOST', '127.0.0.1'), 132 | 'password' => env('REDIS_PASSWORD', null), 133 | 'port' => env('REDIS_PORT', 6379), 134 | 'database' => env('REDIS_DB', 0), 135 | ], 136 | 137 | 'cache' => [ 138 | 'url' => env('REDIS_URL'), 139 | 'host' => env('REDIS_HOST', '127.0.0.1'), 140 | 'password' => env('REDIS_PASSWORD', null), 141 | 'port' => env('REDIS_PORT', 6379), 142 | 'database' => env('REDIS_CACHE_DB', 1), 143 | ], 144 | 145 | ], 146 | 147 | ]; 148 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DRIVER', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Cloud Filesystem Disk 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Many applications store files both locally and in the cloud. For this 24 | | reason, you may specify a default "cloud" driver here. This driver 25 | | will be bound as the Cloud disk implementation in the container. 26 | | 27 | */ 28 | 29 | 'cloud' => env('FILESYSTEM_CLOUD', 's3'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Filesystem Disks 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may configure as many filesystem "disks" as you wish, and you 37 | | may even configure multiple disks of the same driver. Defaults have 38 | | been setup for each driver as an example of the required options. 39 | | 40 | | Supported Drivers: "local", "ftp", "sftp", "s3" 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'url' => env('APP_URL').'/storage', 55 | 'visibility' => 'public', 56 | ], 57 | 58 | 's3' => [ 59 | 'driver' => 's3', 60 | 'key' => env('AWS_ACCESS_KEY_ID'), 61 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 62 | 'region' => env('AWS_DEFAULT_REGION'), 63 | 'bucket' => env('AWS_BUCKET'), 64 | 'url' => env('AWS_URL'), 65 | ], 66 | 67 | ], 68 | 69 | ]; 70 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 1024, 48 | 'threads' => 2, 49 | 'time' => 2, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Log Channels 25 | |-------------------------------------------------------------------------- 26 | | 27 | | Here you may configure the log channels for your application. Out of 28 | | the box, Laravel uses the Monolog PHP logging library. This gives 29 | | you a variety of powerful log handlers / formatters to utilize. 30 | | 31 | | Available Drivers: "single", "daily", "slack", "syslog", 32 | | "errorlog", "monolog", 33 | | "custom", "stack" 34 | | 35 | */ 36 | 37 | 'channels' => [ 38 | 'stack' => [ 39 | 'driver' => 'stack', 40 | 'channels' => ['daily'], 41 | 'ignore_exceptions' => false, 42 | ], 43 | 44 | 'single' => [ 45 | 'driver' => 'single', 46 | 'path' => storage_path('logs/laravel.log'), 47 | 'level' => 'debug', 48 | ], 49 | 50 | 'daily' => [ 51 | 'driver' => 'daily', 52 | 'path' => storage_path('logs/laravel.log'), 53 | 'level' => 'debug', 54 | 'days' => 14, 55 | ], 56 | 57 | 'slack' => [ 58 | 'driver' => 'slack', 59 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 60 | 'username' => 'Laravel Log', 61 | 'emoji' => ':boom:', 62 | 'level' => 'critical', 63 | ], 64 | 65 | 'papertrail' => [ 66 | 'driver' => 'monolog', 67 | 'level' => 'debug', 68 | 'handler' => SyslogUdpHandler::class, 69 | 'handler_with' => [ 70 | 'host' => env('PAPERTRAIL_URL'), 71 | 'port' => env('PAPERTRAIL_PORT'), 72 | ], 73 | ], 74 | 75 | 'stderr' => [ 76 | 'driver' => 'monolog', 77 | 'handler' => StreamHandler::class, 78 | 'formatter' => env('LOG_STDERR_FORMATTER'), 79 | 'with' => [ 80 | 'stream' => 'php://stderr', 81 | ], 82 | ], 83 | 84 | 'syslog' => [ 85 | 'driver' => 'syslog', 86 | 'level' => 'debug', 87 | ], 88 | 89 | 'errorlog' => [ 90 | 'driver' => 'errorlog', 91 | 'level' => 'debug', 92 | ], 93 | 94 | 'null' => [ 95 | 'driver' => 'monolog', 96 | 'handler' => NullHandler::class, 97 | ], 98 | ], 99 | 100 | ]; 101 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_DRIVER', 'smtp'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | SMTP Host Address 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may provide the host address of the SMTP server used by your 27 | | applications. A default option is provided that is compatible with 28 | | the Mailgun mail service which will provide reliable deliveries. 29 | | 30 | */ 31 | 32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | SMTP Host Port 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This is the SMTP port used by your application to deliver e-mails to 40 | | users of the application. Like the host we have set this value to 41 | | stay compatible with the Mailgun e-mail application by default. 42 | | 43 | */ 44 | 45 | 'port' => env('MAIL_PORT', 587), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Global "From" Address 50 | |-------------------------------------------------------------------------- 51 | | 52 | | You may wish for all e-mails sent by your application to be sent from 53 | | the same address. Here, you may specify a name and address that is 54 | | used globally for all e-mails that are sent by your application. 55 | | 56 | */ 57 | 58 | 'from' => [ 59 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 60 | 'name' => env('MAIL_FROM_NAME', 'Example'), 61 | ], 62 | 63 | /* 64 | |-------------------------------------------------------------------------- 65 | | E-Mail Encryption Protocol 66 | |-------------------------------------------------------------------------- 67 | | 68 | | Here you may specify the encryption protocol that should be used when 69 | | the application send e-mail messages. A sensible default using the 70 | | transport layer security protocol should provide great security. 71 | | 72 | */ 73 | 74 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | SMTP Server Username 79 | |-------------------------------------------------------------------------- 80 | | 81 | | If your SMTP server requires a username for authentication, you should 82 | | set it here. This will get used to authenticate with your server on 83 | | connection. You may also set the "password" value below this one. 84 | | 85 | */ 86 | 87 | 'username' => env('MAIL_USERNAME'), 88 | 89 | 'password' => env('MAIL_PASSWORD'), 90 | 91 | /* 92 | |-------------------------------------------------------------------------- 93 | | Sendmail System Path 94 | |-------------------------------------------------------------------------- 95 | | 96 | | When using the "sendmail" driver to send e-mails, we will need to know 97 | | the path to where Sendmail lives on this server. A default path has 98 | | been provided here, which will work well on most of your systems. 99 | | 100 | */ 101 | 102 | 'sendmail' => '/usr/sbin/sendmail -bs', 103 | 104 | /* 105 | |-------------------------------------------------------------------------- 106 | | Markdown Mail Settings 107 | |-------------------------------------------------------------------------- 108 | | 109 | | If you are using Markdown based email rendering, you may configure your 110 | | theme and component paths here, allowing you to customize the design 111 | | of the emails. Or, you may simply stick with the Laravel defaults! 112 | | 113 | */ 114 | 115 | 'markdown' => [ 116 | 'theme' => 'default', 117 | 118 | 'paths' => [ 119 | resource_path('views/vendor/mail'), 120 | ], 121 | ], 122 | 123 | /* 124 | |-------------------------------------------------------------------------- 125 | | Log Channel 126 | |-------------------------------------------------------------------------- 127 | | 128 | | If you are using the "log" driver, you may specify the logging channel 129 | | if you prefer to keep mail messages separate from other log entries 130 | | for simpler reading. Otherwise, the default channel will be used. 131 | | 132 | */ 133 | 134 | 'log_channel' => env('MAIL_LOG_CHANNEL'), 135 | 136 | ]; 137 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | 'block_for' => 0, 50 | ], 51 | 52 | 'sqs' => [ 53 | 'driver' => 'sqs', 54 | 'key' => env('AWS_ACCESS_KEY_ID'), 55 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 56 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 57 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 58 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 59 | ], 60 | 61 | 'redis' => [ 62 | 'driver' => 'redis', 63 | 'connection' => 'default', 64 | 'queue' => env('REDIS_QUEUE', 'default'), 65 | 'retry_after' => 90, 66 | 'block_for' => null, 67 | ], 68 | 69 | ], 70 | 71 | /* 72 | |-------------------------------------------------------------------------- 73 | | Failed Queue Jobs 74 | |-------------------------------------------------------------------------- 75 | | 76 | | These options configure the behavior of failed queue job logging so you 77 | | can control which database and table are used to store the jobs that 78 | | have failed. You may change them to any database / table you wish. 79 | | 80 | */ 81 | 82 | 'failed' => [ 83 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 84 | 'database' => env('DB_CONNECTION', 'mysql'), 85 | 'table' => 'failed_jobs', 86 | ], 87 | 88 | ]; 89 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | ], 22 | 23 | 'postmark' => [ 24 | 'token' => env('POSTMARK_TOKEN'), 25 | ], 26 | 27 | 'ses' => [ 28 | 'key' => env('AWS_ACCESS_KEY_ID'), 29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 31 | ], 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('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' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | *.sqlite-journal 3 | -------------------------------------------------------------------------------- /database/factories/CategoryFactory.php: -------------------------------------------------------------------------------- 1 | define(\App\Category::class, function (Faker $faker) { 9 | return [ 10 | 'name' => $faker->name, 11 | 'description' => $faker->sentence, 12 | 'slug' => $faker->slug 13 | ]; 14 | }); 15 | -------------------------------------------------------------------------------- /database/factories/ProductFactory.php: -------------------------------------------------------------------------------- 1 | define(\App\Product::class, function (Faker $faker) { 9 | return [ 10 | 'name' => $faker->name, 11 | 'description' => $faker->sentence, 12 | 'body' => $faker->paragraph(5, true), 13 | 'price' => $faker->randomFloat(2, 1, 10), 14 | 'slug' => $faker->slug, 15 | ]; 16 | }); 17 | -------------------------------------------------------------------------------- /database/factories/StoreFactory.php: -------------------------------------------------------------------------------- 1 | define(\App\Store::class, function (Faker $faker) { 9 | return [ 10 | 'name' => $faker->name, 11 | 'description' => $faker->sentence, 12 | 'phone' => $faker->phoneNumber, 13 | 'mobile_phone' => $faker->phoneNumber, 14 | 'slug' => $faker->slug, 15 | ]; 16 | }); 17 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | define(User::class, function (Faker $faker) { 20 | return [ 21 | 'name' => $faker->name, 22 | 'email' => $faker->unique()->safeEmail, 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | }); 28 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->text('connection'); 19 | $table->text('queue'); 20 | $table->longText('payload'); 21 | $table->longText('exception'); 22 | $table->timestamp('failed_at')->useCurrent(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('failed_jobs'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2019_10_18_212717_create_table_store.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->unsignedBigInteger('user_id'); 19 | 20 | $table->string('name'); 21 | $table->string('description'); 22 | $table->string('phone'); 23 | $table->string('mobile_phone'); 24 | $table->string('slug'); 25 | 26 | $table->timestamps(); 27 | 28 | $table->foreign('user_id')->references('id')->on('users'); //Nome da chave stran: stores_user_id_foreign 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | Schema::dropIfExists('stores'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /database/migrations/2019_10_18_214944_create_products_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->unsignedBigInteger('store_id'); 19 | 20 | $table->string('name'); 21 | $table->string('description'); 22 | $table->text('body'); 23 | $table->decimal('price', 10, 2); 24 | $table->string('slug'); 25 | 26 | $table->timestamps(); 27 | 28 | $table->foreign('store_id')->references('id')->on('stores')->onDelete('cascade'); 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | Schema::dropIfExists('products'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /database/migrations/2019_10_27_173536_create_categories_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | 19 | $table->string('name'); 20 | $table->string('description')->nullable(); 21 | $table->string('slug'); 22 | 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('categories'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2019_10_27_173744_create_category_product_table.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('product_id'); 18 | $table->unsignedBigInteger('category_id'); 19 | 20 | $table->foreign('product_id')->references('id')->on('products'); 21 | $table->foreign('category_id')->references('id')->on('categories'); 22 | }); 23 | } 24 | 25 | /**w 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('category_product'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2019_12_04_201729_create_product_photos_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | 19 | $table->unsignedBigInteger('product_id'); 20 | 21 | $table->string('image'); 22 | 23 | $table->timestamps(); 24 | 25 | $table->foreign('product_id')->references('id')->on('products'); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('product_photos'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /database/migrations/2019_12_04_202057_alter_table_stores_add_column_logo.php: -------------------------------------------------------------------------------- 1 | string('logo')->nullable(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('stores', function (Blueprint $table) { 29 | $table->dropColumn('logo'); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2019_12_28_140645_create_user_order_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->unsignedBigInteger('user_id'); 19 | 20 | $table->string('reference'); 21 | $table->string('pagseguro_code'); 22 | $table->integer('pagseguro_status'); 23 | 24 | $table->text('items'); 25 | 26 | $table->timestamps(); 27 | 28 | $table->foreign('user_id')->references('id')->on('users'); 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | Schema::dropIfExists('user_orders'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /database/migrations/2020_02_07_183221_create_order_store_table.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('store_id'); 18 | $table->unsignedBigInteger('order_id'); 19 | 20 | $table->foreign('store_id')->references('id')->on('stores'); 21 | $table->foreign('order_id')->references('id')->on('user_orders'); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('order_store'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2020_02_09_153417_create_notifications_table.php: -------------------------------------------------------------------------------- 1 | uuid('id')->primary(); 18 | $table->string('type'); 19 | $table->morphs('notifiable'); 20 | $table->text('data'); 21 | $table->timestamp('read_at')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('notifications'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2020_02_22_165158_alter_users_table.php: -------------------------------------------------------------------------------- 1 | string('role')->default('ROLE_USER'); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::table('users', function (Blueprint $table) { 29 | $table->dropColumn('role'); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /database/seeds/StoreTableSeeder.php: -------------------------------------------------------------------------------- 1 | products()->save(factory(\App\Product::class)->make()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /database/seeds/UsersTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert( 15 | // [ 16 | // 'name' => 'Administrator', 17 | // 'email' => 'admin@admin.com', 18 | // 'email_verified_at' => now(), 19 | // 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 20 | // 'remember_token' => 'okokdsdsdsdsdsd', 21 | // ] 22 | // ); 23 | 24 | factory(\App\User::class, 40)->create()->each(function($user){ 25 | $user->store()->save(factory(\App\Store::class)->make()); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /helpers/functions.php: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/Unit 14 | 15 | 16 | 17 | ./tests/Feature 18 | 19 | 20 | 21 | 22 | ./app 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Handle Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/assets/img/no-photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExpertsLearning/laravel-6-na-pratica-marketplace-curso/7a7bb3d996b876041c600c69bce63da8c8dd39d0/public/assets/img/no-photo.jpg -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExpertsLearning/laravel-6-na-pratica-marketplace-curso/7a7bb3d996b876041c600c69bce63da8c8dd39d0/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | define('LARAVEL_START', microtime(true)); 11 | 12 | /* 13 | |-------------------------------------------------------------------------- 14 | | Register The Auto Loader 15 | |-------------------------------------------------------------------------- 16 | | 17 | | Composer provides a convenient, automatically generated class loader for 18 | | our application. We just need to utilize it! We'll simply require it 19 | | into the script here so that we don't have to worry about manual 20 | | loading any of our classes later on. It feels great to relax. 21 | | 22 | */ 23 | 24 | require __DIR__.'/../vendor/autoload.php'; 25 | 26 | /* 27 | |-------------------------------------------------------------------------- 28 | | Turn On The Lights 29 | |-------------------------------------------------------------------------- 30 | | 31 | | We need to illuminate PHP development, so let us turn on the lights. 32 | | This bootstraps the framework and gets it ready for use, then it 33 | | will load up this application so that we can run it and send 34 | | the responses back to the browser and delight our users. 35 | | 36 | */ 37 | 38 | $app = require_once __DIR__.'/../bootstrap/app.php'; 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Run The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once we have the application, we can handle the incoming request 46 | | through the kernel, and send the associated response back to 47 | | the client's browser allowing them to enjoy the creative 48 | | and wonderful application we have prepared for them. 49 | | 50 | */ 51 | 52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 53 | 54 | $response = $kernel->handle( 55 | $request = Illuminate\Http\Request::capture() 56 | ); 57 | 58 | $response->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /public/js/pagseguro_events.js: -------------------------------------------------------------------------------- 1 | let cardNumber = document.querySelector('input[name=card_number]'); 2 | let spanBrand = document.querySelector('span.brand'); 3 | 4 | cardNumber.addEventListener('keyup', function(){ 5 | if(cardNumber.value.length >= 6) { 6 | PagSeguroDirectPayment.getBrand({ 7 | cardBin: cardNumber.value.substr(0, 6), 8 | success: function(res) { 9 | let imgFlag = ``; 10 | spanBrand.innerHTML = imgFlag; 11 | document.querySelector('input[name=card_brand]').value = res.brand.name; 12 | 13 | getInstallments(amoutTransaction, res.brand.name); 14 | }, 15 | error: function(err) { 16 | console.log(err); 17 | }, 18 | complete: function(res) { 19 | //console.log('Complete', res); 20 | } 21 | }); 22 | } 23 | }); 24 | 25 | let submitButton = document.querySelector('button.processCheckout'); 26 | 27 | submitButton.addEventListener('click', function(event){ 28 | event.preventDefault(); 29 | document.querySelector('div.msg').innerHTML = ''; 30 | 31 | let buttonTarget = event.target; 32 | 33 | buttonTarget.disabled = true; 34 | buttonTarget.innerHTML = 'Carregando...'; 35 | 36 | PagSeguroDirectPayment.createCardToken({ 37 | cardNumber: document.querySelector('input[name=card_number]').value, 38 | brand: document.querySelector('input[name=card_brand]').value, 39 | cvv: document.querySelector('input[name=card_cvv]').value, 40 | expirationMonth: document.querySelector('input[name=card_month]').value, 41 | expirationYear: document.querySelector('input[name=card_year]').value, 42 | success: function(res) { 43 | proccessPayment(res.card.token, buttonTarget); 44 | }, 45 | error: function(err) { 46 | buttonTarget.disabled = false; 47 | buttonTarget.innerHTML = 'Efetuar Pagamento'; 48 | 49 | for(let i in err.errors) { 50 | document.querySelector('div.msg').innerHTML = showErrorMessages(errorsMapPagseguroJS(i)); 51 | } 52 | } 53 | }); 54 | }); -------------------------------------------------------------------------------- /public/js/pagseguro_functions.js: -------------------------------------------------------------------------------- 1 | function proccessPayment(token, buttonTarget) 2 | { 3 | let data = { 4 | card_token: token, 5 | hash: PagSeguroDirectPayment.getSenderHash(), 6 | installment: document.querySelector('select.select_installments').value, 7 | card_name: document.querySelector('input[name=card_name]').value, 8 | _token: csrf 9 | }; 10 | 11 | $.ajax({ 12 | type: 'POST', 13 | url: urlProccess, 14 | data: data, 15 | dataType: 'json', 16 | success: function(res) { 17 | 18 | toastr.success(res.data.message, 'Sucesso'); 19 | window.location.href = `${urlThanks}?order=${res.data.order}`; 20 | }, 21 | error: function(err) { 22 | buttonTarget.disabled = false; 23 | buttonTarget.innerHTML = 'Efetuar Pagamento'; 24 | 25 | let message = JSON.parse(err.responseText); 26 | document.querySelector('div.msg').innerHTML = showErrorMessages(message.data.message.error.message); 27 | } 28 | }); 29 | } 30 | 31 | 32 | function getInstallments(amount, brand) { 33 | PagSeguroDirectPayment.getInstallments({ 34 | amount: amount, 35 | brand: brand, 36 | maxInstallmentNoInterest: 0, 37 | success: function(res) { 38 | let selectInstallments = drawSelectInstallments(res.installments[brand]); 39 | document.querySelector('div.installments').innerHTML = selectInstallments; 40 | }, 41 | error: function(err) { 42 | console.log(err); 43 | }, 44 | complete: function(res) { 45 | 46 | }, 47 | }) 48 | } 49 | 50 | function drawSelectInstallments(installments) { 51 | let select = ''; 52 | 53 | select += ''; 61 | 62 | return select; 63 | } 64 | 65 | function showErrorMessages(message) 66 | { 67 | return ` 68 |
${message}
69 | `; 70 | } 71 | 72 | function errorsMapPagseguroJS(code) 73 | { 74 | switch(code) { 75 | case "10000": 76 | return 'Bandeira do cartão inválida!'; 77 | break; 78 | 79 | case "10001": 80 | return 'Número do Cartão com tamanho inválido!'; 81 | break; 82 | 83 | case "10002": 84 | case "30405": 85 | return 'Data com formato inválido!'; 86 | break; 87 | 88 | case "10003": 89 | return 'Código de segurança inválido'; 90 | break; 91 | 92 | case "10004": 93 | return 'Código de segurança é obrigatório!'; 94 | break; 95 | 96 | case "10006": 97 | return 'Tamanho do código de segurança inválido!'; 98 | break; 99 | 100 | default: 101 | return 'Houve um erro na validação do seu cartão de crédito!'; 102 | } 103 | } -------------------------------------------------------------------------------- /public/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/app.js": "/js/app.js", 3 | "/css/app.css": "/css/app.css", 4 | "/js/pagseguro_functions.js": "/js/pagseguro_functions.js", 5 | "/js/pagseguro_events.js": "/js/pagseguro_events.js" 6 | } 7 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | require('./bootstrap'); 2 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | window._ = require('lodash'); 2 | 3 | /** 4 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support 5 | * for JavaScript based Bootstrap features such as modals and tabs. This 6 | * code may be modified to fit the specific needs of your application. 7 | */ 8 | 9 | try { 10 | window.Popper = require('popper.js').default; 11 | window.$ = window.jQuery = require('jquery'); 12 | 13 | require('bootstrap'); 14 | } catch (e) {} 15 | 16 | window.Inputmask = require('inputmask'); 17 | 18 | /** 19 | * We'll load the axios HTTP library which allows us to easily issue requests 20 | * to our Laravel back-end. This library automatically handles sending the 21 | * CSRF token as a header based on the value of the "XSRF" token cookie. 22 | */ 23 | 24 | window.axios = require('axios'); 25 | 26 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 27 | 28 | /** 29 | * Echo exposes an expressive API for subscribing to channels and listening 30 | * for events that are broadcast by Laravel. Echo and event broadcasting 31 | * allows your team to easily build robust real-time web applications. 32 | */ 33 | 34 | // import Echo from 'laravel-echo'; 35 | 36 | // window.Pusher = require('pusher-js'); 37 | 38 | // window.Echo = new Echo({ 39 | // broadcaster: 'pusher', 40 | // key: process.env.MIX_PUSHER_APP_KEY, 41 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER, 42 | // encrypted: true 43 | // }); 44 | -------------------------------------------------------------------------------- /resources/js/pagseguro_events.js: -------------------------------------------------------------------------------- 1 | let cardNumber = document.querySelector('input[name=card_number]'); 2 | let spanBrand = document.querySelector('span.brand'); 3 | 4 | cardNumber.addEventListener('keyup', function(){ 5 | if(cardNumber.value.length >= 6) { 6 | PagSeguroDirectPayment.getBrand({ 7 | cardBin: cardNumber.value.substr(0, 6), 8 | success: function(res) { 9 | let imgFlag = ``; 10 | spanBrand.innerHTML = imgFlag; 11 | document.querySelector('input[name=card_brand]').value = res.brand.name; 12 | 13 | getInstallments(amoutTransaction, res.brand.name); 14 | }, 15 | error: function(err) { 16 | console.log(err); 17 | }, 18 | complete: function(res) { 19 | //console.log('Complete', res); 20 | } 21 | }); 22 | } 23 | }); 24 | 25 | let submitButton = document.querySelector('button.processCheckout'); 26 | 27 | submitButton.addEventListener('click', function(event){ 28 | event.preventDefault(); 29 | document.querySelector('div.msg').innerHTML = ''; 30 | 31 | let buttonTarget = event.target; 32 | 33 | buttonTarget.disabled = true; 34 | buttonTarget.innerHTML = 'Carregando...'; 35 | 36 | PagSeguroDirectPayment.createCardToken({ 37 | cardNumber: document.querySelector('input[name=card_number]').value, 38 | brand: document.querySelector('input[name=card_brand]').value, 39 | cvv: document.querySelector('input[name=card_cvv]').value, 40 | expirationMonth: document.querySelector('input[name=card_month]').value, 41 | expirationYear: document.querySelector('input[name=card_year]').value, 42 | success: function(res) { 43 | proccessPayment(res.card.token, buttonTarget); 44 | }, 45 | error: function(err) { 46 | buttonTarget.disabled = false; 47 | buttonTarget.innerHTML = 'Efetuar Pagamento'; 48 | 49 | for(let i in err.errors) { 50 | document.querySelector('div.msg').innerHTML = showErrorMessages(errorsMapPagseguroJS(i)); 51 | } 52 | } 53 | }); 54 | }); -------------------------------------------------------------------------------- /resources/js/pagseguro_functions.js: -------------------------------------------------------------------------------- 1 | function proccessPayment(token, buttonTarget) 2 | { 3 | let data = { 4 | card_token: token, 5 | hash: PagSeguroDirectPayment.getSenderHash(), 6 | installment: document.querySelector('select.select_installments').value, 7 | card_name: document.querySelector('input[name=card_name]').value, 8 | _token: csrf 9 | }; 10 | 11 | $.ajax({ 12 | type: 'POST', 13 | url: urlProccess, 14 | data: data, 15 | dataType: 'json', 16 | success: function(res) { 17 | 18 | toastr.success(res.data.message, 'Sucesso'); 19 | window.location.href = `${urlThanks}?order=${res.data.order}`; 20 | }, 21 | error: function(err) { 22 | buttonTarget.disabled = false; 23 | buttonTarget.innerHTML = 'Efetuar Pagamento'; 24 | 25 | let message = JSON.parse(err.responseText); 26 | document.querySelector('div.msg').innerHTML = showErrorMessages(message.data.message.error.message); 27 | } 28 | }); 29 | } 30 | 31 | 32 | function getInstallments(amount, brand) { 33 | PagSeguroDirectPayment.getInstallments({ 34 | amount: amount, 35 | brand: brand, 36 | maxInstallmentNoInterest: 0, 37 | success: function(res) { 38 | let selectInstallments = drawSelectInstallments(res.installments[brand]); 39 | document.querySelector('div.installments').innerHTML = selectInstallments; 40 | }, 41 | error: function(err) { 42 | console.log(err); 43 | }, 44 | complete: function(res) { 45 | 46 | }, 47 | }) 48 | } 49 | 50 | function drawSelectInstallments(installments) { 51 | let select = ''; 52 | 53 | select += ''; 61 | 62 | return select; 63 | } 64 | 65 | function showErrorMessages(message) 66 | { 67 | return ` 68 |
${message}
69 | `; 70 | } 71 | 72 | function errorsMapPagseguroJS(code) 73 | { 74 | switch(code) { 75 | case "10000": 76 | return 'Bandeira do cartão inválida!'; 77 | break; 78 | 79 | case "10001": 80 | return 'Número do Cartão com tamanho inválido!'; 81 | break; 82 | 83 | case "10002": 84 | case "30405": 85 | return 'Data com formato inválido!'; 86 | break; 87 | 88 | case "10003": 89 | return 'Código de segurança inválido'; 90 | break; 91 | 92 | case "10004": 93 | return 'Código de segurança é obrigatório!'; 94 | break; 95 | 96 | case "10006": 97 | return 'Tamanho do código de segurança inválido!'; 98 | break; 99 | 100 | default: 101 | return 'Houve um erro na validação do seu cartão de crédito!'; 102 | } 103 | } -------------------------------------------------------------------------------- /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 | 'Your password has been reset!', 17 | 'sent' => 'We have e-mailed your password reset link!', 18 | 'token' => 'This password reset token is invalid.', 19 | 'user' => "We can't find a user with that e-mail address.", 20 | 21 | ]; 22 | -------------------------------------------------------------------------------- /resources/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | // Body 2 | $body-bg: #fff; 3 | 4 | // Typography 5 | $font-family-sans-serif: 'Roboto', sans-serif; 6 | $font-size-base: 0.9rem; 7 | $line-height-base: 1.6; 8 | 9 | // Colors 10 | $blue: #3490dc; 11 | $indigo: #6574cd; 12 | $purple: #9561e2; 13 | $pink: #f66d9b; 14 | $red: #e3342f; 15 | $orange: #f6993f; 16 | $yellow: #ffed4a; 17 | $green: #38c172; 18 | $teal: #4dc0b5; 19 | $cyan: #6cb2eb; 20 | -------------------------------------------------------------------------------- /resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | // Fonts 2 | @import url('https://fonts.googleapis.com/css?family=Roboto'); 3 | 4 | // Variables 5 | @import 'variables'; 6 | 7 | // Bootstrap 8 | @import '~bootstrap/scss/bootstrap'; 9 | -------------------------------------------------------------------------------- /resources/views/admin/categories/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 |

Criar Categoria

6 |
7 | 8 |
9 | 10 | 11 | 12 | @error('name') 13 |
14 | {{$message}} 15 |
16 | @enderror 17 |
18 | 19 |
20 | 21 | 22 | 23 | @error('description') 24 |
25 | {{$message}} 26 |
27 | @enderror 28 |
29 | 30 |
31 | 32 |
33 |
34 | @endsection -------------------------------------------------------------------------------- /resources/views/admin/categories/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 |

Atualizar Categoria

6 |
7 | @csrf 8 | @method("PUT") 9 | 10 |
11 | 12 | 13 | 14 | @error('name') 15 |
16 | {{$message}} 17 |
18 | @enderror 19 |
20 | 21 |
22 | 23 | 24 |
25 | 26 |
27 | 28 |
29 |
30 | @endsection -------------------------------------------------------------------------------- /resources/views/admin/categories/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 | 6 | Criar Categoria 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | @foreach($categories as $category) 18 | 19 | 20 | 21 | 31 | 32 | @endforeach 33 | 34 |
#NomeAções
{{$category->id}}{{$category->name}} 22 |
23 | EDITAR 24 |
25 | @csrf 26 | @method("DELETE") 27 | 28 |
29 |
30 |
35 | @endsection -------------------------------------------------------------------------------- /resources/views/admin/notifications.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 |
6 |
7 | Marcar todas como lidas! 8 |
9 |
10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | @forelse($unreadNotifications as $n) 21 | 22 | 23 | 24 | 29 | 30 | @empty 31 | 32 | 35 | 36 | @endforelse 37 | 38 |
NotificaçãoCriado emAções
{{$n->data['message']}}{{$n->created_at->locale('pt')->diffForHumans()}} 25 |
26 | Marcar como lida 27 |
28 |
33 |
Nenhuma notificação encontrada!
34 |
39 | @endsection -------------------------------------------------------------------------------- /resources/views/admin/orders/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |

Pedidos Recebidos

7 |
8 |
9 | 10 |
11 |
12 | @forelse($orders as $key => $order) 13 |
14 |
15 |

16 | 19 |

20 |
21 | 22 |
23 |
24 | 25 |
    26 | @php $items = unserialize($order->items); @endphp 27 | 28 | @foreach(filterItemsByStoreId($items, auth()->user()->store->id) as $item) 29 | 30 |
  • 31 | {{$item['name']}} | R$ {{number_format($item['price'] * $item['amount'], 2, ',', '.')}} 32 |
    33 | Quantidade pedida: {{$item['amount']}} 34 |
  • 35 | @endforeach 36 |
37 | 38 |
39 |
40 |
41 | @empty 42 |
Nenhum pedido recebido!
43 | @endforelse 44 |
45 | 46 |
47 |
48 | {{$orders->links()}} 49 |
50 |
51 |
52 | @endsection -------------------------------------------------------------------------------- /resources/views/admin/products/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 |

Criar Produto

6 |
7 | @csrf 8 | 9 |
10 | 11 | 12 | 13 | @error('name') 14 |
15 | {{$message}} 16 |
17 | @enderror 18 |
19 | 20 |
21 | 22 | 23 | 24 | @error('description') 25 |
26 | {{$message}} 27 |
28 | @enderror 29 |
30 | 31 |
32 | 33 | 34 | 35 | @error('body') 36 |
37 | {{$message}} 38 |
39 | @enderror 40 |
41 | 42 | 43 |
44 | 45 | 46 | 47 | @error('price') 48 |
49 | {{$message}} 50 |
51 | @enderror 52 |
53 | 54 |
55 | 56 | 61 |
62 | 63 |
64 | 65 | 66 | @error('photos.*') 67 |
68 | {{$message}} 69 |
70 | @enderror 71 |
72 | 73 |
74 | 75 |
76 |
77 | @endsection 78 | 79 | @section('scripts') 80 | 81 | 84 | @endsection 85 | -------------------------------------------------------------------------------- /resources/views/admin/products/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 |

Atualizar Produto

6 | 7 |
8 | @csrf 9 | @method("PUT") 10 | 11 |
12 | 13 | 14 | 15 | @error('name') 16 |
17 | {{$message}} 18 |
19 | @enderror 20 |
21 | 22 |
23 | 24 | 25 | 26 | @error('description') 27 |
28 | {{$message}} 29 |
30 | @enderror 31 |
32 | 33 |
34 | 35 | 36 | 37 | @error('body') 38 |
39 | {{$message}} 40 |
41 | @enderror 42 |
43 | 44 | 45 |
46 | 47 | 48 | 49 | @error('price') 50 |
51 | {{$message}} 52 |
53 | @enderror 54 |
55 | 56 |
57 | 58 | 65 |
66 | 67 |
68 | 69 | 70 | @error('photos') 71 |
72 | {{$message}} 73 |
74 | @enderror 75 |
76 |
77 | 78 |
79 |
80 | 81 |
82 | 83 |
84 | @foreach($product->photos as $photo) 85 |
86 | 87 | 88 |
89 | @csrf 90 | 91 | 92 | 93 |
94 |
95 | @endforeach 96 |
97 | @endsection 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /resources/views/admin/products/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 | Criar Produto 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | @foreach($products as $p) 19 | 20 | 21 | 22 | 23 | 24 | 34 | 35 | @endforeach 36 | 37 |
#NomePreçoLojaAções
{{$p->id}}{{$p->name}}R$ {{number_format($p->price, 2, ',', '.')}}{{$p->store->name}} 25 |
26 | EDITAR 27 |
28 | @csrf 29 | @method("DELETE") 30 | 31 |
32 |
33 |
38 | 39 | {{$products->links()}} 40 | @endsection -------------------------------------------------------------------------------- /resources/views/admin/stores/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 |

Criar Loja

6 |
7 | 8 |
9 | 10 | 11 | 12 | @error('name') 13 |
14 | {{$message}} 15 |
16 | @enderror 17 |
18 | 19 |
20 | 21 | 22 | 23 | @error('description') 24 |
25 | {{$message}} 26 |
27 | @enderror 28 |
29 | 30 |
31 | 32 | 33 | 34 | @error('phone') 35 |
36 | {{$message}} 37 |
38 | @enderror 39 |
40 | 41 |
42 | 43 | 44 | 45 | @error('mobile_phone') 46 |
47 | {{$message}} 48 |
49 | @enderror 50 |
51 | 52 |
53 | 54 | 55 | 56 | @error('logo') 57 |
58 | {{$message}} 59 |
60 | @enderror 61 |
62 | 63 |
64 | 65 |
66 |
67 | @endsection 68 | 69 | @section('scripts') 70 | 77 | @endsection -------------------------------------------------------------------------------- /resources/views/admin/stores/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 |

Criar Loja

6 |
7 | @csrf 8 | @method("PUT") 9 | 10 |
11 | 12 | 13 | 14 | @error('name') 15 |
16 | {{$message}} 17 |
18 | @enderror 19 |
20 | 21 |
22 | 23 | 24 | @error('description') 25 |
26 | {{$message}} 27 |
28 | @enderror 29 |
30 | 31 |
32 | 33 | 34 | 35 | @error('phone') 36 |
37 | {{$message}} 38 |
39 | @enderror 40 |
41 | 42 |
43 | 44 | 45 | 46 | @error('mobile_phone') 47 |
48 | {{$message}} 49 |
50 | @enderror 51 |
52 | 53 |
54 |

55 | 56 |

57 | 58 | 59 | 60 | @error('logo') 61 |
62 | {{$message}} 63 |
64 | @enderror 65 |
66 | 67 |
68 | 69 |
70 |
71 | @endsection -------------------------------------------------------------------------------- /resources/views/admin/stores/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 | @if(!$store) 6 | Criar Loja 7 | @else 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 32 | 33 | 34 |
#LojaTotal de ProdutosAções
{{$store->id}}{{$store->name}}{{$store->products->count()}} 23 |
24 | EDITAR 25 |
26 | @csrf 27 | @method("DELETE") 28 | 29 |
30 |
31 |
35 | @endif 36 | @endsection -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Login') }}
9 | 10 |
11 |
12 | @csrf 13 | 14 |
15 | 16 | 17 |
18 | 19 | 20 | @error('email') 21 | 22 | {{ $message }} 23 | 24 | @enderror 25 |
26 |
27 | 28 |
29 | 30 | 31 |
32 | 33 | 34 | @error('password') 35 | 36 | {{ $message }} 37 | 38 | @enderror 39 |
40 |
41 | 42 |
43 |
44 |
45 | 46 | 47 | 50 |
51 |
52 |
53 | 54 |
55 |
56 | 59 | 60 | @if (Route::has('password.request')) 61 | 62 | {{ __('Forgot Your Password?') }} 63 | 64 | @endif 65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | @endsection 74 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/confirm.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Confirm Password') }}
9 | 10 |
11 | {{ __('Please confirm your password before continuing.') }} 12 | 13 |
14 | @csrf 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | @error('password') 23 | 24 | {{ $message }} 25 | 26 | @enderror 27 |
28 |
29 | 30 |
31 |
32 | 35 | 36 | @if (Route::has('password.request')) 37 | 38 | {{ __('Forgot Your Password?') }} 39 | 40 | @endif 41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | @endsection 50 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/email.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Reset Password') }}
9 | 10 |
11 | @if (session('status')) 12 | 15 | @endif 16 | 17 |
18 | @csrf 19 | 20 |
21 | 22 | 23 |
24 | 25 | 26 | @error('email') 27 | 28 | {{ $message }} 29 | 30 | @enderror 31 |
32 |
33 | 34 |
35 |
36 | 39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection 48 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/reset.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Reset Password') }}
9 | 10 |
11 |
12 | @csrf 13 | 14 | 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | @error('email') 23 | 24 | {{ $message }} 25 | 26 | @enderror 27 |
28 |
29 | 30 |
31 | 32 | 33 |
34 | 35 | 36 | @error('password') 37 | 38 | {{ $message }} 39 | 40 | @enderror 41 |
42 |
43 | 44 |
45 | 46 | 47 |
48 | 49 |
50 |
51 | 52 |
53 |
54 | 57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | @endsection 66 | -------------------------------------------------------------------------------- /resources/views/auth/register.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Register') }}
9 | 10 |
11 |
12 | @csrf 13 | 14 |
15 | 16 | 17 |
18 | 19 | 20 | @error('name') 21 | 22 | {{ $message }} 23 | 24 | @enderror 25 |
26 |
27 | 28 |
29 | 30 | 31 |
32 | 33 | 34 | @error('email') 35 | 36 | {{ $message }} 37 | 38 | @enderror 39 |
40 |
41 | 42 |
43 | 44 | 45 |
46 | 47 | 48 | @error('password') 49 | 50 | {{ $message }} 51 | 52 | @enderror 53 |
54 |
55 | 56 |
57 | 58 | 59 |
60 | 61 |
62 |
63 | 64 |
65 |
66 | 69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | @endsection 78 | -------------------------------------------------------------------------------- /resources/views/auth/verify.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Verify Your Email Address') }}
9 | 10 |
11 | @if (session('resent')) 12 | 15 | @endif 16 | 17 | {{ __('Before proceeding, please check your email for a verification link.') }} 18 | {{ __('If you did not receive the email') }}, 19 |
20 | @csrf 21 | . 22 |
23 |
24 |
25 |
26 |
27 |
28 | @endsection 29 | -------------------------------------------------------------------------------- /resources/views/cart.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.front') 2 | 3 | 4 | @section('content') 5 |
6 |
7 |

Carrinho de Compras

8 |
9 |
10 |
11 | @if($cart) 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | @php $total = 0; @endphp 24 | 25 | @foreach($cart as $c) 26 | 27 | 28 | 29 | 30 | 31 | 32 | @php 33 | $subtotal = $c['price'] * $c['amount']; 34 | $total += $subtotal; 35 | @endphp 36 | 37 | 38 | 41 | 42 | 43 | @endforeach 44 | 45 | 46 | 47 | 48 | 49 | 50 |
ProdutoPreçoQuantidadeSubtotalAção
{{$c['name']}}R$ {{number_format($c['price'], 2, ',', '.')}}{{$c['amount']}}R$ {{number_format($subtotal, 2, ',', '.')}} 39 | REMOVER 40 |
Total: R$ {{number_format($total, 2, ',', '.')}}
51 |
52 | 56 | @else 57 |
Carrinho vazio...
58 | @endif 59 |
60 |
61 | 62 | @endsection -------------------------------------------------------------------------------- /resources/views/category.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.front') 2 | 3 | 4 | @section('content') 5 |
6 |
7 |

{{$category->name}}

8 |
9 |
10 | @forelse($category->products as $key => $product) 11 |
12 |
13 | @if($product->photos->count()) 14 | 15 | @else 16 | 17 | @endif 18 | 19 |
20 |

{{$product->name}}

21 |

22 | {{$product->description}} 23 |

24 |

25 | R$ {{number_format($product->price, '2', ',', '.')}} 26 |

27 | 28 | Ver Produto 29 | 30 |
31 |
32 |
33 | @if(($key + 1) % 3 == 0)
@endif 34 | @empty 35 |
36 |

Nenhum produto encontrado para esta categoria!

37 |
38 | @endforelse 39 |
40 | @endsection 41 | -------------------------------------------------------------------------------- /resources/views/checkout.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.front') 2 | 3 | @section('stylesheets') 4 | 5 | @endsection 6 | 7 | @section('content') 8 | 9 |
10 |
11 |
12 |
13 | 14 |
15 |
16 |
17 |
18 |

Dados para Pagamento

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 | @endsection 66 | 67 | @section('scripts') 68 | 69 | 70 | 71 | 80 | 81 | 82 | @endsection -------------------------------------------------------------------------------- /resources/views/emails/user-registered.blade.php: -------------------------------------------------------------------------------- 1 |

Olá, {{$user->name}}, tudo bem? Espero que sim!

2 | 3 |

Obrigado por sua inscrição!

4 | 5 |

6 | Faça bom proveito e excelentes compras em nosso marketplace!
7 | Seu email de cadastro é: {{$user->email}}
8 | Sua senha: Por questões de segurança não enviamos sua senha mas você deve se lembrar! 9 |

10 |
11 | Email enviado em {{date('d/m/Y H:i:s')}}. -------------------------------------------------------------------------------- /resources/views/layouts/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | Marketplace L6 9 | 10 | 11 | 12 | 13 | 62 | 63 |
64 | @include('flash::message') 65 | @yield('content') 66 |
67 | 68 | 69 | @yield('scripts') 70 | 71 | -------------------------------------------------------------------------------- /resources/views/layouts/front.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | Marketplace L6 9 | 10 | 11 | 16 | @yield('stylesheets') 17 | 18 | 19 | 70 | 71 |
72 | @include('flash::message') 73 | @yield('content') 74 |
75 | 76 | 77 | @yield('scripts') 78 | 79 | -------------------------------------------------------------------------------- /resources/views/single.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.front') 2 | 3 | 4 | @section('content') 5 |
6 |
7 | @if($product->photos->count()) 8 | 9 |
10 | @foreach($product->photos as $photo) 11 |
12 | 13 |
14 | @endforeach 15 |
16 | @else 17 | 18 | @endif 19 |
20 | 21 |
22 |
23 |

{{$product->name}}

24 |

25 | {{$product->description}} 26 |

27 | 28 |

29 | R$ {{number_format($product->price, '2', ',', '.')}} 30 |

31 | 32 | 33 | Loja: {{$product->store->name}} 34 | 35 |
36 | 37 |
38 |
39 | 40 |
41 | @csrf 42 | 43 | 44 | 45 |
46 | 47 | 48 |
49 | 50 |
51 |
52 |
53 |
54 | 55 |
56 |
57 |
58 | {{$product->body}} 59 |
60 |
61 | @endsection 62 | 63 | @section('scripts') 64 | 74 | @endsection -------------------------------------------------------------------------------- /resources/views/store.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.front') 2 | 3 | 4 | @section('content') 5 |
6 |
7 | @if($store->logo) 8 | Logo da Loja {{$store->name}} 9 | @else 10 | Loja sem logo... 11 | @endif 12 |
13 | 14 |
15 |

{{$store->name}}

16 |

{{$store->description}}

17 |

18 | Contatos: 19 | {{$store->phone}} | {{$store->mobile_phone}} 20 |

21 |
22 | 23 |
24 |
25 |

Produtos desta loja

26 |
27 | @forelse($store->products as $key => $product) 28 |
29 |
30 | @if($product->photos->count()) 31 | 32 | @else 33 | 34 | @endif 35 | 36 |
37 |

{{$product->name}}

38 |

39 | {{$product->description}} 40 |

41 |

42 | R$ {{number_format($product->price, '2', ',', '.')}} 43 |

44 | 45 | Ver Produto 46 | 47 |
48 |
49 |
50 | @if(($key + 1) % 3 == 0)
@endif 51 | @empty 52 |
53 |

Nenhum produto encontrado para esta loja!

54 |
55 | @endforelse 56 |
57 | @endsection 58 | -------------------------------------------------------------------------------- /resources/views/thanks.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.front') 2 | 3 | 4 | @section('content') 5 |

6 | Muito obrigado por sua compra! 7 |

8 |

9 | Seu pedido foi processado, código do pedido: {{request()->get('order')}}. 10 |

11 | @endsection -------------------------------------------------------------------------------- /resources/views/user-orders.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.front') 2 | 3 | @section('content') 4 |
5 |
6 |

Meus Pedidos

7 |
8 |
9 | 10 |
11 |
12 | @forelse($userOrders as $key => $order) 13 |
14 |
15 |

16 | 19 |

20 |
21 | 22 |
23 |
24 | 25 |
    26 | @php $items = unserialize($order->items); @endphp 27 | 28 | @foreach($items as $item) 29 | 30 |
  • 31 | {{$item['name']}} | R$ {{number_format($item['price'] * $item['amount'], 2, ',', '.')}} 32 |
    33 | Quantidade pedida: {{$item['amount']}} 34 |
  • 35 | @endforeach 36 |
37 | 38 |
39 |
40 |
41 | @empty 42 |
Nenhum pedido recebido!
43 | @endforelse 44 |
45 | 46 |
47 |
48 | {{$userOrders->links()}} 49 |
50 |
51 |
52 | @endsection -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.front') 2 | 3 | 4 | @section('content') 5 |
6 | @foreach($products as $key => $product) 7 |
8 |
9 | @if($product->photos->count()) 10 | 11 | @else 12 | 13 | @endif 14 | 15 |
16 |

{{$product->name}}

17 |

18 | {{$product->description}} 19 |

20 |

21 | R$ {{number_format($product->price, '2', ',', '.')}} 22 |

23 | 24 | Ver Produto 25 | 26 |
27 |
28 |
29 | @if(($key + 1) % 3 == 0)
@endif 30 | @endforeach 31 |
32 | 33 |
34 |
35 |

Lojas Destaque

36 |
37 |
38 | @foreach($stores as $store) 39 |
40 | @if($store->logo) 41 | Logo da Loja {{$store->name}} 42 | @else 43 | Loja sem logo... 44 | @endif 45 | 46 |

{{$store->name}}

47 |

48 | {{$store->description}} 49 |

50 | Ver Loja 51 |
52 | @endforeach 53 |
54 | @endsection 55 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 17 | return $request->user(); 18 | }); 19 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 16 | }); 17 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 18 | })->describe('Display an inspiring quote'); 19 | -------------------------------------------------------------------------------- /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 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Mix Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Mix provides a clean, fluent API for defining some Webpack build steps 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for the application as well as bundling up all the JS files. 11 | | 12 | */ 13 | 14 | mix.js('resources/js/app.js', 'public/js') 15 | .sass('resources/sass/app.scss', 'public/css'); 16 | 17 | mix.copy('resources/js/pagseguro_functions.js', 'public/js') 18 | .copy('resources/js/pagseguro_events.js', 'public/js'); --------------------------------------------------------------------------------