diff --git a/app/Http/Controllers/Shop/ArticleController.php b/app/Http/Controllers/Shop/ArticleController.php
index f0788485..8ace1f33 100644
--- a/app/Http/Controllers/Shop/ArticleController.php
+++ b/app/Http/Controllers/Shop/ArticleController.php
@@ -6,12 +6,16 @@ use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\Articles;
+use App\Repositories\Shop\Categories;
class ArticleController extends Controller
{
public function show($id)
{
$data['article'] = Articles::getArticleToSell($id);
+ // $data['breadcrumb'] = Categories::getAncestorsByCategory($category_id);
+ // dump($data);
+ // exit;
return view('Shop.Articles.show', $data);
}
}
diff --git a/app/Http/Controllers/Shop/Auth/RegisterController.php b/app/Http/Controllers/Shop/Auth/RegisterController.php
index 7a40a159..160e99a4 100644
--- a/app/Http/Controllers/Shop/Auth/RegisterController.php
+++ b/app/Http/Controllers/Shop/Auth/RegisterController.php
@@ -15,6 +15,8 @@ use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator;
use Sebastienheyd\Boilerplate\Rules\Password;
+use App\Repositories\Shop\Customers;
+use App\Repositories\Shop\CustomerAddresses;
use App\Models\Shop\Customer;
@@ -51,14 +53,8 @@ class RegisterController extends Controller
protected function create(array $data)
{
- $user = Customer::withTrashed()->updateOrCreate(['email' => $data['email']], [
- 'active' => true,
- 'first_name' => $data['first_name'],
- 'last_name' => $data['last_name'],
- 'email' => $data['email'],
- 'password' => bcrypt($data['password']),
- ]);
-
+ $user = Customers::create($data);
+ CustomerAddresses::add($user->id, $data);
return $user;
}
diff --git a/app/Repositories/Core/Categories.php b/app/Repositories/Core/Categories.php
index 7c7dd25d..82e57acc 100644
--- a/app/Repositories/Core/Categories.php
+++ b/app/Repositories/Core/Categories.php
@@ -54,6 +54,7 @@ class Categories
}
$tree[] = $leaf;
}
+ $tree = collect($tree)->sortBy('name')->toArray();
return $tree;
}
diff --git a/app/Repositories/Shop/CustomerAddresses.php b/app/Repositories/Shop/CustomerAddresses.php
index 8e32f501..e069ee2e 100644
--- a/app/Repositories/Shop/CustomerAddresses.php
+++ b/app/Repositories/Shop/CustomerAddresses.php
@@ -21,6 +21,17 @@ class CustomerAddresses
return CustomerAddress::find($id);
}
+ public static function add($user_id, $data)
+ {
+ return self::store([
+ 'customer_id' => $user_id,
+ 'address' => $data['delivery_address'],
+ 'address2' => $data['delivery_address2'],
+ 'zipcode' => $data['delivery_zipcode'],
+ 'city' => $data['city'],
+ ]);
+ }
+
public static function store($data)
{
$id = $data['id'] ?? false;
diff --git a/app/Repositories/Shop/Customers.php b/app/Repositories/Shop/Customers.php
index a4259c77..610012e6 100644
--- a/app/Repositories/Shop/Customers.php
+++ b/app/Repositories/Shop/Customers.php
@@ -148,8 +148,22 @@ class Customers
public static function create($data)
{
- $data['uuid'] = Str::uuid()->toString();
- return Customer::create($data);
+ $user = Customer::create([
+ 'uuid' => Str::uuid(),
+ 'active' => true,
+ 'first_name' => $data['first_name'],
+ 'last_name' => $data['last_name'],
+ 'company' => $data['company'],
+ 'tva' => $data['tva'],
+ 'phone' => $data['phone'],
+ 'address' => $data['address'],
+ 'address2' => $data['address2'],
+ 'zipcode' => $data['zipcode'],
+ 'city' => $data['city'],
+ 'email' => $data['email'],
+ 'password' => bcrypt($data['password']),
+ ]);
+ return $user;
}
public static function update($data, $id = false)
diff --git a/app/Repositories/Shop/Homepages.php b/app/Repositories/Shop/Homepages.php
index e1609eaa..16d11a90 100644
--- a/app/Repositories/Shop/Homepages.php
+++ b/app/Repositories/Shop/Homepages.php
@@ -20,12 +20,12 @@ class Homepages
public static function getFooter()
{
- return self::get(2)->text ?? '';
+ return self::get(2)->text ?? '';
}
public static function getExtraFooter()
{
- return self::get(3)->text ?? '';
+ return self::get(3)->text ?? '';
}
public static function get($id)
diff --git a/build/css/site.css b/build/css/site.css
index b1ba35c5..a1c1950a 100644
--- a/build/css/site.css
+++ b/build/css/site.css
@@ -60,6 +60,10 @@ label {
color: #517C39;
}
+a.green {
+ color: #517C39 !important;
+}
+
.green-dark {
color: #335012;
}
diff --git a/composer.json b/composer.json
index 14483abb..ef9924d3 100644
--- a/composer.json
+++ b/composer.json
@@ -130,7 +130,11 @@
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
- "sort-packages": true
+ "sort-packages": true,
+ "allow-plugins": {
+ "pestphp/pest-plugin": true,
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ }
},
"extra": {
"laravel": {
diff --git a/resources/views/Shop/Articles/partials/article.blade.php b/resources/views/Shop/Articles/partials/article.blade.php
index 9a54912d..04db5939 100644
--- a/resources/views/Shop/Articles/partials/article.blade.php
+++ b/resources/views/Shop/Articles/partials/article.blade.php
@@ -3,7 +3,7 @@