fix design, add addresses
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ class Categories
|
||||
}
|
||||
$tree[] = $leaf;
|
||||
}
|
||||
$tree = collect($tree)->sortBy('name')->toArray();
|
||||
return $tree;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user