52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Shop;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Repositories\Shop\Customers;
|
|
use App\Repositories\Shop\Deliveries;
|
|
use App\Datatables\Shop\CustomersDataTable;
|
|
use App\Datatables\Shop\CustomerAddressesDataTable;
|
|
|
|
class CustomerController extends Controller
|
|
{
|
|
public function index(CustomersDataTable $dataTable)
|
|
{
|
|
$data = [];
|
|
return $dataTable->render('Admin.Shop.Customers.list', $data);
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
$data['deliveries'] = Deliveries::getOptions();
|
|
return view('Admin.Shop.Customers.create', $data);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$ret = Customers::storeFull($request->all());
|
|
return redirect()->route('Admin.Shop.Customers.index');
|
|
}
|
|
|
|
public function show($id)
|
|
{
|
|
$data['customer'] = Customers::get($id);
|
|
return view('Admin.Shop.Customers.view', $data);
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
$data['customer'] = Customers::edit($id);
|
|
$data['deliveries'] = Deliveries::getOptions();
|
|
$model = new CustomerAddressesDataTable();
|
|
$data['customer_addresses'] = $model->html();
|
|
return view('Admin.Shop.Customers.edit', $data);
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
return Customers::destroy($id);
|
|
}
|
|
}
|