Files
pbao9 17b02631e4 Refactor views to use new layout structure and update routes for administrator pages
- Changed view extends from "admin.main" to "administrator.layout.master" across multiple files.
- Updated route names in admin.php and administrator.php to reflect new structure for user, order, invoice, and other management functionalities.
- Adjusted view includes to point to the new directory structure for blocks and components.
- Ensured all permission checks remain intact while refactoring the views.
2026-02-02 10:31:11 +07:00

48 lines
1.2 KiB
PHP

<?php
namespace App\Http\Controllers\admin;
use App\Http\Controllers\Controller;
use App\Http\Services\Upload;
use App\Imports\DomainImport;
use App\Repositories\Domain\DomainRepositoryInterface;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
class DomainController extends Controller
{
public function __construct(
public DomainRepositoryInterface $domainRepository
)
{
}
public function index(Request $request)
{
$domain = $this->domainRepository->filter(
[
'page' => $request->get('page',1),
],
['type']
);
$title = "List All Domain";
return view("administrator.pages.product.domain.index", compact('domain', 'title'));
}
//import domain from file excel
public function import(Request $request,Upload $upload)
{
$filePath = $upload->FileUpload($request->file);
if (! $filePath)
{
return back()->withErrors("Please choose your file");
}
Excel::import(new DomainImport, Storage::path($filePath));
unlink(Storage::path($filePath));
return back()->with('success','Import data from file success');
}
}