109 lines
3.0 KiB
PHP
109 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\ManageFreeUInvestments;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Category;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
use App\Imports\AlternativeInvestmentFundImport;
|
|
use Illuminate\Support\Str;
|
|
use App\Models\AlternativeInvestmentFund;
|
|
use App\Models\Product;
|
|
use App\Models\Company;
|
|
use App\Models\ProductImage;
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
class LongOnlyEquityFundController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function create()
|
|
{
|
|
$category = Category::find(Category::LongOnlyFundId);
|
|
$text = $category->category_name;
|
|
$category_id = $category->id;
|
|
$excelFileName = 'LongOnlyFundsTemplate.xlsx';
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id', 'excelFileName'));
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
$category = Category::find($request->category_id);
|
|
Excel::import(new AlternativeInvestmentFundImport($category_type), $request->file('productFile'));
|
|
// return back()->with('success', "$category->category_name Imported Successfully.");
|
|
return back()->with('success', "$category->category_name Imported Successfully.");
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function show($id)
|
|
{
|
|
$alternativeInvestmentFund = Product::with('category', 'alternativeInvestmentFund','product_images')->alternativeInvestmentFund()->find($id);
|
|
// dd(Product::find($id));
|
|
// dd($alternativeInvestmentFund);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.alternative-investment-fund', compact('alternativeInvestmentFund'));
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function edit($id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function update(Request $request, $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function destroy($id)
|
|
{
|
|
//
|
|
}
|
|
}
|