72 lines
3.0 KiB
PHP
72 lines
3.0 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Frontend;
|
||
|
|
|
||
|
|
use App\Http\Controllers\Controller;
|
||
|
|
use App\Models\LeaseBasedFinancing;
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use App\Models\Product;
|
||
|
|
use App\Http\Resources\FractionalRealEstate as test;
|
||
|
|
use App\Http\Resources\LeaseBasedFinancingResource;
|
||
|
|
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFontendController;
|
||
|
|
|
||
|
|
|
||
|
|
class LeaseBasedFinancingController extends Controller
|
||
|
|
{
|
||
|
|
public function index(){
|
||
|
|
$leadBasedFinancings = $this->leadBasedFinancing()->getData();
|
||
|
|
$learnMore = (new FractionalRealEstateFontendController)->leaseBasedFinancingQuestionAndAnswer()->getData();
|
||
|
|
$faqs = (new FractionalRealEstateFontendController)->leaseBasedFinancingQuestionAndAnswerFaqs()->getData();
|
||
|
|
return view('Frontend.Pages.lease-based-financing.index',compact('leadBasedFinancings','learnMore','faqs'));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function product($slug){
|
||
|
|
// $leaseBasedFinancing = LeaseBasedFinancing::where('slug',$slug)->first();
|
||
|
|
$leaseBasedFinancing = $this->leadBasedFinancingData($slug)->getData()->data;
|
||
|
|
$otherLBF = LeaseBasedFinancing::query()
|
||
|
|
->join('products', 'lease_based_financings.products_id', 'products.id')
|
||
|
|
->where(['status' => true, 'categories_id' => 24])
|
||
|
|
// ->where('status',false)
|
||
|
|
->where('slug', '!=', $slug)
|
||
|
|
// ->where('categories_id',26)
|
||
|
|
->get();
|
||
|
|
|
||
|
|
$productData = LeaseBasedFinancing::where('slug','=',$slug)->first();
|
||
|
|
$productData = Product::where('id','=',$productData->products_id)->first();
|
||
|
|
// $productData['presentation_file'] = $productData->getRawOriginal('presentation');
|
||
|
|
// $productData['fact_sheet_file'] = $productData->getRawOriginal('fact_sheet');
|
||
|
|
return view('Frontend.Pages.lease-based-financing.product',compact('leaseBasedFinancing','otherLBF','productData'));
|
||
|
|
}
|
||
|
|
|
||
|
|
// public function leadBasedFinancing(){
|
||
|
|
// $leadBasedFinancings = Product::with('leaseBasedFinancing', 'category')->leaseBasedFinancing()->active()->get();
|
||
|
|
// return (object)[
|
||
|
|
// 'status' => 200,
|
||
|
|
// 'data' => $leadBasedFinancings
|
||
|
|
// ];
|
||
|
|
// // return $leadBasedFinancings;
|
||
|
|
// }
|
||
|
|
|
||
|
|
public function leadBasedFinancing()
|
||
|
|
{
|
||
|
|
try {
|
||
|
|
return (new test(Product::has('leaseBasedFinancing')->with('leaseBasedFinancing')->active()->get()))
|
||
|
|
->response()
|
||
|
|
->setStatusCode(200);
|
||
|
|
} catch (\Exception $e) {
|
||
|
|
return response()->json(['message' => $e->getMessage()], 400);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function leadBasedFinancingData($slug)
|
||
|
|
{
|
||
|
|
try {
|
||
|
|
return (new LeaseBasedFinancingResource(LeaseBasedFinancing::where('slug',$slug)->first()))
|
||
|
|
->response()
|
||
|
|
->setStatusCode(200);
|
||
|
|
} catch (\Exception $e) {
|
||
|
|
return response()->json(['message' => $e->getMessage()], 400);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|