firstcommit
This commit is contained in:
0
Modules/Banner/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Banner/app/Http/Controllers/.gitkeep
Normal file
142
Modules/Banner/app/Http/Controllers/BannerController.php
Normal file
142
Modules/Banner/app/Http/Controllers/BannerController.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banner\app\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Modules\Banner\app\Repositories\BannerRepository;
|
||||
use Modules\Banner\app\Http\Requests\CreateBannerRequest;
|
||||
use Modules\Banner\app\Http\Requests\UpdateBannerRequest;
|
||||
|
||||
class BannerController extends Controller
|
||||
{
|
||||
protected $bannerRepository;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bannerRepository = new BannerRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$perPage = $request->has('per-page') ? $request->input('per-page') : null;
|
||||
$filter = $request->has('filter') ? $request->input('filter') : [];
|
||||
$banners = $this->bannerRepository->allBanners($perPage, $filter);
|
||||
|
||||
return view('banner::index', compact('banners'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('banner::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(CreateBannerRequest $request)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
$this->bannerRepository->storeBanner($validated);
|
||||
|
||||
toastr()->success('Banner created successfully.');
|
||||
|
||||
return redirect()->route('cms.banners.index');
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
try {
|
||||
$banner = $this->bannerRepository->findBannerById($id);
|
||||
if (!$banner) {
|
||||
toastr()->error('Banner not found.');
|
||||
return back();
|
||||
}
|
||||
|
||||
return view('banner::show', compact('banner'));
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$banner = $this->bannerRepository->findBannerById($id);
|
||||
if (!$banner) {
|
||||
toastr()->error('Banner not found.');
|
||||
return back();
|
||||
}
|
||||
|
||||
return view('banner::edit', compact('banner'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(UpdateBannerRequest $request, $uuid)
|
||||
{
|
||||
$validated = $request->validated();
|
||||
|
||||
try {
|
||||
$banner = $this->bannerRepository->updateBanner($validated, $uuid);
|
||||
|
||||
if (!$banner) {
|
||||
toastr()->error('Banner not found !');
|
||||
return back();
|
||||
}
|
||||
|
||||
toastr()->success('Banner updated successfully.');
|
||||
|
||||
return redirect()->route('cms.banners.index');
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($uuid)
|
||||
{
|
||||
try {
|
||||
$banner = $this->bannerRepository->deleteBanner($uuid);
|
||||
|
||||
if (!$banner) {
|
||||
toastr()->error('Banner not found.');
|
||||
return back();
|
||||
}
|
||||
|
||||
toastr()->success('Banner deleted successfully.');
|
||||
|
||||
return redirect()->route('cms.banners.index');
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
0
Modules/Banner/app/Http/Middleware/.gitkeep
Normal file
0
Modules/Banner/app/Http/Middleware/.gitkeep
Normal file
0
Modules/Banner/app/Http/Requests/.gitkeep
Normal file
0
Modules/Banner/app/Http/Requests/.gitkeep
Normal file
40
Modules/Banner/app/Http/Requests/CreateBannerRequest.php
Normal file
40
Modules/Banner/app/Http/Requests/CreateBannerRequest.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banner\app\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
|
||||
class CreateBannerRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'required',
|
||||
'link' => 'sometimes',
|
||||
'ordering' => 'required|integer|unique:banners,ordering',
|
||||
'caption' => 'sometimes',
|
||||
'status' => 'required',
|
||||
'image' => 'sometimes|nullable',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
// return auth()->user()->can('users.create');
|
||||
}
|
||||
|
||||
protected function failedValidation(Validator $validator)
|
||||
{
|
||||
$message = $validator->errors()->first();
|
||||
toastr()->error($message);
|
||||
parent::failedValidation($validator);
|
||||
}
|
||||
}
|
42
Modules/Banner/app/Http/Requests/UpdateBannerRequest.php
Normal file
42
Modules/Banner/app/Http/Requests/UpdateBannerRequest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banner\app\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Modules\Banner\app\Models\Banner;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
|
||||
class UpdateBannerRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$banner = Banner::where('uuid', $this->route('uuid'))->first();
|
||||
|
||||
return [
|
||||
'title' => 'required',
|
||||
'link' => 'sometimes',
|
||||
'ordering' => 'required|integer|unique:banners,ordering,' . ($banner ? $banner->id : 'NULL') . ',id',
|
||||
'caption' => 'sometimes',
|
||||
'status' => 'required',
|
||||
'image' => 'sometimes|nullable',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function failedValidation(Validator $validator)
|
||||
{
|
||||
$message = $validator->errors()->first();
|
||||
toastr()->error($message);
|
||||
parent::failedValidation($validator);
|
||||
}
|
||||
}
|
0
Modules/Banner/app/Models/.gitkeep
Normal file
0
Modules/Banner/app/Models/.gitkeep
Normal file
47
Modules/Banner/app/Models/Banner.php
Normal file
47
Modules/Banner/app/Models/Banner.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banner\app\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Banner\Database\factories\BannerFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Banner extends Model
|
||||
{
|
||||
// use HasFactory;
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'uuid',
|
||||
'title',
|
||||
'ordering',
|
||||
'caption',
|
||||
'link',
|
||||
'image',
|
||||
'image_path',
|
||||
'status',
|
||||
];
|
||||
|
||||
// protected static function newFactory(): BannerFactory
|
||||
// {
|
||||
// //return BannerFactory::new();
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getFullImageAttribute()
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if($this->image_path) {
|
||||
$result = asset('storage/uploads/' . $this->image_path);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
0
Modules/Banner/app/Providers/.gitkeep
Normal file
0
Modules/Banner/app/Providers/.gitkeep
Normal file
114
Modules/Banner/app/Providers/BannerServiceProvider.php
Normal file
114
Modules/Banner/app/Providers/BannerServiceProvider.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banner\app\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BannerServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Banner';
|
||||
|
||||
protected string $moduleNameLower = 'banner';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands in the format of Command::class
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
// $this->app->booted(function () {
|
||||
// $schedule = $this->app->make(Schedule::class);
|
||||
// $schedule->command('inspire')->hourly();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.config('modules.paths.generator.component-class.path'));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (config('view.paths') as $path) {
|
||||
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
|
||||
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
59
Modules/Banner/app/Providers/RouteServiceProvider.php
Normal file
59
Modules/Banner/app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banner\app\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*/
|
||||
protected string $moduleNamespace = 'Modules\Banner\app\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*/
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Banner', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Banner', '/routes/api.php'));
|
||||
}
|
||||
}
|
122
Modules/Banner/app/Repositories/BannerRepository.php
Normal file
122
Modules/Banner/app/Repositories/BannerRepository.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banner\app\Repositories;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Banner\app\Models\Banner;
|
||||
use Modules\Banner\app\Services\FileManagementService;
|
||||
|
||||
class BannerRepository
|
||||
{
|
||||
public function allBanners($perPage = null, $filter = [], $sort = ['by' => 'id', 'sort' => 'DESC'])
|
||||
{
|
||||
return Banner::when(array_keys($filter, true), function ($query) use ($filter) {
|
||||
if (!empty($filter['title'])) {
|
||||
$query->where('title', $filter['title']);
|
||||
}
|
||||
if (!empty($filter['caption'])) {
|
||||
$query->where('caption', 'like', '%' . $filter['caption'] . '%');
|
||||
}
|
||||
})
|
||||
->orderBy($sort['by'], $sort['sort'])
|
||||
->paginate($perPage ?: env('PAGE_LIMIT', 999));
|
||||
}
|
||||
|
||||
public function findBannerById($uuid)
|
||||
{
|
||||
return Banner::where('uuid', $uuid)->first();
|
||||
}
|
||||
|
||||
public function storeBanner($validated)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$banner = new Banner();
|
||||
$banner->uuid = Str::uuid();
|
||||
$banner->title = $validated['title'];
|
||||
$banner->ordering = $validated['ordering'];
|
||||
$banner->link = $validated['link'];
|
||||
$banner->caption = $validated['caption'];
|
||||
$banner->status = $validated['status'];
|
||||
$banner->save();
|
||||
|
||||
//-- store image
|
||||
if (isset($validated['image']) && $validated['image']->isValid()) {
|
||||
FileManagementService::storeFile(
|
||||
file: $validated['image'],
|
||||
uploadedFolderName: 'banners',
|
||||
model: $banner
|
||||
);
|
||||
}
|
||||
DB::commit();
|
||||
|
||||
return $banner;
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
DB::rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateBanner($validated, $uuid)
|
||||
{
|
||||
try {
|
||||
$banner = $this->findBannerById($uuid);
|
||||
|
||||
if (!$banner) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$banner->title = $validated['title'];
|
||||
$banner->link = $validated['link'];
|
||||
$banner->ordering = $validated['ordering'];
|
||||
$banner->caption = $validated['caption'];
|
||||
$banner->status = $validated['status'];
|
||||
$banner->save();
|
||||
|
||||
//-- Update image
|
||||
if (isset($validated['image']) && $validated['image']->isValid()) {
|
||||
FileManagementService::uploadFile(
|
||||
file: $validated['image'],
|
||||
uploadedFolderName: 'banners',
|
||||
filePath: $banner->image_path,
|
||||
model: $banner
|
||||
);
|
||||
}
|
||||
|
||||
return $banner;
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
DB::transaction();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function deleteBanner($uuid)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$banner = $this->findBannerById($uuid);
|
||||
|
||||
if (!$banner) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Delete the image file associated with the banner
|
||||
if ($banner->image_path !== null) {
|
||||
FileManagementService::deleteFile($banner->image_path);
|
||||
}
|
||||
|
||||
$banner->delete();
|
||||
DB::commit();
|
||||
|
||||
return true;
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
report($th);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
66
Modules/Banner/app/Services/FileManagementService.php
Normal file
66
Modules/Banner/app/Services/FileManagementService.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banner\app\Services;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class FileManagementService
|
||||
{
|
||||
//-- store file
|
||||
public static function storeFile($file, $uploadedFolderName, $model)
|
||||
{
|
||||
try {
|
||||
$originalFileName = $file->getClientOriginalName();
|
||||
$modifiedFileName = date('YmdHis') . "_" . uniqid() . "." . $originalFileName;
|
||||
|
||||
$file->storeAs($uploadedFolderName, $modifiedFileName, 'public_uploads'); // This line uses 'public_uploads' disk
|
||||
|
||||
$model->image = $modifiedFileName;
|
||||
$model->image_path = $uploadedFolderName . '/' . $modifiedFileName;
|
||||
$model->save();
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
||||
//-- update file
|
||||
public static function uploadFile($file, $uploadedFolderName ,$filePath, $model)
|
||||
{
|
||||
try {
|
||||
if ($filePath && Storage::disk('public_uploads')->exists($filePath)) {
|
||||
Storage::disk('public_uploads')->delete($filePath);
|
||||
}
|
||||
|
||||
$originalFileName = $file->getClientOriginalName();
|
||||
$modifiedFileName = date('YmdHis') . "_" . uniqid() . "." . $originalFileName;
|
||||
|
||||
$file->storeAs($uploadedFolderName, $modifiedFileName, 'public_uploads'); // This line uses 'public_uploads' disk
|
||||
|
||||
$model->image = $modifiedFileName;
|
||||
$model->image_path = $uploadedFolderName . '/' . $modifiedFileName;
|
||||
|
||||
$model->save();
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-- delete file
|
||||
public static function deleteFile($filePath)
|
||||
{
|
||||
try {
|
||||
if ($filePath && Storage::disk('public_uploads')->exists($filePath)) {
|
||||
Storage::disk('public_uploads')->delete($filePath);
|
||||
} else {
|
||||
toastr()->error('File Not wrong.');
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong while deleting the file.');
|
||||
}
|
||||
}
|
||||
}
|
31
Modules/Banner/composer.json
Normal file
31
Modules/Banner/composer.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "nwidart/banner",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Banner\\": "",
|
||||
"Modules\\Banner\\App\\": "app/",
|
||||
"Modules\\Banner\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Banner\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Banner\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Banner/config/.gitkeep
Normal file
0
Modules/Banner/config/.gitkeep
Normal file
5
Modules/Banner/config/config.php
Normal file
5
Modules/Banner/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Banner',
|
||||
];
|
0
Modules/Banner/database/factories/.gitkeep
Normal file
0
Modules/Banner/database/factories/.gitkeep
Normal file
0
Modules/Banner/database/migrations/.gitkeep
Normal file
0
Modules/Banner/database/migrations/.gitkeep
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('banners', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid();
|
||||
$table->string('title');
|
||||
$table->integer('ordering');
|
||||
$table->string('caption')->nullable();
|
||||
$table->string('link')->nullable();
|
||||
$table->string('image')->nullable();
|
||||
$table->string('image_path')->nullable();
|
||||
$table->string('status')->default('active');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('banners');
|
||||
}
|
||||
};
|
0
Modules/Banner/database/seeders/.gitkeep
Normal file
0
Modules/Banner/database/seeders/.gitkeep
Normal file
71
Modules/Banner/database/seeders/BannerDatabaseSeeder.php
Normal file
71
Modules/Banner/database/seeders/BannerDatabaseSeeder.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banner\database\seeders;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Modules\Banner\app\Models\Banner;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class BannerDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$banners = [
|
||||
[
|
||||
'title' => 'Adventure Awaits',
|
||||
'link' => 'https://jhigucms.com/adventure-awaits',
|
||||
'ordering' => 1,
|
||||
'caption' => 'Embark on an exciting journey with us. Discover new places and create lasting memories.',
|
||||
'image' => '2.jpg'
|
||||
],
|
||||
[
|
||||
'title' =>'Journey of Discovery',
|
||||
'link' => 'https://jhigucms.com/adventure-awaits',
|
||||
'ordering' => 2,
|
||||
'caption' => 'Discover hidden gems and make every moment count on your travels.',
|
||||
'image' => '1.jpg'
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($banners as $banner) {
|
||||
$cmsbanner = Banner::create([
|
||||
'uuid' => Str::uuid(),
|
||||
'title' => $banner['title'],
|
||||
'link' => $banner['link'],
|
||||
'ordering' => $banner['ordering'],
|
||||
'caption' => $banner['caption'],
|
||||
]);
|
||||
|
||||
// Add image to the created banner
|
||||
$this->uploadImageForBanner($banner['image'], $cmsbanner);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function uploadImageForBanner(string $imageFileName, $cmsbanner)
|
||||
{
|
||||
$seederDirPath = 'banners/';
|
||||
|
||||
// Generate a unique filename for the new image
|
||||
$newFileName = Str::uuid() . '.jpg';
|
||||
|
||||
// Storage path for the new image
|
||||
$storagePath = '/banners/' . $newFileName;
|
||||
|
||||
// Check if the image exists in the seeder_disk
|
||||
if (Storage::disk('seeder_disk')->exists($seederDirPath . $imageFileName)) {
|
||||
// Copy the image from seeder to public
|
||||
$fileContents = Storage::disk('seeder_disk')->get($seederDirPath . $imageFileName);
|
||||
|
||||
Storage::disk('public_uploads')->put($storagePath, $fileContents);
|
||||
|
||||
$cmsbanner->image = $newFileName;
|
||||
$cmsbanner->image_path = $storagePath;
|
||||
$cmsbanner->save();
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Banner/lang/.gitkeep
Normal file
0
Modules/Banner/lang/.gitkeep
Normal file
11
Modules/Banner/module.json
Normal file
11
Modules/Banner/module.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Banner",
|
||||
"alias": "banner",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Banner\\app\\Providers\\BannerServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Banner/package.json
Normal file
15
Modules/Banner/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^1.1.2",
|
||||
"laravel-vite-plugin": "^0.7.5",
|
||||
"sass": "^1.69.5",
|
||||
"postcss": "^8.3.7",
|
||||
"vite": "^4.0.0"
|
||||
}
|
||||
}
|
0
Modules/Banner/resources/assets/.gitkeep
Normal file
0
Modules/Banner/resources/assets/.gitkeep
Normal file
0
Modules/Banner/resources/assets/js/app.js
Normal file
0
Modules/Banner/resources/assets/js/app.js
Normal file
0
Modules/Banner/resources/assets/sass/app.scss
Normal file
0
Modules/Banner/resources/assets/sass/app.scss
Normal file
0
Modules/Banner/resources/views/.gitkeep
Normal file
0
Modules/Banner/resources/views/.gitkeep
Normal file
47
Modules/Banner/resources/views/create.blade.php
Normal file
47
Modules/Banner/resources/views/create.blade.php
Normal file
@@ -0,0 +1,47 @@
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title')
|
||||
Create Banner
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbData = [
|
||||
[
|
||||
'title' => 'Banner',
|
||||
'link' => 'null',
|
||||
],
|
||||
[
|
||||
'title' => 'Dashboard',
|
||||
'link' => route('dashboard'),
|
||||
],
|
||||
[
|
||||
'title' => 'Banners',
|
||||
'link' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Add Banner',
|
||||
'link' => null,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
@include('admin::layouts.partials.breadcrumb', $breadcrumbData)
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-xxl">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<h5 class="mb-0">Add Banner</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form
|
||||
action="{{ route('cms.banners.store')}}"
|
||||
method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@include('banner::partial.form')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
49
Modules/Banner/resources/views/edit.blade.php
Normal file
49
Modules/Banner/resources/views/edit.blade.php
Normal file
@@ -0,0 +1,49 @@
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title')
|
||||
Create Banner
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbData = [
|
||||
[
|
||||
'title' => 'Banner',
|
||||
'link' => 'null',
|
||||
],
|
||||
[
|
||||
'title' => 'Dashboard',
|
||||
'link' => route('dashboard'),
|
||||
],
|
||||
[
|
||||
'title' => 'Banners',
|
||||
'link' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Update Banner',
|
||||
'link' => null,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
@include('admin::layouts.partials.breadcrumb', $breadcrumbData)
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-xxl">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<h5 class="mb-0">Update Banner</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('cms.banners.update', ['uuid' => $banner->uuid]) }}" method="POST"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
@include('banner::partial.form')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
140
Modules/Banner/resources/views/index.blade.php
Normal file
140
Modules/Banner/resources/views/index.blade.php
Normal file
@@ -0,0 +1,140 @@
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title')
|
||||
Banner
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbData = [
|
||||
[
|
||||
'title' => 'Banner',
|
||||
'link' => 'null',
|
||||
],
|
||||
[
|
||||
'title' => 'Dashboard',
|
||||
'link' => route('dashboard'),
|
||||
],
|
||||
[
|
||||
'title' => 'Banners',
|
||||
'link' => null,
|
||||
],
|
||||
];
|
||||
@endphp
|
||||
@include('admin::layouts.partials.breadcrumb', $breadcrumbData)
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- banners List Table -->
|
||||
<div class="card">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h4 class="card-header">List of Banner</h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="flex-column flex-md-row">
|
||||
<div class="dt-action-buttons text-end pt-3 px-3">
|
||||
<div class="dt-buttons btn-group flex-wrap">
|
||||
<a href="{{ route('cms.banners.create') }}"
|
||||
class="btn btn-secondary create-new btn-primary d-none d-sm-inline-block text-white">
|
||||
<i class="bx bx-plus me-sm-1"></i>
|
||||
Add New
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-datatable table-responsive">
|
||||
<table class="table">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>S.N</th>
|
||||
<th>Title With Image</th>
|
||||
<th>Ordering</th>
|
||||
<th>Created At</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-border-bottom-0">
|
||||
@if(count($banners) > 0)
|
||||
@foreach ($banners ?? [] as $banner)
|
||||
<tr>
|
||||
<td>
|
||||
#{{ $loop->iteration }}
|
||||
</td>
|
||||
<td>
|
||||
<div class="d-flex align-items-center me-3">
|
||||
|
||||
<img src="{{ asset($banner->image_path ? 'storage/uploads/' . $banner->image_path : 'backend/uploads/images/no-Image.jpg') }}"
|
||||
alt="Image" class="rounded me-3" height="40" width="60" style="object-fit: cover">
|
||||
<div class="card-title mb-0 px-3">
|
||||
<h6 class="mb-0"> {{ $banner->title }}</h6>
|
||||
<small class="text-muted">{{ Str::limit($banner->caption, 80,'...') }}</small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{ $banner->ordering }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $banner->created_at->toFormattedDateString() }}
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-label-{{ $banner->status == 'active' ? 'success' : 'danger' }}">
|
||||
{{ $banner->status }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn p-0 dropdown-toggle hide-arrow"
|
||||
data-bs-toggle="dropdown">
|
||||
<i class="bx bx-dots-vertical-rounded"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item"
|
||||
href="{{ route('cms.banners.edit', ['uuid' => $banner->uuid]) }}"><i
|
||||
class="bx bx-edit-alt me-1"></i>
|
||||
Edit</a>
|
||||
|
||||
{{-- <div class="dropdown-item btn-delete" data-name="[ {{ $banner->title }} ]"
|
||||
data-action="{{ route('cms.banners.delete', ['uuid' => $banner->uuid]) }}">
|
||||
<i class="bx bx-trash me-1"></i> Delete
|
||||
</div> --}}
|
||||
<form method="POST"
|
||||
action="{{ route('cms.banners.delete', ['uuid' => $banner->uuid]) }}"
|
||||
id="deleteForm_{{ $banner->uuid }}" class="dropdown-item">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="border-0 bg-transparent deleteBtn"
|
||||
style="color:inherit"><i class="bx bx-trash me-1"></i> Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="7">No record found.</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="px-3">
|
||||
{{ $banners->links('admin::layouts.partials.pagination') }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
{{-- style --}}
|
||||
@push('required-styles')
|
||||
@include('admin::vendor.dataTables.style')
|
||||
@endpush
|
||||
|
||||
{{-- script --}}
|
||||
@push('required-scripts')
|
||||
@include('admin::vendor.dataTables.script')
|
||||
@endpush
|
29
Modules/Banner/resources/views/layouts/master.blade.php
Normal file
29
Modules/Banner/resources/views/layouts/master.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<title>Banner Module - {{ config('app.name', 'Laravel') }}</title>
|
||||
|
||||
<meta name="description" content="{{ $description ?? '' }}">
|
||||
<meta name="keywords" content="{{ $keywords ?? '' }}">
|
||||
<meta name="author" content="{{ $author ?? '' }}">
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
||||
|
||||
{{-- Vite CSS --}}
|
||||
{{-- {{ module_vite('build-banner', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-banner', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
93
Modules/Banner/resources/views/partial/form.blade.php
Normal file
93
Modules/Banner/resources/views/partial/form.blade.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<div>
|
||||
<div class="row mb-4">
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-start align-items-sm-center gap-4">
|
||||
<img src="{{ asset(!empty($banner->image_path) ? 'storage/uploads/' . $banner->image_path : 'backend/uploads/images/no-Image.jpg') }}"
|
||||
alt="banner-image input-file" class="d-block rounded show-image" height="100" width="100" />
|
||||
|
||||
<div class="button-wrapper">
|
||||
<label for="upload" class="btn btn-primary me-2 mb-4" tabindex="0">
|
||||
<span class="d-none d-sm-block">Upload</span>
|
||||
<i class="bx bx-upload d-block d-sm-none"></i>
|
||||
<input type="file" id="upload" class="input-file" name="image" hidden
|
||||
accept="image/png, image/jpeg" />
|
||||
</label>
|
||||
<button type="button" class="btn btn-label-secondary image-reset mb-4">
|
||||
<i class="bx bx-reset d-block d-sm-none"></i>
|
||||
<span class="d-none d-sm-block">Reset</span>
|
||||
</button>
|
||||
|
||||
<p class="mb-0">Allowed JPG, GIF or PNG. Max size of 3Mb</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="my-0" />
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="mb-3 col-md-6">
|
||||
<label class="form-label" for="basic-default-name">Title</label>
|
||||
<input type="text" class="form-control" name="title" {{-- value="" --}}
|
||||
value="{{ old('title', $banner->title ?? '') }}" placeholder="e.g. Banner" required />
|
||||
@error('title')
|
||||
<div class="text-danger">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3 col-md-6">
|
||||
<label class="form-label" for="basic-default-company">Link</label>
|
||||
<input type="text" class="form-control" name="link" value="{{ old('link', $banner->link ?? '') }}"
|
||||
placeholder="e.g. https://jhigucms.com/adventure-awaits" />
|
||||
@error('link')
|
||||
<div class="text-danger">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div x-data="{ caption: '{{ !empty($banner) && !empty($banner->caption) ? $banner->caption : '' }}' }" class="mb-3">
|
||||
<textarea name="caption" class="form-control full-editor" id="editorTextarea" rows='5'
|
||||
placeholder="Banner Detail..." x-bind:value="caption"></textarea>
|
||||
@error('caption')
|
||||
<div class="text-danger">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="mb-3 col-md-6">
|
||||
<label class="form-label" for="basic-default-company">Ordering</label>
|
||||
<input type="number" class="form-control" name="ordering" {{-- value="" --}}
|
||||
value="{{ old('ordering', $banner->ordering ?? '') }}" placeholder="e.g. 15" required />
|
||||
@error('ordering')
|
||||
<div class="text-danger">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="mb-3 col-md-6">
|
||||
<label class="form-label" for="basic-default-company">Status</label>
|
||||
<select class="form-select select2" id="basic-default-compan select2Basic"
|
||||
aria-label="Default select example" name="status" required>
|
||||
<option value="active"{{ ($banner->status ?? '') == 'active' ? 'selected' : '' }}>Active</option>
|
||||
<option value="inactive"{{ ($banner->status ?? '') == 'inactive' ? 'selected' : '' }}>Inactive</option>
|
||||
</select>
|
||||
@error('status')
|
||||
<div class="text-danger">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ empty($banner) ? 'Save Banner' : 'Update Banner' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('required-styles')
|
||||
@include('admin::vendor.full_editor.style')
|
||||
@include('admin::vendor.select2.style')
|
||||
@endpush
|
||||
|
||||
@push('required-scripts')
|
||||
@include('admin::vendor.textareaContentDisplay.script')
|
||||
@include('admin::vendor.full_editor.script')
|
||||
@include('admin::vendor.select2.script')
|
||||
@endpush
|
0
Modules/Banner/routes/.gitkeep
Normal file
0
Modules/Banner/routes/.gitkeep
Normal file
19
Modules/Banner/routes/api.php
Normal file
19
Modules/Banner/routes/api.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware(['auth:sanctum'])->prefix('v1')->name('api.')->group(function () {
|
||||
Route::get('banner', fn (Request $request) => $request->user())->name('banner');
|
||||
});
|
40
Modules/Banner/routes/web.php
Normal file
40
Modules/Banner/routes/web.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Banner\app\Http\Controllers\BannerController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| contains the "web" middleware group. Now create something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group(
|
||||
[
|
||||
'prefix' => 'apanel',
|
||||
'middleware' => ['auth'],
|
||||
'as' => 'cms.',
|
||||
],
|
||||
function () {
|
||||
Route::group(
|
||||
[
|
||||
'prefix' => 'cms',
|
||||
'as' => 'banners.',
|
||||
'controller' => 'BannerController',
|
||||
],
|
||||
function () {
|
||||
Route::get('banners', 'index')->name('index');
|
||||
Route::get('banners/create', 'create')->name('create');
|
||||
Route::post('banners/store', 'store')->name('store');
|
||||
Route::get('banners/{uuid}/edit', 'edit')->name('edit');
|
||||
Route::put('banners/{uuid}/update', 'update')->name('update');
|
||||
Route::delete('banners/{uuid}/delete', 'destroy')->name('delete');
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
0
Modules/Banner/tests/Feature/.gitkeep
Normal file
0
Modules/Banner/tests/Feature/.gitkeep
Normal file
0
Modules/Banner/tests/Unit/.gitkeep
Normal file
0
Modules/Banner/tests/Unit/.gitkeep
Normal file
26
Modules/Banner/vite.config.js
Normal file
26
Modules/Banner/vite.config.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: '../../public/build-banner',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-banner',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/$STUDLY_NAME$/resources/assets/sass/app.scss',
|
||||
// 'Modules/$STUDLY_NAME$/resources/assets/js/app.js',
|
||||
//];
|
Reference in New Issue
Block a user