changes
This commit is contained in:
@ -96,7 +96,8 @@ class OrderController extends Controller
|
||||
$data = [];
|
||||
$numInc = $request->numberInc;
|
||||
$script = true;
|
||||
$productList= $this->productRepository->pluck();
|
||||
$productList= $this->productRepository->pluck('id');
|
||||
dd($productList);
|
||||
|
||||
return response()->json([
|
||||
'view' => view('order::order.clone-product', compact('data', 'numInc', 'script', 'productList'))->render(),
|
||||
|
84
Modules/Order/app/Http/Controllers/PaymentModeController.php
Normal file
84
Modules/Order/app/Http/Controllers/PaymentModeController.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Order\Models\PaymentMode;
|
||||
use Modules\Order\Repositories\PaymentModeRepository;
|
||||
|
||||
class PaymentModeController extends Controller
|
||||
{
|
||||
private $paymentModeRepository;
|
||||
|
||||
public function __construct(PaymentModeRepository $paymentModeRepository)
|
||||
{
|
||||
$this->paymentModeRepository = $paymentModeRepository;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Payment Modes';
|
||||
$data['paymentModes'] = $this->paymentModeRepository->findAll();
|
||||
return view('order::paymentMode.index', $data);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Payment Mode';
|
||||
$data['status'] = PaymentMode::STATUS;
|
||||
|
||||
return view('order::paymentMode.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$request->request->add(['slug' => slugify($request->title)]);
|
||||
$inputData = $request->all();
|
||||
$this->paymentModeRepository->create($inputData);
|
||||
toastr()->success('Payment Mode Created Successfully');
|
||||
|
||||
return redirect()->route('paymentMode.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Show Payment Mode';
|
||||
$data['status'] = PaymentMode::STATUS;
|
||||
$data['paymentMode'] = $this->paymentModeRepository->getPaymentModeById($id);
|
||||
|
||||
return view('order::paymentMode.show', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Payment Mode';
|
||||
$data['status'] = PaymentMode::STATUS;
|
||||
$data['paymentMode'] = $this->paymentModeRepository->getPaymentModeById($id);
|
||||
|
||||
return view('order::paymentMode.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
$this->paymentModeRepository->update($id, $inputData);
|
||||
|
||||
return redirect()->route('paymentMode.index');
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$stock = $this->paymentModeRepository->getPaymentModeById($id);
|
||||
$stock->delete();
|
||||
|
||||
toastr()->success('Payment Mode Deleted Successfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Payment Mode Deleted Successfully']);
|
||||
}
|
||||
}
|
16
Modules/Order/app/Models/PaymentMode.php
Normal file
16
Modules/Order/app/Models/PaymentMode.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PaymentMode extends Model
|
||||
{
|
||||
USE StatusTrait;
|
||||
|
||||
protected $table = 'tbl_paymentmodes';
|
||||
protected $guarded = [];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
}
|
15
Modules/Order/app/Repositories/PaymentModeInterface.php
Normal file
15
Modules/Order/app/Repositories/PaymentModeInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Repositories;
|
||||
|
||||
interface PaymentModeInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getPaymentModeById($PaymentModeId);
|
||||
public function getPaymentModeByEmail($email);
|
||||
public function delete($PaymentModeId);
|
||||
public function create($PaymentModeDetails);
|
||||
public function update($PaymentModeId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
46
Modules/Order/app/Repositories/PaymentModeRepository.php
Normal file
46
Modules/Order/app/Repositories/PaymentModeRepository.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Repositories;
|
||||
|
||||
use Modules\Order\Models\PaymentMode;
|
||||
|
||||
class PaymentModeRepository implements PaymentModeInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return PaymentMode::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getPaymentModeById($PaymentModeId)
|
||||
{
|
||||
return PaymentMode::findOrFail($PaymentModeId);
|
||||
}
|
||||
|
||||
public function getPaymentModeByEmail($email)
|
||||
{
|
||||
return PaymentMode::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($PaymentModeId)
|
||||
{
|
||||
PaymentMode::destroy($PaymentModeId);
|
||||
}
|
||||
|
||||
public function create($PaymentModeDetails)
|
||||
{
|
||||
return PaymentMode::create($PaymentModeDetails);
|
||||
}
|
||||
|
||||
public function update($PaymentModeId, array $newDetails)
|
||||
{
|
||||
return PaymentMode::whereId($PaymentModeId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return PaymentMode::pluck('name', 'id');
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
<div class="row gy-2 mb-2">
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Product')->class('form-label') }}
|
||||
{{ html()->select('product_id', $productList)->class('form-control')->placeholder('Enter Product Name')->required() }}
|
||||
{{ html()->select('product_id[]', $productList)->class('form-control')->placeholder('Enter Product Name')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
|
Reference in New Issue
Block a user