add datatbles for invoices, add pdf icon, refactor icons components, add autocomplete on search, adapt searching to meilisearch
This commit is contained in:
@@ -6,4 +6,8 @@ use App\Http\Controllers\Controller as ParentController;
|
||||
|
||||
class Controller extends ParentController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth.check');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,26 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Shop\Controller;
|
||||
use App\Repositories\Shop\Customers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
public function profile($id = false)
|
||||
public function profile()
|
||||
{
|
||||
$data = Customers::editProfile($id);
|
||||
$data = Customers::editProfile(Customers::getId());
|
||||
|
||||
return view('Shop.Customers.profile', $data);
|
||||
}
|
||||
|
||||
public static function checkAuth()
|
||||
{
|
||||
if (Customers::isNotConnected()) {
|
||||
return redirect()->route('Shop.login');
|
||||
}
|
||||
}
|
||||
|
||||
public function modalProfile($id = false)
|
||||
{
|
||||
$data = [
|
||||
@@ -27,9 +33,8 @@ class CustomerController extends Controller
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$id = Auth::id();
|
||||
$data = [
|
||||
'customer' => Customers::edit($id),
|
||||
'customer' => Customers::edit(Customers::getId()),
|
||||
];
|
||||
|
||||
return view('Shop.Customers.edit', $data);
|
||||
|
||||
@@ -2,22 +2,25 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Shop\Controller;
|
||||
use App\Datatables\Shop\CustomerInvoicesDataTable;
|
||||
use App\Repositories\Shop\InvoicePDF;
|
||||
use App\Repositories\Shop\Invoices;
|
||||
|
||||
class InvoiceController extends Controller
|
||||
{
|
||||
public function index()
|
||||
public function index(CustomerInvoicesDataTable $dataTable)
|
||||
{
|
||||
//
|
||||
return $dataTable->render('Shop.Invoices.partials.list');
|
||||
}
|
||||
|
||||
public function show($uuid)
|
||||
public function view($uuid)
|
||||
{
|
||||
$data = Invoices::getByUUID($uuid);
|
||||
$data = [
|
||||
'invoice' => Invoices::view($uuid),
|
||||
];
|
||||
|
||||
return view('Shop.Invoices.show', $data);
|
||||
return view('Shop.Invoices.view', $data);
|
||||
}
|
||||
|
||||
public function pdf($uuid)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop;
|
||||
|
||||
use App\Datatables\Shop\OrdersDataTable;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Datatables\Shop\CustomerOrdersDataTable;
|
||||
use App\Http\Controllers\Shop\Controller;
|
||||
use App\Repositories\Core\User\ShopCart;
|
||||
use App\Repositories\Shop\Baskets;
|
||||
use App\Repositories\Shop\Customers;
|
||||
@@ -17,7 +17,7 @@ use Illuminate\Http\Request;
|
||||
|
||||
class OrderController extends Controller
|
||||
{
|
||||
public function index(OrdersDataTable $dataTable)
|
||||
public function index(CustomerOrdersDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Orders.partials.list');
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ class SearchController extends Controller
|
||||
{
|
||||
$data = $request->input();
|
||||
$data['product_type'] = 'botanic';
|
||||
$articles = Searches::getResults($request->input());
|
||||
// $articles = Searches::getResults($request->input());
|
||||
$articles = Searches::search($request->input());
|
||||
$data = [
|
||||
'articles' => $articles,
|
||||
'articles_count' => $articles ? count($articles) : 0,
|
||||
@@ -20,8 +21,6 @@ class SearchController extends Controller
|
||||
'product_type' => $data['product_type'],
|
||||
];
|
||||
|
||||
// dump($data);
|
||||
// exit;
|
||||
return view('Shop.Search.results', $data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ class Kernel extends HttpKernel
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'auth.check' => \App\Http\Middleware\CheckAuth::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
|
||||
19
app/Http/Middleware/CheckAuth.php
Normal file
19
app/Http/Middleware/CheckAuth.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Repositories\Shop\Customers;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CheckAuth
|
||||
{
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if (Customers::isNotConnected()) {
|
||||
return redirect('/login');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user