├── .env.example
├── .gitattributes
├── .gitignore
├── .travis.yml
├── LICENSE
├── Procfile
├── app
├── Address.php
├── Assignment.php
├── Category.php
├── City.php
├── Console
│ └── Kernel.php
├── Contact.php
├── Country.php
├── District.php
├── Exceptions
│ └── Handler.php
├── Http
│ ├── Controllers
│ │ ├── Admin
│ │ │ ├── AddressController.php
│ │ │ ├── AdminController.php
│ │ │ ├── CategoryController.php
│ │ │ ├── CityController.php
│ │ │ ├── ContactController.php
│ │ │ ├── CountryController.php
│ │ │ ├── DistrictController.php
│ │ │ ├── OrderController.php
│ │ │ ├── ProductController.php
│ │ │ ├── RoleController.php
│ │ │ ├── ShopController.php
│ │ │ ├── ShopImageController.php
│ │ │ ├── TypeController.php
│ │ │ └── UserController.php
│ │ ├── Auth
│ │ │ ├── ForgotPasswordController.php
│ │ │ ├── LoginController.php
│ │ │ ├── RegisterController.php
│ │ │ └── ResetPasswordController.php
│ │ ├── CartController.php
│ │ ├── CategoryController.php
│ │ ├── CityController.php
│ │ ├── Controller.php
│ │ ├── DistrictController.php
│ │ ├── HomeController.php
│ │ ├── OrderController.php
│ │ ├── ProductController.php
│ │ ├── ShopsController.php
│ │ ├── TypeController.php
│ │ └── UserController.php
│ ├── Kernel.php
│ └── Middleware
│ │ ├── EncryptCookies.php
│ │ ├── RedirectIfAuthenticated.php
│ │ ├── TrimStrings.php
│ │ └── VerifyCsrfToken.php
├── Order.php
├── OrderProduct.php
├── Product.php
├── ProductImage.php
├── Providers
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── BroadcastServiceProvider.php
│ ├── ComposerServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
├── Role.php
├── Shop.php
├── ShopAssignment.php
├── ShopImage.php
├── Type.php
└── User.php
├── artisan
├── bootstrap
├── app.php
├── autoload.php
└── cache
│ └── .gitignore
├── composer.json
├── composer.lock
├── config
├── app.php
├── auth.php
├── broadcasting.php
├── cache.php
├── database.php
├── filesystems.php
├── mail.php
├── queue.php
├── services.php
├── session.php
└── view.php
├── database
├── .gitignore
├── database.sqlite
├── factories
│ └── ModelFactory.php
├── migrations
│ ├── 2014_10_12_000000_create_users_table.php
│ ├── 2014_10_12_100000_create_password_resets_table.php
│ ├── 2017_04_19_153944_create_products_table.php
│ ├── 2017_05_04_051025_create_type_table.php
│ ├── 2017_05_04_112830_create_countries_table.php
│ ├── 2017_05_04_113558_create_cities_table.php
│ ├── 2017_05_04_123741_create_addresses_table.php
│ ├── 2017_05_05_102043_create_shop-assignment_table.php
│ ├── 2017_05_05_164904_create_shop_image_table.php
│ ├── 2017_05_06_105345_create_shops_table.php
│ ├── 2017_05_06_130158_create_categories_table.php
│ ├── 2017_05_08_025322_update2_users_table.php
│ ├── 2017_05_08_031851_create_order_products_table.php
│ ├── 2017_05_08_064821_create_product_images_table.php
│ ├── 2017_05_08_072914_create_orders_table.php
│ ├── 2017_05_08_073235_remove_name_column_users_table.php
│ ├── 2017_05_08_123841_create_roles_table.php
│ ├── 2017_05_08_125303_create_assignments_table.php
│ ├── 2017_05_08_130412_create_contacts_table.php
│ ├── 2017_05_08_133633_create_districts_table.php
│ ├── 2017_05_08_172525_update_cities_table.php
│ ├── 2017_05_09_033721_create_productimages_references_table.php
│ ├── 2017_05_09_035923_create_orderproduct_references_table.php
│ ├── 2017_05_09_053408_create_references_shops_table.php
│ ├── 2017_05_09_111500_create_products_references_table.php
│ ├── 2017_05_09_111552_create_categories_references_table.php
│ ├── 2017_05_09_113924_create-relationship-for-assignments-table.php
│ ├── 2017_05_09_114013_create_orders_references_table.php
│ ├── 2017_05_10_020945_create_relationship_for_addresses_table.php
│ ├── 2017_05_10_023647_create_foreign_for_districts_table.php
│ ├── 2017_05_10_031928_create_foreign_for_cities_table.php
│ ├── 2017_05_10_094533_create_references_shopimages_table.php
│ ├── 2017_05_10_095758_create_references_shopassignments_table.php
│ └── 2017_05_11_020808_update_data_type_price_column_table.php
└── seeds
│ ├── AddressesTableSeeder.php
│ ├── AssignmentsTableSeeder.php
│ ├── CategoriesTableSeeder.php
│ ├── CitiesTableSeeder.php
│ ├── ContactsTableSeeder.php
│ ├── CountriesTableSeeder.php
│ ├── DatabaseSeeder.php
│ ├── DistrictsTableSeeder.php
│ ├── OrderProductsTableSeeder.php
│ ├── OrdersTableSeeder.php
│ ├── ProductImagesTableSeeder.php
│ ├── ProductsTableSeeder.php
│ ├── RolesTableSeeder.php
│ ├── ShopAssignmentsTableSeeder.php
│ ├── ShopImagesTableSeeder.php
│ ├── ShopsTableSeeder.php
│ ├── TypesTableSeeder.php
│ └── UsersTableSeeder.php
├── package.json
├── phpcs.xml
├── phpmd.xml
├── phpunit.xml
├── public
├── .htaccess
├── css
│ ├── app.css
│ └── bootstrap.min.css
├── favicon.ico
├── fonts
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ └── glyphicons-halflings-regular.woff2
├── index.php
├── js
│ └── app.js
├── robots.txt
├── upload
│ └── default.jpg
└── web.config
├── readme.md
├── resources
├── assets
│ ├── js
│ │ ├── app.js
│ │ ├── bootstrap.js
│ │ └── components
│ │ │ └── Example.vue
│ └── sass
│ │ ├── _variables.scss
│ │ └── app.scss
├── lang
│ └── en
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
└── views
│ ├── admin
│ ├── addresses
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── categories
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── cities
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── contacts
│ │ └── index.blade.php
│ ├── countries
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── districts
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── index.blade.php
│ ├── orders
│ │ ├── index.blade.php
│ │ └── show.blade.php
│ ├── products
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── roles
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── shopimages
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── shops
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── types
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ └── users
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── auth
│ ├── login.blade.php
│ ├── passwords
│ │ ├── email.blade.php
│ │ └── reset.blade.php
│ └── register.blade.php
│ ├── carts
│ └── cart.blade.php
│ ├── categories
│ └── show.blade.php
│ ├── home.blade.php
│ ├── layouts
│ ├── admin.blade.php
│ └── app.blade.php
│ ├── orders
│ ├── order.blade.php
│ └── orderInformation.blade.php
│ ├── partials
│ └── products
│ │ └── product.blade.php
│ ├── products
│ └── productsDetail.blade.php
│ ├── registerShops.blade.php
│ ├── types
│ └── show.blade.php
│ ├── users
│ └── usersDetail.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
│ ├── sessions
│ │ └── .gitignore
│ ├── testing
│ │ └── .gitignore
│ └── views
│ │ └── .gitignore
└── logs
│ └── .gitignore
├── tests
├── CreatesApplication.php
├── Feature
│ └── ExampleTest.php
├── TestCase.php
└── Unit
│ └── ExampleTest.php
└── webpack.mix.js
/.env.example:
--------------------------------------------------------------------------------
1 | APP_NAME=Laravel
2 | APP_ENV=local
3 | APP_KEY=
4 | APP_DEBUG=true
5 | APP_LOG_LEVEL=debug
6 | APP_URL=http://localhost
7 |
8 | DB_CONNECTION=mysql
9 | DB_HOST=127.0.0.1
10 | DB_PORT=3306
11 | DB_DATABASE=homestead
12 | DB_USERNAME=homestead
13 | DB_PASSWORD=secret
14 |
15 | BROADCAST_DRIVER=log
16 | CACHE_DRIVER=file
17 | SESSION_DRIVER=file
18 | QUEUE_DRIVER=sync
19 |
20 | REDIS_HOST=127.0.0.1
21 | REDIS_PASSWORD=null
22 | REDIS_PORT=6379
23 |
24 | MAIL_DRIVER=smtp
25 | MAIL_HOST=smtp.mailtrap.io
26 | MAIL_PORT=2525
27 | MAIL_USERNAME=null
28 | MAIL_PASSWORD=null
29 | MAIL_ENCRYPTION=null
30 |
31 | PUSHER_APP_ID=
32 | PUSHER_APP_KEY=
33 | PUSHER_APP_SECRET=
34 |
--------------------------------------------------------------------------------
/.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 | /.idea
7 | /.vagrant
8 | Homestead.json
9 | Homestead.yaml
10 | npm-debug.log
11 | .env
12 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 |
3 | php:
4 | - 7.0
5 |
6 | before_script:
7 | - composer self-update
8 | - composer install
9 |
10 | script:
11 | - ./vendor/bin/phpcs --standard=./phpcs.xml --ignore=*.blade.php,*.config.php,*.twig.php,./vendor,./database,./storage,./bootstrap .
12 | - ./vendor/bin/phpmd . text ./phpmd.xml --exclude vendor,database,storage,bootstrap,app/Console/Kernel,app/Exceptions/Handler
13 | - cp .env.example .env
14 | - sed -i -e "s/^DB_CONNECTION.*/DB_CONNECTION=sqlite/" .env
15 | - sed -i -e "/^DB_DATABASE.*/d" .env
16 | - php artisan key:generate
17 | - php artisan migrate
18 |
19 | notifications:
20 | on_success: always
21 | on_failure: always
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 PHP Software Development
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: vendor/bin/heroku-php-apache2 public
2 |
--------------------------------------------------------------------------------
/app/Address.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\User');
22 | }
23 |
24 | public function country()
25 | {
26 | return $this->belongsTo('App\Country');
27 | }
28 |
29 | public function city()
30 | {
31 | return $this->belongsTo('App\City');
32 | }
33 |
34 | public function district()
35 | {
36 | return $this->belongsTo('App\District');
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/Assignment.php:
--------------------------------------------------------------------------------
1 | belongsTo('app\Role');
14 | }
15 |
16 | public function user()
17 | {
18 | return $this->belongsTo('app\User');
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/Category.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\Type');
14 | }
15 |
16 | public function products($options = [])
17 | {
18 | $relation = $this->hasMany('App\Product');
19 |
20 | if (!empty($options['newest'])) {
21 | $relation = $relation->orderBy('id', 'desc');
22 | }
23 | if (!empty($options['limit'])) {
24 | $relation = $relation->take($options['limit']);
25 | }
26 |
27 | if (!empty($options['similar'])) {
28 | $relation = $relation->where('id', '<>', $options['similar']);
29 | }
30 |
31 | return $relation->get();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/City.php:
--------------------------------------------------------------------------------
1 | hasMany('App\Order');
14 | }
15 |
16 | public function districts()
17 | {
18 | return $this->hasMany('App\District');
19 | }
20 |
21 | public function country()
22 | {
23 | return $this->belongsTo('App\Country');
24 | }
25 |
26 | public function shops()
27 | {
28 | return $this->hasMany('App\Shop');
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')
28 | // ->hourly();
29 | }
30 |
31 | /**
32 | * Register the Closure based commands for the application.
33 | *
34 | * @return void
35 | */
36 | protected function commands()
37 | {
38 | require base_path('routes/console.php');
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/Contact.php:
--------------------------------------------------------------------------------
1 | hasMany('App\Order');
14 | }
15 |
16 | public function addresses()
17 | {
18 | return $this->hasMany('App\Address');
19 | }
20 |
21 | public function cities()
22 | {
23 | return $this->hasMany('App\City');
24 | }
25 |
26 | public function shops()
27 | {
28 | return $this->hasMany('App\Shop');
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/District.php:
--------------------------------------------------------------------------------
1 | hasMany('App\Order');
14 | }
15 |
16 | public function addresses()
17 | {
18 | return $this->hasMany('App\Address');
19 | }
20 |
21 | public function city()
22 | {
23 | return $this->belongsTo('App\City');
24 | }
25 |
26 | public function shops()
27 | {
28 | return $this->hasMany('App\Shop');
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/Exceptions/Handler.php:
--------------------------------------------------------------------------------
1 | expectsJson()) {
60 | return response()->json(['error' => 'Unauthenticated.'], 401);
61 | }
62 |
63 | return redirect()->guest(route('login'));
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/AdminController.php:
--------------------------------------------------------------------------------
1 | with('categories', $categories);
17 | }
18 |
19 | public function create()
20 | {
21 | $types = Type::pluck('name', 'id');
22 | return view('admin.categories.create')->with('types', $types);
23 | }
24 |
25 | public function store(Request $request)
26 | {
27 | $this->validate($request, [
28 | 'name' => 'required|max:255|min:3',
29 | 'type_id' => 'required|numeric|exists:types,id'
30 | ]);
31 | Category::create(Input::all());
32 | return redirect()->route('adminCategories');
33 | }
34 |
35 | public function edit($id)
36 | {
37 |
38 | $category = Category::findOrFail($id);
39 | $types = Type::pluck('name', 'id');
40 | return view('admin.categories.edit')->with('category', $category)->with('types', $types);
41 | }
42 |
43 | public function update(Request $request, $id)
44 | {
45 | $this->validate($request, [
46 | 'name' => 'required|max:255|min:3',
47 | 'type_id' => 'required|numeric|exists:types,id'
48 | ]);
49 | $category = Category::findOrFail($id);
50 | $category->update(Input::all());
51 | return redirect()->route('adminCategories');
52 | }
53 |
54 | public function destroy($id)
55 | {
56 | Category::destroy($id);
57 | return redirect()->route('adminCategories');
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/CityController.php:
--------------------------------------------------------------------------------
1 | with('cities', $cities);
16 | }
17 |
18 | public function create()
19 | {
20 | $countries = Country::pluck('name', 'id');
21 | return view('admin.cities.create')->with('countries', $countries);
22 | }
23 |
24 | public function store(Request $request)
25 | {
26 | $this->validate($request, [
27 | 'name' => 'required|unique:cities|max:255',
28 | 'country_id' => 'required|numeric|exists:countries,id',
29 | ]);
30 |
31 | City::create($request->all());
32 | return redirect()->route('adminCities');
33 | }
34 |
35 | public function edit($id)
36 | {
37 | $city = City::findOrFail($id);
38 | $countries = Country::pluck('name', 'id');
39 | return view('admin.cities.edit')->with('city', $city)->with('countries', $countries);
40 | }
41 |
42 | public function update(Request $request, $id)
43 | {
44 | $this->validate($request, [
45 | 'name' => 'required|unique:cities,name,'.$id,
46 | 'country_id' => 'required|numeric|exists:countries,id',
47 | ]);
48 |
49 | $city = City::findOrFail($id);
50 | $city->update($request->all());
51 | return redirect()->route('adminCities');
52 | }
53 |
54 | public function destroy($id)
55 | {
56 | City::destroy($id);
57 | return redirect()->route('adminCities');
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/ContactController.php:
--------------------------------------------------------------------------------
1 | with('contacts', $contacts);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/CountryController.php:
--------------------------------------------------------------------------------
1 | with('countries', $countries);
15 | }
16 |
17 | public function create()
18 | {
19 | return view('admin.countries.create');
20 | }
21 |
22 | public function store(Request $request)
23 | {
24 | $this->validate($request, [
25 | 'name' => 'required|unique:countries|max:255',
26 | ]);
27 |
28 | Country::create($request->all());
29 |
30 | return redirect()->route('adminCountries');
31 | }
32 |
33 | public function edit($id)
34 | {
35 | $country = Country::findOrFail($id);
36 | return view('admin.countries.edit')->with('country', $country);
37 | }
38 |
39 | public function update(Request $request, $id)
40 | {
41 | $this->validate($request, [
42 | 'name' => 'required|unique:countries,name,'.$id,
43 | ]);
44 |
45 | $country = Country::findOrFail($id);
46 | $country->update($request->all());
47 | return redirect()->route('adminCountries');
48 | }
49 |
50 | public function destroy($id)
51 | {
52 | Country::destroy($id);
53 | return redirect()->route('adminCountries');
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/DistrictController.php:
--------------------------------------------------------------------------------
1 | with('districts', $districts);
16 | }
17 |
18 | public function create()
19 | {
20 | $cities = City::pluck('name', 'id');
21 | return view('admin.districts.create')->with('cities', $cities);
22 | }
23 |
24 | public function store(Request $request)
25 | {
26 | $this->validate($request, [
27 | 'name' => 'required|unique:districts|max:255',
28 | 'city_id' => 'required|numeric|exists:cities,id',
29 | ]);
30 |
31 | District::create($request->all());
32 |
33 | return redirect()->route('adminDistricts');
34 | }
35 |
36 | public function edit($id)
37 | {
38 | $cities = City::pluck('name', 'id');
39 | $district = District::findOrFail($id);
40 | return view('admin.districts.edit')->with('district', $district)
41 | ->with('cities', $cities);
42 | }
43 |
44 | public function update(Request $request, $id)
45 | {
46 | $this->validate($request, [
47 | 'name' => 'required|unique:districts,name,'.$id,
48 | 'city_id' => 'required|numeric|exists:cities,id',
49 | ]);
50 |
51 | $district = District::findOrFail($id);
52 | $district->update($request->all());
53 | return redirect()->route('adminDistricts');
54 | }
55 |
56 | public function destroy($id)
57 | {
58 | District::destroy($id);
59 | return redirect()->route('adminDistricts');
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/OrderController.php:
--------------------------------------------------------------------------------
1 | with('orders', $orders);
15 | }
16 |
17 | public function show($id)
18 | {
19 | $order = Order::findOrFail($id);
20 | $status = $order->status;
21 | $total_amount = 0;
22 | foreach ($order->orderProducts as $product) {
23 | $amount = $product->price*$product->quantity;
24 | $total_amount = $amount + $total_amount;
25 | }
26 | return view('admin.orders.show')
27 | ->with('order', $order)
28 | ->with('status', $status)
29 | ->with('total_amount', $total_amount);
30 | }
31 |
32 | public function edit(Request $request, $id)
33 | {
34 | $order = Order::findOrFail($id);
35 | $order->update($request->all());
36 | return redirect()->route('adminOrdersShow', ['id' => $id]);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/RoleController.php:
--------------------------------------------------------------------------------
1 | with('roles', $roles);
15 | }
16 |
17 | public function create()
18 | {
19 | return view('admin.roles.create');
20 | }
21 | public function store(Request $request)
22 | {
23 | $this->validate($request, [
24 | 'name' => 'required|unique:roles|max:255',
25 | 'description' => 'required'
26 | ]);
27 | Role::create($request->all());
28 | return redirect()->route('adminRoles');
29 | }
30 |
31 | public function edit($id)
32 | {
33 | $role = Role::findOrFail($id);
34 | return view('admin.roles.edit')->with('role', $role);
35 | }
36 |
37 | public function update(Request $request, $id)
38 | {
39 | $this->validate($request, [
40 | 'name' => 'required|unique:roles,name,'.$id,
41 | 'description' => 'required'
42 | ]);
43 |
44 | $role = Role::findOrFail($id);
45 | $role->update($request->all());
46 |
47 | return redirect()->route('adminRoles');
48 | }
49 |
50 | public function destroy($id)
51 | {
52 | Role::destroy($id);
53 | return redirect()->route('adminRoles');
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/ShopImageController.php:
--------------------------------------------------------------------------------
1 | with('shopImages', $shopImages);
17 | }
18 |
19 | public function create()
20 | {
21 | $shops = Shop::pluck('name', 'id');
22 | return view('admin.shopImages.create')->with('shops', $shops);
23 | }
24 |
25 | public function store(Request $request)
26 | {
27 | $this->validate($request, [
28 | 'shop_id' => 'required|numeric|exists:shops,id',
29 | 'photo' => 'image'
30 | ]);
31 | $data = $request->all();
32 | $file = $request->file('photo');
33 | $shopName = Shop::findOrFail($data['shop_id'])->name;
34 | if (!empty($file)) {
35 | $data['image'] = str_slug(Carbon::now().'_'.$shopName.'.'.$file->getClientOriginalExtension());
36 | $file->move('upload', $data['image']);
37 | } else {
38 | $data['image'] = 'default.jpg';
39 | }
40 | ShopImage::create($data);
41 | return redirect()->route('adminShopImages');
42 | }
43 |
44 | public function edit($id)
45 | {
46 | $shopimage = ShopImage::findOrFail($id);
47 | $shops = Shop::pluck('name', 'id');
48 | return view('admin.shopImages.edit')
49 | ->with('shops', $shops)
50 | ->with('shopimage', $shopimage);
51 | }
52 |
53 | public function update(Request $request, $id)
54 | {
55 | $this->validate($request, [
56 | 'shop_id' => 'required|numeric|exists:shops,id',
57 | 'photo' => 'image'
58 | ]);
59 | $data = $request->all();
60 | $file = $request->file('photo');
61 | $shopName = Shop::findOrFail($data['shop_id'])->name;
62 | if (!empty($file)) {
63 | $data['image'] = str_slug(Carbon::now().'_'.$shopName.'.'.$file->getClientOriginalExtension());
64 | $file->move('upload', $data['image']);
65 | }
66 | $shopimage = ShopImage::findOrFail($id);
67 | $shopimage->update($data);
68 | return redirect('admin/shopImages');
69 | }
70 | public function destroy($id)
71 | {
72 | ShopImage::destroy($id);
73 | return redirect('admin/shopImages');
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/TypeController.php:
--------------------------------------------------------------------------------
1 | with('types', $types);
15 | }
16 |
17 | public function create()
18 | {
19 | return view('admin.types.create');
20 | }
21 |
22 | public function store(Request $request)
23 | {
24 | $this->validate($request, [
25 | 'name' => 'required|unique:types|max:255',
26 | ]);
27 |
28 | Type::create($request->all());
29 | return redirect()->route('adminTypes');
30 | }
31 |
32 | public function edit($id)
33 | {
34 | $types = Type::findOrFail($id);
35 | return view('admin.types.edit')->with('types', $types);
36 | }
37 |
38 | public function update(Request $request, $id)
39 | {
40 | $this->validate($request, [
41 | 'name' => 'required|unique:countries,name,'.$id,
42 | ]);
43 |
44 | $types = Type::findOrFail($id);
45 | $types->update($request->all());
46 | return redirect()->route('adminTypes');
47 | }
48 |
49 | public function destroy($id)
50 | {
51 | Type::destroy($id);
52 | return redirect()->route('adminTypes');
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/ForgotPasswordController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/LoginController.php:
--------------------------------------------------------------------------------
1 | middleware('guest')->except('logout');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/RegisterController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
42 | }
43 |
44 | /**
45 | * Get a validator for an incoming registration request.
46 | *
47 | * @param array $data
48 | * @return \Illuminate\Contracts\Validation\Validator
49 | */
50 | protected function validator(array $data)
51 | {
52 | return Validator::make($data, [
53 | 'first_name' => 'required|string|max:255',
54 | 'last_name' => 'required|string|max:255',
55 | 'email' => 'required|string|email|max:255|unique:users',
56 | 'password' => 'required|string|min:6|confirmed',
57 | 'phone_number' => 'required|min:10|numeric',
58 | 'date_of_birth' => 'required|date',
59 | 'address' => 'required|string|max:255',
60 | ]);
61 | }
62 |
63 | /**
64 | * Create a new user instance after a valid registration.
65 | *
66 | * @param array $data
67 | * @return User
68 | */
69 | protected function create(array $data)
70 | {
71 | return User::create([
72 | 'first_name' => $data['first_name'],
73 | 'last_name' => $data['last_name'],
74 | 'email' => $data['email'],
75 | 'password' => bcrypt($data['password']),
76 | 'phone_number' => $data['phone_number'],
77 | 'date_of_birth' => $data['date_of_birth'],
78 | 'address' => $data['address'],
79 | ]);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/ResetPasswordController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/Http/Controllers/CartController.php:
--------------------------------------------------------------------------------
1 | validate($request, [
14 | 'qty' => 'required|numeric'
15 | ]);
16 | $data = $request->all();
17 | $data['options'] = ['image' => $request['image']];
18 | Cart::add($data);
19 | return redirect()->route('cartShow');
20 | }
21 |
22 | public function show()
23 | {
24 | $carts = Cart::content();
25 | return view('carts.cart')
26 | ->with('carts', $carts);
27 | }
28 |
29 | public function delete($rowId)
30 | {
31 | Cart::remove($rowId);
32 | return redirect()->route('cartShow');
33 | }
34 |
35 | public function update(Request $request, $rowId)
36 | {
37 | $this->validate($request, [
38 | 'qty' => 'required|numeric'
39 | ]);
40 | $qty = $request['qty'];
41 | Cart::update($rowId, $qty);
42 | return redirect()->route('cartShow');
43 | }
44 |
45 | public function error($error)
46 | {
47 | $carts = Cart::content();
48 | return view('carts.cart')
49 | ->with('error', $error)
50 | ->with('carts', $carts);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/Http/Controllers/CategoryController.php:
--------------------------------------------------------------------------------
1 | with('category', $category);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/Http/Controllers/CityController.php:
--------------------------------------------------------------------------------
1 | id)->get();
14 | $districts = District::where('city_id', $cities[0]['id'])->get();
15 | $cities['districts'] = $districts;
16 | return $cities;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | id)->get();
13 | return $districts;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/Http/Controllers/HomeController.php:
--------------------------------------------------------------------------------
1 | with('types', $types);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/Http/Controllers/OrderController.php:
--------------------------------------------------------------------------------
1 | route('cartError', ['error' => $error]);
21 | }
22 | $carts = Cart::content();
23 | $countries = Country::pluck('name', 'id');
24 | return view('orders.order')
25 | ->with('carts', $carts)
26 | ->with('countries', $countries);
27 | }
28 |
29 | public function store(Request $request)
30 | {
31 | $this->validate($request, [
32 | 'shipping_name' => 'required|max:100',
33 | 'shipping_address' => 'required|max:255',
34 | 'shipping_email' => 'required|email|max:255',
35 | 'shipping_phone' => 'required|max:20',
36 | 'city_id' => 'required|numeric|exists:cities,id',
37 | 'district_id' => 'required|numeric|exists:districts,id',
38 | 'country_id' => 'required|numeric|exists:countries,id',
39 | ]);
40 |
41 | if (Cart::count() == 0) {
42 | $error = "Cart is empty! Please add products.";
43 | return redirect()->route('cartError', ['error' => $error]);
44 | }
45 | $order_id = mt_rand();
46 | $data = $request->all();
47 | $data['id'] = $order_id;
48 | unset($data['_token']);
49 | if (!Auth::guest()) {
50 | $data['user_id'] = Auth::user()->id;
51 | }
52 | Order::insert($data);
53 | OrderProduct::store($order_id);
54 | Cart::destroy();
55 | return redirect()->route('orderInformation', [
56 | 'order_id' => $order_id]);
57 | }
58 |
59 | public function orderInformation($order_id)
60 | {
61 | $order = Order::findOrFail($order_id);
62 | $subtotal = $order->subtotal();
63 | return view('orders.orderInformation')
64 | ->with('order', $order)
65 | ->with('subtotal', $subtotal);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/Http/Controllers/ProductController.php:
--------------------------------------------------------------------------------
1 | with('product', $product);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/Http/Controllers/ShopsController.php:
--------------------------------------------------------------------------------
1 | where('id', Auth::user()->id)->first();
22 | $cities = City::pluck('name', 'id');
23 | $countries = Country::pluck('name', 'id');
24 | $districts = District::pluck('name', 'id');
25 | return view('registerShops')
26 | ->with('cities', $cities)
27 | ->with('countries', $countries)
28 | ->with('districts', $districts)
29 | ->with('users', $users)
30 | ->with('types', $types);
31 | }
32 |
33 | public function store(Request $request)
34 | {
35 | $this->validate($request, [
36 | 'name' => 'required|max:255',
37 | 'type_id' => 'required|numeric|exists:types,id',
38 | 'city_id' => 'required|numeric|exists:cities,id',
39 | 'district_id' => 'required|numeric|exists:districts,id',
40 | 'country_id' => 'required|numeric|exists:countries,id',
41 | 'description' => 'required',
42 | 'photo' => 'image'
43 | ]);
44 | $data = $request->all();
45 | $data['status'] = 0;
46 | $data['user_id'] = Auth::user()->id;
47 | $file = $request->file('photo');
48 | if (!empty($file)) {
49 | $data['image'] = str_slug(Carbon::now().'_'.$data['name'].'.'.$file->getClientOriginalExtension());
50 | $file->move('upload', $data['image']);
51 | } else {
52 | $data['image'] = 'default.jpg';
53 | }
54 | Shop::create($data);
55 | return redirect()->route('adminShops');
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/Http/Controllers/TypeController.php:
--------------------------------------------------------------------------------
1 | with('type', $type);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/Http/Controllers/UserController.php:
--------------------------------------------------------------------------------
1 | with('user', $user);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/Http/Kernel.php:
--------------------------------------------------------------------------------
1 | [
30 | \App\Http\Middleware\EncryptCookies::class,
31 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
32 | \Illuminate\Session\Middleware\StartSession::class,
33 | // \Illuminate\Session\Middleware\AuthenticateSession::class,
34 | \Illuminate\View\Middleware\ShareErrorsFromSession::class,
35 | \App\Http\Middleware\VerifyCsrfToken::class,
36 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
37 | ],
38 |
39 | 'api' => [
40 | 'throttle:60,1',
41 | 'bindings',
42 | ],
43 | ];
44 |
45 | /**
46 | * The application's route middleware.
47 | *
48 | * These middleware may be assigned to groups or used individually.
49 | *
50 | * @var array
51 | */
52 | protected $routeMiddleware = [
53 | 'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
54 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
55 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
56 | 'can' => \Illuminate\Auth\Middleware\Authorize::class,
57 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
58 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
59 | ];
60 | }
61 |
--------------------------------------------------------------------------------
/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | check()) {
21 | return redirect('/home');
22 | }
23 |
24 | return $next($request);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/Http/Middleware/TrimStrings.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\User');
32 | }
33 |
34 | public function country()
35 | {
36 | return $this->belongsTo('App\Country');
37 | }
38 |
39 | public function city()
40 | {
41 | return $this->belongsTo('App\City');
42 | }
43 |
44 | public function district()
45 | {
46 | return $this->belongsTo('App\District');
47 | }
48 |
49 | public function orderProducts()
50 | {
51 | return $this->hasMany('App\OrderProduct');
52 | }
53 |
54 | public function statusText()
55 | {
56 | if ($this->status == self::STATUS_NEW) {
57 | return 'New';
58 | } elseif ($this->status == self::STATUS_CONFIRM) {
59 | return "Confirm";
60 | } elseif ($this->status == self::STATUS_PAYMENT) {
61 | return "Payment";
62 | } elseif ($this->status == self::STATUS_SHIPPING) {
63 | return "Shipping";
64 | } elseif ($this->status == self::STATUS_RETURN) {
65 | return "Return";
66 | } elseif ($this->status == self::STATUS_DONE) {
67 | return "Done";
68 | } else {
69 | return 'New';
70 | }
71 | }
72 |
73 | public function subtotal()
74 | {
75 | $subtotal = 0;
76 | foreach ($this->orderProducts as $orderProduct) {
77 | $subtotal = $subtotal + $orderProduct->quantity * $orderProduct->price;
78 | }
79 | return number_format($subtotal);
80 | }
81 |
82 | public function items()
83 | {
84 | $items = 0;
85 | foreach ($this->orderProducts as $orderProduct) {
86 | $items = $items + $orderProduct->quantity;
87 | }
88 | return number_format($items);
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/app/OrderProduct.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\Order');
20 | }
21 |
22 | public function product()
23 | {
24 | return $this->belongsTo('App\Product');
25 | }
26 |
27 | public static function store($order_id)
28 | {
29 | foreach (Cart::content() as $cart) {
30 | $cart = $cart->toArray() ;
31 | $cart['order_id'] = $order_id;
32 | $cart['product_id'] = $cart['id'];
33 | $cart['quantity'] = $cart['qty'];
34 | OrderProduct::create($cart);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/Product.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\Category');
14 | }
15 |
16 | public function shop()
17 | {
18 | return $this->belongsTo('App\Shop');
19 | }
20 |
21 | public function orderProducts()
22 | {
23 | return $this->hasMany('App\OrderProduct');
24 | }
25 |
26 | public function productImages()
27 | {
28 | return $this->hasMany('App\ProductImage');
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/ProductImage.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\Product');
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/Providers/AppServiceProvider.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 | composer('layouts.app', function ($view) {
14 | $types = Type::all();
15 | $view->with('types', $types);
16 | });
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
17 | 'App\Listeners\EventListener',
18 | ],
19 | ];
20 |
21 | /**
22 | * Register any events for your application.
23 | *
24 | * @return void
25 | */
26 | public function boot()
27 | {
28 | parent::boot();
29 |
30 | //
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/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/Role.php:
--------------------------------------------------------------------------------
1 | hasMany('app\Assignment');
14 | }
15 |
16 | public function shopAssignments()
17 | {
18 | return $this->hasMany('App\ShopAssignment');
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/Shop.php:
--------------------------------------------------------------------------------
1 | hasMany('App\Product');
27 | }
28 |
29 | public function city()
30 | {
31 | return $this->belongsTo('App\City');
32 | }
33 |
34 | public function district()
35 | {
36 | return $this->belongsTo('App\District');
37 | }
38 |
39 | public function country()
40 | {
41 | return $this->belongsTo('App\Country');
42 | }
43 |
44 | public function type()
45 | {
46 | return $this->belongsTo('App\Type');
47 | }
48 |
49 | public function shopImages()
50 | {
51 | return $this->hasMany('App\ShopImgae');
52 | }
53 |
54 | public function user()
55 | {
56 | return $this->belongsTo('App\User');
57 | }
58 |
59 | public function shopAssignment()
60 | {
61 | return $this->belongsTo('App\ShopAssignment');
62 | }
63 |
64 | public static function getStatuses()
65 | {
66 | return [
67 | self::STATUS_PENDING => 'PENDING',
68 | self::STATUS_APPROVED =>'APPROVED',
69 | self::STATUS_BANNED => 'BANNED'
70 | ];
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/app/ShopAssignment.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\User');
18 | }
19 | public function role()
20 | {
21 | return $this->belongsTo('App\Role');
22 | }
23 | public function shop()
24 | {
25 | return $this->belongsTo('App\Shop');
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/ShopImage.php:
--------------------------------------------------------------------------------
1 | belongsTo('App\Shop');
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/Type.php:
--------------------------------------------------------------------------------
1 | hasMany('App\Category');
16 |
17 | if (!empty($options['limit'])) {
18 | $relation = $relation->take($options['limit'])->get();
19 | }
20 |
21 | return $relation;
22 | }
23 |
24 | public function shops()
25 | {
26 | return $this->hasMany('App\Shop');
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/User.php:
--------------------------------------------------------------------------------
1 | hasMany('App\Order');
43 | }
44 |
45 | public function assignments()
46 | {
47 | return $this->hasMany('App\Assignment');
48 | }
49 |
50 | public function addresses()
51 | {
52 | return $this->hasMany('App\Address');
53 | }
54 |
55 | public function shopAssignments()
56 | {
57 | return $this->hasMany('App\ShopAssignment');
58 | }
59 |
60 | public function district()
61 | {
62 | return $this->belongsTo('App\District');
63 | }
64 |
65 | public function city()
66 | {
67 | return $this->belongsTo('App\City');
68 | }
69 |
70 | public function country()
71 | {
72 | return $this->belongsTo('App\Country');
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | make(Illuminate\Contracts\Console\Kernel::class);
32 |
33 | $status = $kernel->handle(
34 | $input = new Symfony\Component\Console\Input\ArgvInput,
35 | new Symfony\Component\Console\Output\ConsoleOutput
36 | );
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Shutdown The Application
41 | |--------------------------------------------------------------------------
42 | |
43 | | Once Artisan has finished running. We will fire off the shutdown events
44 | | so that any final work may be done by the application before we shut
45 | | down the process. This is the last thing to happen to the request.
46 | |
47 | */
48 |
49 | $kernel->terminate($input, $status);
50 |
51 | exit($status);
52 |
--------------------------------------------------------------------------------
/bootstrap/app.php:
--------------------------------------------------------------------------------
1 | singleton(
30 | Illuminate\Contracts\Http\Kernel::class,
31 | App\Http\Kernel::class
32 | );
33 |
34 | $app->singleton(
35 | Illuminate\Contracts\Console\Kernel::class,
36 | App\Console\Kernel::class
37 | );
38 |
39 | $app->singleton(
40 | Illuminate\Contracts\Debug\ExceptionHandler::class,
41 | App\Exceptions\Handler::class
42 | );
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Return The Application
47 | |--------------------------------------------------------------------------
48 | |
49 | | This script returns the application instance. The instance is given to
50 | | the calling script so we can separate the building of the instances
51 | | from the actual running of the application and sending responses.
52 | |
53 | */
54 |
55 | return $app;
56 |
--------------------------------------------------------------------------------
/bootstrap/autoload.php:
--------------------------------------------------------------------------------
1 | =5.6.4",
9 | "doctrine/dbal": "^2.5",
10 | "fzaninotto/faker": "^1.6",
11 | "gloudemans/shoppingcart": "^2.3",
12 | "laravel/framework": "5.4.*",
13 | "laravel/tinker": "~1.0",
14 | "laravelcollective/html": "^5.4"
15 | },
16 | "require-dev": {
17 | "mockery/mockery": "0.9.*",
18 | "phpunit/phpunit": "~5.7",
19 | "phpmd/phpmd": "^2.6",
20 | "squizlabs/php_codesniffer": "^3.0"
21 | },
22 | "autoload": {
23 | "classmap": [
24 | "database"
25 | ],
26 | "psr-4": {
27 | "App\\": "app/"
28 | }
29 | },
30 | "autoload-dev": {
31 | "psr-4": {
32 | "Tests\\": "tests/"
33 | }
34 | },
35 | "scripts": {
36 | "post-root-package-install": [
37 | "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
38 | ],
39 | "post-create-project-cmd": [
40 | "php artisan key:generate"
41 | ],
42 | "post-install-cmd": [
43 | "Illuminate\\Foundation\\ComposerScripts::postInstall",
44 | "php artisan optimize"
45 | ],
46 | "post-update-cmd": [
47 | "Illuminate\\Foundation\\ComposerScripts::postUpdate",
48 | "php artisan optimize"
49 | ]
50 | },
51 | "config": {
52 | "preferred-install": "dist",
53 | "sort-packages": true,
54 | "optimize-autoloader": true
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/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 | //
40 | ],
41 | ],
42 |
43 | 'redis' => [
44 | 'driver' => 'redis',
45 | 'connection' => 'default',
46 | ],
47 |
48 | 'log' => [
49 | 'driver' => 'log',
50 | ],
51 |
52 | 'null' => [
53 | 'driver' => 'null',
54 | ],
55 |
56 | ],
57 |
58 | ];
59 |
--------------------------------------------------------------------------------
/config/cache.php:
--------------------------------------------------------------------------------
1 | env('CACHE_DRIVER', 'file'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Cache Stores
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may define all of the cache "stores" for your application as
26 | | well as their drivers. You may even define multiple stores for the
27 | | same cache driver to group types of items stored in your caches.
28 | |
29 | */
30 |
31 | 'stores' => [
32 |
33 | 'apc' => [
34 | 'driver' => 'apc',
35 | ],
36 |
37 | 'array' => [
38 | 'driver' => 'array',
39 | ],
40 |
41 | 'database' => [
42 | 'driver' => 'database',
43 | 'table' => 'cache',
44 | 'connection' => null,
45 | ],
46 |
47 | 'file' => [
48 | 'driver' => 'file',
49 | 'path' => storage_path('framework/cache/data'),
50 | ],
51 |
52 | 'memcached' => [
53 | 'driver' => 'memcached',
54 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
55 | 'sasl' => [
56 | env('MEMCACHED_USERNAME'),
57 | env('MEMCACHED_PASSWORD'),
58 | ],
59 | 'options' => [
60 | // Memcached::OPT_CONNECT_TIMEOUT => 2000,
61 | ],
62 | 'servers' => [
63 | [
64 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
65 | 'port' => env('MEMCACHED_PORT', 11211),
66 | 'weight' => 100,
67 | ],
68 | ],
69 | ],
70 |
71 | 'redis' => [
72 | 'driver' => 'redis',
73 | 'connection' => 'default',
74 | ],
75 |
76 | ],
77 |
78 | /*
79 | |--------------------------------------------------------------------------
80 | | Cache Key Prefix
81 | |--------------------------------------------------------------------------
82 | |
83 | | When utilizing a RAM based store such as APC or Memcached, there might
84 | | be other applications utilizing the same cache. So, we'll specify a
85 | | value to get prefixed to all our keys so we can avoid collisions.
86 | |
87 | */
88 |
89 | 'prefix' => 'laravel',
90 |
91 | ];
92 |
--------------------------------------------------------------------------------
/config/filesystems.php:
--------------------------------------------------------------------------------
1 | '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' => '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", "s3", "rackspace"
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_KEY'),
61 | 'secret' => env('AWS_SECRET'),
62 | 'region' => env('AWS_REGION'),
63 | 'bucket' => env('AWS_BUCKET'),
64 | ],
65 |
66 | ],
67 |
68 | ];
69 |
--------------------------------------------------------------------------------
/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_DRIVER', 'sync'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Queue Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may configure the connection information for each server that
26 | | is used by your application. A default configuration has been added
27 | | for each back-end shipped with Laravel. You are free to add more.
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 | ],
50 |
51 | 'sqs' => [
52 | 'driver' => 'sqs',
53 | 'key' => 'your-public-key',
54 | 'secret' => 'your-secret-key',
55 | 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
56 | 'queue' => 'your-queue-name',
57 | 'region' => 'us-east-1',
58 | ],
59 |
60 | 'redis' => [
61 | 'driver' => 'redis',
62 | 'connection' => 'default',
63 | 'queue' => 'default',
64 | 'retry_after' => 90,
65 | ],
66 |
67 | ],
68 |
69 | /*
70 | |--------------------------------------------------------------------------
71 | | Failed Queue Jobs
72 | |--------------------------------------------------------------------------
73 | |
74 | | These options configure the behavior of failed queue job logging so you
75 | | can control which database and table are used to store the jobs that
76 | | have failed. You may change them to any database / table you wish.
77 | |
78 | */
79 |
80 | 'failed' => [
81 | 'database' => env('DB_CONNECTION', 'mysql'),
82 | 'table' => 'failed_jobs',
83 | ],
84 |
85 | ];
86 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | ],
21 |
22 | 'ses' => [
23 | 'key' => env('SES_KEY'),
24 | 'secret' => env('SES_SECRET'),
25 | 'region' => 'us-east-1',
26 | ],
27 |
28 | 'sparkpost' => [
29 | 'secret' => env('SPARKPOST_SECRET'),
30 | ],
31 |
32 | 'stripe' => [
33 | 'model' => App\User::class,
34 | 'key' => env('STRIPE_KEY'),
35 | 'secret' => env('STRIPE_SECRET'),
36 | ],
37 |
38 | ];
39 |
--------------------------------------------------------------------------------
/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' => realpath(storage_path('framework/views')),
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite
2 |
--------------------------------------------------------------------------------
/database/database.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/php-soft/laravel-marketplace-full-web/f916abcc16765c05576914f3b318d84f613cd8da/database/database.sqlite
--------------------------------------------------------------------------------
/database/factories/ModelFactory.php:
--------------------------------------------------------------------------------
1 | define(App\User::class, function (Faker\Generator $faker) {
16 | static $password;
17 |
18 | return [
19 | 'name' => $faker->name,
20 | 'email' => $faker->unique()->safeEmail,
21 | 'password' => $password ?: $password = bcrypt('secret'),
22 | 'remember_token' => str_random(10),
23 | ];
24 | });
25 |
26 | $factory->define(App\Country::class, function (Faker\Generator $faker) {
27 | return [
28 | 'name' => $faker->name
29 | ];
30 | });
31 |
32 | $factory->define(App\City::class, function (Faker\Generator $faker) {
33 | return [
34 | 'name' => $faker->name,
35 | 'country_id' => function () {
36 | return factory(App\Country::class)->create()->id;
37 | }
38 | ];
39 | });
40 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name');
19 | $table->string('email')->unique();
20 | $table->string('password');
21 | $table->rememberToken();
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::dropIfExists('users');
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/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/2017_04_19_153944_create_products_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
19 | $table->string('name');
20 | $table->string('image');
21 | $table->text('description');
22 | $table->decimal('price');
23 | $table->integer('quantity');
24 | $table->integer('category_id')->unsigned();
25 | $table->integer('shop_id')->unsigned();
26 | $table->timestamps();
27 | });
28 | }
29 |
30 | /**
31 | * Reverse the migrations.
32 | *
33 | * @return void
34 | */
35 | public function down()
36 | {
37 | Schema::dropIfExists('products');
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_04_051025_create_type_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name');
19 | $table->timestamps();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::dropIfExists('types');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_04_112830_create_countries_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name');
19 | $table->timestamps();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::dropIfExists('countries');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_04_113558_create_cities_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name');
19 | $table->timestamps();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::dropIfExists('cities');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_04_123741_create_addresses_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->unsignedInteger('user_id');
19 | $table->unsignedInteger('city_id');
20 | $table->unsignedInteger('country_id');
21 | $table->unsignedInteger('district_id');
22 | $table->string('street');
23 | $table->string('zip_code');
24 | $table->string('phone_number');
25 | $table->timestamps();
26 | });
27 | }
28 |
29 | /**
30 | * Reverse the migrations.
31 | *
32 | * @return void
33 | */
34 | public function down()
35 | {
36 | Schema::dropIfExists('addresses');
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_05_102043_create_shop-assignment_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
19 | $table->string('name');
20 | $table->integer('user_id')->unsigned();
21 | $table->integer('shop_id')->unsigned();
22 | $table->integer('role_id')->unsigned();
23 | $table->timestamps();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('shop_assignments');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_05_164904_create_shop_image_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->unsignedInteger('shop_id');
18 | $table->string('image');
19 | $table->timestamps();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::dropIfExists('shop_images');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_06_105345_create_shops_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name');
19 | $table->integer('user_id')->unsigned();
20 | $table->integer('type_id')->unsigned();
21 | $table->integer('city_id')->unsigned();
22 | $table->integer('district_id')->unsigned();
23 | $table->integer('country_id')->unsigned();
24 | $table->longText('description');
25 | $table->string('image');
26 | $table->tinyInteger('status');
27 | $table->timestamps();
28 | });
29 | }
30 |
31 | /**
32 | * Reverse the migrations.
33 | *
34 | * @return void
35 | */
36 | public function down()
37 | {
38 | Schema::dropIfExists('shops');
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_06_130158_create_categories_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name');
19 | $table->unsignedInteger('type_id');
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::dropIfExists('categories');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_08_025322_update2_users_table.php:
--------------------------------------------------------------------------------
1 | string('first_name')->nullable();
18 | $table->string('last_name')->nullable();
19 | $table->string('phone_number')->nullable();
20 | $table->date('date_of_birth')->nullable();
21 | $table->unsignedInteger('city_id')->nullable();
22 | $table->unsignedInteger('country_id')->nullable();
23 | $table->unsignedInteger('district_id')->nullable();
24 | $table->string('address')->nullable();
25 | $table->string('avatar')->nullable();
26 | });
27 | }
28 |
29 | /**
30 | * Reverse the migrations.
31 | *
32 | * @return void
33 | */
34 | public function down()
35 | {
36 | Schema::table('users', function ($table) {
37 | $table->dropColumn('first_name');
38 | $table->dropColumn('last_name');
39 | $table->dropColumn('phone_number');
40 | $table->dropColumn('date_of_birth');
41 | $table->dropColumn('city_id');
42 | $table->dropColumn('country_id');
43 | $table->dropColumn('district_id');
44 | $table->dropColumn('address');
45 | $table->dropColumn('avatar');
46 | });
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_08_031851_create_order_products_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->unsignedInteger('order_id');
19 | $table->unsignedInteger('product_id');
20 | $table->decimal('price', 9, 2);
21 | $table->unsignedInteger('quantity');
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::dropIfExists('order_products');
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_08_064821_create_product_images_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->unsignedInteger('product_id');
19 | $table->string('image')->nullable();
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::dropIfExists('product_images');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_08_072914_create_orders_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->unsignedInteger('user_id')->nullable();
19 | $table->string('shipping_name');
20 | $table->string('shipping_address')->nullable();
21 | $table->string('shipping_phone');
22 | $table->string('shipping_email');
23 | $table->unsignedInteger('country_id');
24 | $table->unsignedInteger('city_id');
25 | $table->unsignedInteger('district_id');
26 | $table->smallInteger('status');
27 | $table->timestamps();
28 | });
29 | }
30 |
31 | /**
32 | * Reverse the migrations.
33 | *
34 | * @return void
35 | */
36 | public function down()
37 | {
38 | Schema::dropIfExists('orders');
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_08_073235_remove_name_column_users_table.php:
--------------------------------------------------------------------------------
1 | dropColumn('name');
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('users', function ($table) {
29 | $table->string('name')->nullable();
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_08_123841_create_roles_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name');
19 | $table->string('description')->nullable();
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::dropIfExists('roles');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_08_125303_create_assignments_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->unsignedInteger('role_id');
19 | $table->unsignedInteger('user_id');
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::dropIfExists('assignments');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_08_130412_create_contacts_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('content');
19 | $table->string('email');
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::dropIfExists('contacts');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_08_133633_create_districts_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->unsignedInteger('city_id');
19 | $table->string('name');
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::dropIfExists('districts');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_08_172525_update_cities_table.php:
--------------------------------------------------------------------------------
1 | unsignedInteger('country_id')->nullable();
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('cities', function ($table) {
29 | $table->dropColumn('country_id');
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_09_033721_create_productimages_references_table.php:
--------------------------------------------------------------------------------
1 | foreign('product_id')->references('id')->on('products')->onDelete('cascade');
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('product_images', function (Blueprint $table) {
29 | $table->dropForeign(['product_id']);
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_09_035923_create_orderproduct_references_table.php:
--------------------------------------------------------------------------------
1 | foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
18 | $table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::table('order_products', function (Blueprint $table) {
30 | $table->dropForeign(['order_id']);
31 | $table->dropForeign(['product_id']);
32 | });
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_09_053408_create_references_shops_table.php:
--------------------------------------------------------------------------------
1 | foreign('user_id')->references('id')->on('users')->onDelete('cascade');
18 | $table->foreign('type_id')->references('id')->on('types')->onDelete('cascade');
19 | $table->foreign('city_id')->references('id')->on('cities')->onDelete('cascade');
20 | $table->foreign('district_id')->references('id')->on('districts')->onDelete('cascade');
21 | $table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::table('shops', function (Blueprint $table) {
33 | $table->dropForeign(['user_id','type_id','city_id','district_id','country_id']);
34 | });
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_09_111500_create_products_references_table.php:
--------------------------------------------------------------------------------
1 | foreign('shop_id')->references('id')->on('shops')->onDelete('cascade');
18 | $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::table('products', function (Blueprint $table) {
30 | $table->dropForeign(['shop_id']);
31 | $table->dropForeign(['category_id']);
32 | });
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_09_111552_create_categories_references_table.php:
--------------------------------------------------------------------------------
1 | foreign('type_id')->references('id')->on('types')->onDelete('cascade');
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('categories', function (Blueprint $table) {
29 | $table->dropForeign(['type_id']);
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_09_113924_create-relationship-for-assignments-table.php:
--------------------------------------------------------------------------------
1 | foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
18 | $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::table('assignments', function ($table) {
30 | $table->dropForeign('role_id');
31 | $table->dropForeign('user_id');
32 | });
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_09_114013_create_orders_references_table.php:
--------------------------------------------------------------------------------
1 | foreign('user_id')->references('id')->on('users')->onDelete('cascade');
18 | $table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
19 | $table->foreign('city_id')->references('id')->on('cities')->onDelete('cascade');
20 | $table->foreign('district_id')->references('id')->on('districts')->onDelete('cascade');
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::table('orders', function (Blueprint $table) {
32 | $table->dropForeign(['user_id']);
33 | $table->dropForeign(['country_id']);
34 | $table->dropForeign(['city_id']);
35 | $table->dropForeign(['district_id']);
36 | });
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_10_020945_create_relationship_for_addresses_table.php:
--------------------------------------------------------------------------------
1 | foreign('user_id')->references('id')->on('users')->onDelete('cascade');
18 | $table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
19 | $table->foreign('city_id')->references('id')->on('cities')->onDelete('cascade');
20 | $table->foreign('district_id')->references('id')->on('districts')->onDelete('cascade');
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::table('addresses', function (Blueprint $table) {
32 | $table->dropForeign(['user_id']);
33 | $table->dropForeign(['country_id']);
34 | $table->dropForeign(['city_id']);
35 | $table->dropForeign(['district_id']);
36 | });
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_10_023647_create_foreign_for_districts_table.php:
--------------------------------------------------------------------------------
1 | foreign('city_id')->references('id')->on('cities')->onDelete('cascade');
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('districts', function (Blueprint $table) {
29 | $table->dropForeign('city_id');
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_10_031928_create_foreign_for_cities_table.php:
--------------------------------------------------------------------------------
1 | foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('cities', function (Blueprint $table) {
29 | $table->dropForeign('country_id');
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_10_094533_create_references_shopimages_table.php:
--------------------------------------------------------------------------------
1 | foreign('shop_id')->references('id')->on('shops')->onDelete('cascade');
18 | });
19 | }
20 |
21 | /**
22 | * Reverse the migrations.
23 | *
24 | * @return void
25 | */
26 | public function down()
27 | {
28 | Schema::table('shop_images', function (Blueprint $table) {
29 | $table->dropForeign(['shop_id']);
30 | });
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_10_095758_create_references_shopassignments_table.php:
--------------------------------------------------------------------------------
1 | foreign('user_id')->references('id')->on('users')->onDelete('cascade');
18 | $table->foreign('shop_id')->references('id')->on('shops')->onDelete('cascade');
19 | $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::table('shop_assignments', function (Blueprint $table) {
31 | $table->dropForeign(['user_id','shop_id','role_id']);
32 | });
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/database/migrations/2017_05_11_020808_update_data_type_price_column_table.php:
--------------------------------------------------------------------------------
1 | decimal('price', 15, 2)->change();
18 | });
19 |
20 | Schema::table('order_products', function (Blueprint $table) {
21 | $table->decimal('price', 15, 2)->change();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | //
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/database/seeds/AddressesTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'user_id' => 1,
16 | 'city_id' => 3,
17 | 'country_id' => 1,
18 | 'district_id' => 2,
19 | 'street' => '02 Hồ Biểu Chánh',
20 | 'zip_code' => '550000',
21 | 'phone_number' => '0905058325',
22 | ]);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/database/seeds/AssignmentsTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'name' => 'Điện thoại',
16 | 'type_id' => 1,
17 | ]);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/database/seeds/CitiesTableSeeder.php:
--------------------------------------------------------------------------------
1 | $faker->name,
22 | 'country_id' => function () {
23 | return factory(App\Country::class)->create()->id;
24 | }
25 | ]);
26 | }*/
27 |
28 | $faker = Faker\Factory::create();
29 | factory(App\City::class, 50)
30 | ->create([
31 | 'name' => $faker->name,
32 | 'country_id' => function () {
33 | return factory(App\Country::class)->create()->id;
34 | }
35 | ]);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/database/seeds/ContactsTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'content' => 'Bạn đã tạo shop thành công. hãy bắt đầu đăng sản phẩm của mình. Vui lòng không phản hồi email này.',
16 | 'email' => 'support@lazada.com',
17 | ]);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/database/seeds/CountriesTableSeeder.php:
--------------------------------------------------------------------------------
1 | $faker->name,
21 | ]);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call(TypesTableSeeder::class);
15 | $this->call(ContactsTableSeeder::class);
16 | $this->call(RolesTableSeeder::class);
17 | $this->call(CountriesTableSeeder::class);
18 | $this->call(CategoriesTableSeeder::class);
19 | $this->call(CitiesTableSeeder::class);
20 | $this->call(DistrictsTableSeeder::class);
21 | $this->call(UsersTableSeeder::class);
22 | $this->call(AddressesTableSeeder::class);
23 | $this->call(ShopsTableSeeder::class);
24 | $this->call(OrdersTableSeeder::class);
25 | $this->call(ShopImagesTableSeeder::class);
26 | $this->call(ShopAssignmentsTableSeeder::class);
27 | $this->call(ProductsTableSeeder::class);
28 | $this->call(OrderProductsTableSeeder::class);
29 | $this->call(ProductImagesTableSeeder::class);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/database/seeds/DistrictsTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'city_id' => 3,
16 | 'name' => 'Cẩm Lệ',
17 | ]);
18 |
19 | DB::table('districts')->insert([
20 | 'city_id' => 3,
21 | 'name' => 'Hải Châu',
22 | ]);
23 |
24 | DB::table('districts')->insert([
25 | 'city_id' => 3,
26 | 'name' => 'Hòa Vang',
27 | ]);
28 |
29 | DB::table('districts')->insert([
30 | 'city_id' => 3,
31 | 'name' => 'Hoàng Sa',
32 | ]);
33 |
34 | DB::table('districts')->insert([
35 | 'city_id' => 3,
36 | 'name' => 'Liên Chiểu',
37 | ]);
38 |
39 | DB::table('districts')->insert([
40 | 'city_id' => 3,
41 | 'name' => 'Ngũ Hành Sơn',
42 | ]);
43 |
44 | DB::table('districts')->insert([
45 | 'city_id' => 3,
46 | 'name' => 'Sơn Trà',
47 | ]);
48 |
49 | DB::table('districts')->insert([
50 | 'city_id' => 3,
51 | 'name' => 'Thanh Khê',
52 | ]);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/database/seeds/OrderProductsTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'order_id' => 1,
16 | 'product_id' => 1,
17 | 'price' => 15000000,
18 | 'quantity' => 10,
19 | ]);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/database/seeds/OrdersTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'user_id' => 1,
16 | 'shipping_name' => 'Cửa hàng điện thoại VN Mobile',
17 | 'shipping_address' => '02 Hồ Biểu Chánh, Hòa Cường Nam',
18 | 'shipping_phone' => '0905058325',
19 | 'shipping_email' => 'hoanhthanh02hbc@gmail.com',
20 | 'country_id' => 1,
21 | 'city_id' => 3,
22 | 'district_id' => 2,
23 | 'status' => 0,
24 | ]);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/database/seeds/ProductImagesTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'product_id' => 1,
16 | 'image' => 'Samsung Galaxy S8 image1',
17 | ]);
18 |
19 | DB::table('product_images')->insert([
20 | 'product_id' => 1,
21 | 'image' => 'Samsung Galaxy S8 image2',
22 | ]);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/database/seeds/ProductsTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'name' => 'Samsung Galaxy S8',
16 | 'image' => 'Samsung Galaxy S8',
17 | 'description' => 'Samsung Galaxy S8 sở hữu màn hình cong,cảm biến vân tay, cấu hình đỉnh cao, pin khủng, tích hợp trợ lý ảo',
18 | 'price' => 18490000,
19 | 'quantity' => 30,
20 | 'category_id' => 1,
21 | 'shop_id' => 1,
22 | ]);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/database/seeds/RolesTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'name' => 'Shop Owner',
16 | 'description' => 'Bạn có quyền quản trị shop cao nhất. Bạn có thể thêm Người bán hoặc Biên tập viên. Bạn chịu trách nhiệm về các sản phẩm của mình trước pháp luật.',
17 | ]);
18 |
19 | DB::table('roles')->insert([
20 | 'name' => 'Seller',
21 | 'description' => 'Bạn được bán hàng trực tiếp với người mua, thay đổi thông tin sản phẩm. Bạn chịu trach nhiệm bán đúng giá, đúng chất lượng đã công bố.',
22 | ]);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/database/seeds/ShopAssignmentsTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'name' => 'Thêm seller',
16 | 'user_id' => 2,
17 | 'shop_id' => 1,
18 | 'role_id' => 2,
19 | ]);
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/database/seeds/ShopImagesTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'shop_id' => 1,
16 | 'image' => 'VNMobile1',
17 | ]);
18 |
19 | DB::table('shop_images')->insert([
20 | 'shop_id' => 1,
21 | 'image' => 'VNMobile2',
22 | ]);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/database/seeds/ShopsTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'name' => 'Cửa hàng điện thoại VN Mobile',
16 | 'user_id' => 1,
17 | 'type_id' => 1,
18 | 'city_id' => 3,
19 | 'district_id' => 2,
20 | 'country_id' => 1,
21 | 'description' => 'Chuyên mua bán các dòng điện thoại cơ bản, smartphone, blackberry mới và cũ. Có nhiều mẫu mã độc, lạ. Bảo hàng chu đáo.',
22 | 'image' => 'Cửa hàng điện thoại VN Mobile',
23 | 'status' => 0,
24 | ]);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/database/seeds/TypesTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'name' => 'Điện tử',
16 | ]);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/database/seeds/UsersTableSeeder.php:
--------------------------------------------------------------------------------
1 | insert([
15 | 'email' => 'hoanhthanh02hbc@gmail.com',
16 | 'password' => bcrypt('pass87Word'),
17 | 'first_name' => 'Vân',
18 | 'last_name' => 'Nguyễn',
19 | 'phone_number' => '0905058325',
20 | 'date_of_birth' => '1987-07-08',
21 | 'city_id' => 3,
22 | 'country_id' => 1,
23 | 'district_id' => 2,
24 | 'address' => '02 Hồ Biểu Chánh, Hòa Cường Nam',
25 | 'avatar' => 'VanNguyen',
26 | ]);
27 |
28 | DB::table('users')->insert([
29 | 'email' => 'dunghtk87@gmail.com',
30 | 'password' => bcrypt('pass87Word'),
31 | 'first_name' => 'Dung',
32 | 'last_name' => 'Hương Trần Kiều',
33 | 'phone_number' => '0905366366',
34 | 'date_of_birth' => '1987-07-07',
35 | 'city_id' => 3,
36 | 'country_id' => 1,
37 | 'district_id' => 2,
38 | 'address' => '24 Phan Đăng Lưu',
39 | 'avatar' => 'DungHuongTranKieu',
40 | ]);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "scripts": {
4 | "dev": "npm run development",
5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
6 | "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
7 | "watch-poll": "npm run watch -- --watch-poll",
8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
9 | "prod": "npm run production",
10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
11 | },
12 | "devDependencies": {
13 | "axios": "^0.15.3",
14 | "bootstrap-sass": "^3.3.7",
15 | "cross-env": "^3.2.3",
16 | "jquery": "^3.1.1",
17 | "laravel-mix": "0.*",
18 | "lodash": "^4.17.4",
19 | "vue": "^2.1.10"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/phpcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
# | 17 |Content | 18 |Actions | 20 ||
---|---|---|---|
{{ $contact->id }} | 26 |{{ $contact->content }} | 27 |{{ $contact->email }} | 28 |# | 29 |
Price: {{ number_format($product->price) }} VND
6 |{{ $product->description }}
41 |