firstcommit
This commit is contained in:
0
Modules/Destination/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Destination/app/Http/Controllers/.gitkeep
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Destination\app\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Modules\Destination\app\Repositories\DestinationRepository;
|
||||
use Modules\Destination\app\Http\Requests\CreateDestinationRequest;
|
||||
use Modules\Destination\app\Http\Requests\UpdateDestinationRequest;
|
||||
|
||||
class DestinationController extends Controller
|
||||
{
|
||||
protected $destinationRepository;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->destinationRepository = new DestinationRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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') : [];
|
||||
$destinations = $this->destinationRepository->allDestinations($perPage, $filter);
|
||||
|
||||
return view('destination::index', compact('destinations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['countries'] = $this->destinationRepository->getCountries() ?? [];
|
||||
$data['activities'] = $this->destinationRepository->getActivities() ?? [];
|
||||
return view('destination::create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(CreateDestinationRequest $request)
|
||||
{
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
$result = $this->destinationRepository->storeDestination($validated);
|
||||
|
||||
if ($result == null) {
|
||||
toastr()->error('Destination not found.');
|
||||
return back();
|
||||
}
|
||||
|
||||
toastr()->success('Destination created successfully.');
|
||||
|
||||
return redirect()->route('cms.destinations.index');
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('destination::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($uuid)
|
||||
{
|
||||
$data['countries'] = $this->destinationRepository->getCountries() ?? [];
|
||||
$data['activities'] = $this->destinationRepository->getActivities() ?? [];
|
||||
$data['destination'] = $this->destinationRepository->destinationWithCountriesAndActivitiesByUuid($uuid);
|
||||
|
||||
if (!$data['destination']) {
|
||||
toastr()->error('Destination not found.');
|
||||
return back();
|
||||
}
|
||||
|
||||
return view('destination::edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(UpdateDestinationRequest $request, $uuid)
|
||||
{
|
||||
|
||||
try {
|
||||
$validated = $request->validated();
|
||||
|
||||
$destination = $this->destinationRepository->updateDestination($validated, $uuid);
|
||||
|
||||
if (!$destination) {
|
||||
toastr()->error('Destination not found!');
|
||||
return back();
|
||||
}
|
||||
|
||||
toastr()->success('Destination updated successfully.');
|
||||
|
||||
return redirect()->route('cms.destinations.index');
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($uuid)
|
||||
{
|
||||
try {
|
||||
$destination = $this->destinationRepository->deleteDestination($uuid);
|
||||
|
||||
if (!$destination) {
|
||||
toastr()->error('Destination not found.');
|
||||
return back();
|
||||
}
|
||||
|
||||
toastr()->success('Destination deleted successfully.');
|
||||
|
||||
return redirect()->route('cms.destinations.index');
|
||||
} catch (\Throwable $th) {
|
||||
report($th);
|
||||
toastr()->error('Something went wrong.');
|
||||
return back();
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Destination/app/Http/Middleware/.gitkeep
Normal file
0
Modules/Destination/app/Http/Middleware/.gitkeep
Normal file
0
Modules/Destination/app/Http/Requests/.gitkeep
Normal file
0
Modules/Destination/app/Http/Requests/.gitkeep
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Destination\app\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
|
||||
class CreateDestinationRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'required|string',
|
||||
'country_id' => 'required|exists:countries,id',
|
||||
'ordering' => 'required|integer|unique:destinations,ordering',
|
||||
'rating' => 'required|integer|between:1,5',
|
||||
'activities' => '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,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Destination\app\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Modules\Destination\app\Models\Destination;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
|
||||
class UpdateDestinationRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$destination = Destination::where('uuid', $this->route('uuid'))->first();
|
||||
|
||||
return [
|
||||
'title' => 'required|string',
|
||||
'country_id' => 'required|exists:countries,id',
|
||||
'ordering' => 'required|integer|unique:destinations,ordering,' . ($destination ? $destination->id : 'NULL') . ',id',
|
||||
'activities' => 'required',
|
||||
'rating' => 'required|integer|between:1,5',
|
||||
'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/Destination/app/Models/.gitkeep
Normal file
0
Modules/Destination/app/Models/.gitkeep
Normal file
73
Modules/Destination/app/Models/Destination.php
Normal file
73
Modules/Destination/app/Models/Destination.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Destination\app\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\Activity\app\Models\Activity;
|
||||
use Modules\CountryList\app\Models\Country;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Destination\Database\factories\DestinationFactory;
|
||||
|
||||
class Destination extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
// use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'uuid',
|
||||
'country_id',
|
||||
'title',
|
||||
'rating',
|
||||
'ordering',
|
||||
'image',
|
||||
'image_path ',
|
||||
'status ',
|
||||
];
|
||||
|
||||
|
||||
public function country(){
|
||||
return $this->belongsTo(Country::class);
|
||||
}
|
||||
|
||||
public function activities()
|
||||
{
|
||||
return $this->belongsToMany(Activity::class,'activity_destination');
|
||||
}
|
||||
|
||||
// protected static function newFactory(): DestinationFactory
|
||||
// {
|
||||
// //return DestinationFactory::new();
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getFullImageAttribute()
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if($this->image_path) {
|
||||
$result = asset('storage/uploads/' . $this->image_path);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getCountryNameAttribute()
|
||||
{
|
||||
$result = null;
|
||||
|
||||
if($this->country_id) {
|
||||
$result = optional($this->country)->name;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
0
Modules/Destination/app/Providers/.gitkeep
Normal file
0
Modules/Destination/app/Providers/.gitkeep
Normal file
114
Modules/Destination/app/Providers/DestinationServiceProvider.php
Normal file
114
Modules/Destination/app/Providers/DestinationServiceProvider.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Destination\app\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class DestinationServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Destination';
|
||||
|
||||
protected string $moduleNameLower = 'destination';
|
||||
|
||||
/**
|
||||
* 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/Destination/app/Providers/RouteServiceProvider.php
Normal file
59
Modules/Destination/app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Destination\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\Destination\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('Destination', '/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('Destination', '/routes/api.php'));
|
||||
}
|
||||
}
|
191
Modules/Destination/app/Repositories/DestinationRepository.php
Normal file
191
Modules/Destination/app/Repositories/DestinationRepository.php
Normal file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Destination\app\Repositories;
|
||||
|
||||
use Throwable;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Activity\app\Models\Activity;
|
||||
use Modules\CountryList\app\Models\Country;
|
||||
use Modules\Destination\app\Models\Destination;
|
||||
use Modules\Banner\app\Services\FileManagementService;
|
||||
|
||||
class DestinationRepository
|
||||
{
|
||||
//-- Get All Destination
|
||||
public function allDestinations($perPage = null, $filter = [], $sort = ['by' => 'id', 'sort' => 'DESC'])
|
||||
{
|
||||
return Destination::with('country')
|
||||
->withCount('activities')
|
||||
->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 findDestinationById($uuid)
|
||||
{
|
||||
return Destination::where('uuid', $uuid)->first();
|
||||
}
|
||||
|
||||
//-- Store Destination
|
||||
public function storeDestination($validated)
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$destination = new Destination();
|
||||
$destination->uuid = Str::uuid();
|
||||
$destination->title = $validated['title'];
|
||||
$destination->country_id = $validated['country_id'];
|
||||
$destination->rating = $validated['rating'];
|
||||
$destination->ordering = $validated['ordering'];
|
||||
$destination->save();
|
||||
|
||||
//-- get activities
|
||||
if (isset($validated['activities'][0])) {
|
||||
$activityNames = json_decode($validated['activities'][0], true);
|
||||
$activityIds = Activity::whereIn('name', $activityNames)
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
$destination->activities()->attach($activityIds);
|
||||
}
|
||||
|
||||
//-- store image
|
||||
if (isset($validated['image']) && $validated['image']->isValid()) {
|
||||
FileManagementService::storeFile(
|
||||
file: $validated['image'],
|
||||
uploadedFolderName: 'banners',
|
||||
model: $destination
|
||||
);
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
return $destination;
|
||||
} catch (Throwable $th) {
|
||||
DB::rollback();
|
||||
report($th);
|
||||
}
|
||||
}
|
||||
|
||||
//-- Update Destination
|
||||
public function updateDestination($validated, $uuid)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$destination = $this->findDestinationById($uuid);
|
||||
if (!$destination) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$destination->title = $validated['title'];
|
||||
$destination->country_id = $validated['country_id'];
|
||||
$destination->rating = $validated['rating'];
|
||||
$destination->ordering = $validated['ordering'];
|
||||
$destination->save();
|
||||
|
||||
//-- update image
|
||||
if (isset($validated['image']) && $validated['image']->isValid()) {
|
||||
FileManagementService::uploadFile(
|
||||
file: $validated['image'],
|
||||
uploadedFolderName: 'destinations',
|
||||
filePath: $destination->image_path,
|
||||
model: $destination
|
||||
);
|
||||
}
|
||||
|
||||
//-- get activities
|
||||
if (isset($validated['activities'][0])) {
|
||||
$activityNames = json_decode($validated['activities'][0], true);
|
||||
$activityIds = Activity::whereIn('name', $activityNames)
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
$destination->activities()->sync($activityIds);
|
||||
}
|
||||
return $destination;
|
||||
} catch (Throwable $th) {
|
||||
DB::rollback();
|
||||
report($th);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//-- Delete Destination
|
||||
public function deleteDestination($uuid)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$destination = $this->findDestinationById($uuid);
|
||||
|
||||
if (!$destination) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Delete the image file associated with the destination
|
||||
if ($destination->image_path !== null) {
|
||||
FileManagementService::deleteFile($destination->image_path);
|
||||
}
|
||||
|
||||
$destination->delete();
|
||||
DB::commit();
|
||||
|
||||
return true;
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollback();
|
||||
report($th);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//-- get countries
|
||||
public function getCountries()
|
||||
{
|
||||
return Country::all();
|
||||
}
|
||||
|
||||
//-- get activities
|
||||
public function getActivities()
|
||||
{
|
||||
return Activity::all();
|
||||
}
|
||||
|
||||
//-- get destination With Countries And Activities By Uuid
|
||||
public function destinationWithCountriesAndActivitiesByUuid($uuid)
|
||||
{
|
||||
return Destination::with('country', 'activities')
|
||||
->where('uuid', $uuid)
|
||||
->first();
|
||||
}
|
||||
|
||||
//-- Delete destination
|
||||
public function destinationRepository(string $uuid)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$destination = $this->findDestinationById($uuid);
|
||||
if (! $destination) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Delete the image file associated with the activity
|
||||
if ($destination->image_path !== null) {
|
||||
FileManagementService::deleteFile($destination->image_path);
|
||||
}
|
||||
$destination->delete();
|
||||
|
||||
return $destination;
|
||||
} catch (\Throwable $th) {
|
||||
DB::rollBack();
|
||||
report($th);
|
||||
}
|
||||
}
|
||||
}
|
66
Modules/Destination/app/Services/FileManagementService.php
Normal file
66
Modules/Destination/app/Services/FileManagementService.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Destination\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/Destination/composer.json
Normal file
31
Modules/Destination/composer.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "nwidart/destination",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Destination\\": "",
|
||||
"Modules\\Destination\\App\\": "app/",
|
||||
"Modules\\Destination\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Destination\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Destination\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Destination/config/.gitkeep
Normal file
0
Modules/Destination/config/.gitkeep
Normal file
5
Modules/Destination/config/config.php
Normal file
5
Modules/Destination/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Destination',
|
||||
];
|
0
Modules/Destination/database/factories/.gitkeep
Normal file
0
Modules/Destination/database/factories/.gitkeep
Normal file
0
Modules/Destination/database/migrations/.gitkeep
Normal file
0
Modules/Destination/database/migrations/.gitkeep
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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('destinations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid();
|
||||
$table->unsignedBigInteger('country_id');
|
||||
$table->string('title');
|
||||
$table->integer('rating');
|
||||
$table->integer('ordering');
|
||||
$table->string('image')->nullable();
|
||||
$table->string('image_path')->nullable();
|
||||
$table->string('status')->default('active');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('country_id')->references('id')->on('countries');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('destinations');
|
||||
}
|
||||
};
|
@@ -0,0 +1,32 @@
|
||||
<?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('activity_destination', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('destination_id');
|
||||
$table->unsignedBigInteger('activity_id');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('destination_id')->references('id')->on('destinations');
|
||||
$table->foreign('activity_id')->references('id')->on('activities');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('activity_destination');
|
||||
}
|
||||
};
|
0
Modules/Destination/database/seeders/.gitkeep
Normal file
0
Modules/Destination/database/seeders/.gitkeep
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Destination\database\seeders;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Modules\Activity\app\Models\Activity;
|
||||
use Modules\CountryList\app\Models\Country;
|
||||
use Modules\Destination\app\Models\Destination;
|
||||
|
||||
class DestinationDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
0
Modules/Destination/lang/.gitkeep
Normal file
0
Modules/Destination/lang/.gitkeep
Normal file
11
Modules/Destination/module.json
Normal file
11
Modules/Destination/module.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Destination",
|
||||
"alias": "destination",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Destination\\app\\Providers\\DestinationServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Destination/package.json
Normal file
15
Modules/Destination/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/Destination/resources/assets/.gitkeep
Normal file
0
Modules/Destination/resources/assets/.gitkeep
Normal file
0
Modules/Destination/resources/assets/js/app.js
Normal file
0
Modules/Destination/resources/assets/js/app.js
Normal file
0
Modules/Destination/resources/assets/sass/app.scss
Normal file
0
Modules/Destination/resources/assets/sass/app.scss
Normal file
0
Modules/Destination/resources/views/.gitkeep
Normal file
0
Modules/Destination/resources/views/.gitkeep
Normal file
46
Modules/Destination/resources/views/create.blade.php
Normal file
46
Modules/Destination/resources/views/create.blade.php
Normal file
@@ -0,0 +1,46 @@
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title')
|
||||
Create Destination
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbData = [
|
||||
[
|
||||
'title' => 'Destination',
|
||||
'link' => 'null',
|
||||
],
|
||||
[
|
||||
'title' => 'Dashboard',
|
||||
'link' => route('dashboard'),
|
||||
],
|
||||
[
|
||||
'title' => 'Destinations',
|
||||
'link' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Add Destination',
|
||||
'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 Destination</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('cms.destinations.store') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@include('destination::partial.form')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
49
Modules/Destination/resources/views/edit.blade.php
Normal file
49
Modules/Destination/resources/views/edit.blade.php
Normal file
@@ -0,0 +1,49 @@
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title')
|
||||
Update Destination
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbData = [
|
||||
[
|
||||
'title' => 'Destination',
|
||||
'link' => 'null',
|
||||
],
|
||||
[
|
||||
'title' => 'Dashboard',
|
||||
'link' => route('dashboard'),
|
||||
],
|
||||
[
|
||||
'title' => 'Destinations',
|
||||
'link' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Update Destination',
|
||||
'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 Destination</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('cms.destinations.update', ['uuid' => $destination->uuid]) }}" method="POST"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
@include('destination::partial.form')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
133
Modules/Destination/resources/views/index.blade.php
Normal file
133
Modules/Destination/resources/views/index.blade.php
Normal file
@@ -0,0 +1,133 @@
|
||||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title')
|
||||
Destination
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
@php
|
||||
$breadcrumbData = [
|
||||
[
|
||||
'title' => 'Destination',
|
||||
'link' => 'null',
|
||||
],
|
||||
[
|
||||
'title' => 'Dashboard',
|
||||
'link' => route('dashboard'),
|
||||
],
|
||||
[
|
||||
'title' => 'Destinations',
|
||||
'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 Destination</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.destinations.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="datatables-users table border-top">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>S.N</th>
|
||||
<th>Image</th>
|
||||
<th>Title</th>
|
||||
<th>Country</th>
|
||||
<th>Rating</th>
|
||||
<th>No of Activities</th>
|
||||
<th>Ordering</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="table-border-bottom-0">
|
||||
@foreach ($destinations ?? [] as $destination)
|
||||
<tr>
|
||||
<td>
|
||||
#{{ $loop->iteration }}
|
||||
</td>
|
||||
<td>
|
||||
<img class="object-fit-contain"
|
||||
src="{{ asset($destination->image_path ? 'storage/uploads/' . $destination->image_path : 'backend/uploads/images/no-Image.jpg') }}"
|
||||
alt="" srcset="" height="70" width="60">
|
||||
</td>
|
||||
<td>
|
||||
{{ $destination->title }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $destination->country->name }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $destination->rating }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $destination->activities_count }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $destination->ordering }}
|
||||
</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.destinations.edit', ['uuid' => $destination->uuid]) }}"><i
|
||||
class="bx bx-edit-alt me-1"></i>
|
||||
Edit</a>
|
||||
|
||||
|
||||
<form method="POST"
|
||||
action="{{ route('cms.destinations.delete', ['uuid' => $destination->uuid]) }}"
|
||||
id="deleteForm_{{ $destination->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
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="px-3">
|
||||
{{ $destinations->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/Destination/resources/views/layouts/master.blade.php
Normal file
29
Modules/Destination/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>Destination 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-destination', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-destination', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
109
Modules/Destination/resources/views/partial/form.blade.php
Normal file
109
Modules/Destination/resources/views/partial/form.blade.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<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($destination->image_path) ? 'storage/uploads/' . $destination->image_path : 'backend/uploads/images/no-Image.jpg') }}"
|
||||
alt="destination-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="{{ old('title', $destination->title ?? '') }}" placeholder="e.g. 2 Days Italy Road Trip (Couple)"
|
||||
required />
|
||||
</div>
|
||||
<div class="mb-3 col-md-6">
|
||||
<label class="form-label" for="basic-default-company">Country</label>
|
||||
<select id="select2Basic" class="select2 form-select form-select-lg" name="country_id"
|
||||
data-allow-clear="true">
|
||||
@foreach ($countries ?? [] as $country)
|
||||
<option value="{{ $country->id }}"
|
||||
{{ ($destination->country_id ?? '') == $country->id ? 'selected' : '' }}>{{ $country->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="mb-3 col-md-6">
|
||||
<label class="form-label" for="basic-default-company">Ordering</label>
|
||||
<input class="form-control" type="number" name="ordering"
|
||||
value="{{ old('ordering', $destination->ordering ?? '') }}" placeholder="e.g. 2" required />
|
||||
</div>
|
||||
|
||||
<div class="mb-3 col-md-6">
|
||||
<label class="form-label" for="basic-default-company">Rating</label><br>
|
||||
<span class='rate'>
|
||||
<input type="radio" id="star5" name="rating" value="5"
|
||||
{{ old('rating', isset($destination) ? ($destination->rating == 5 ? 'checked' : '') : '') }} />
|
||||
<label for="star5" title="5">5 stars</label>
|
||||
|
||||
<input type="radio" id="star4" name="rating" value="4"
|
||||
{{ old('rating', isset($destination) ? ($destination->rating == 4 ? 'checked' : '') : '') }} />
|
||||
<label for="star4" title="4">4 stars</label>
|
||||
|
||||
<input type="radio" id="star3" name="rating" value="3"
|
||||
{{ old('rating', isset($destination) ? ($destination->rating == 3 ? 'checked' : '') : '') }} />
|
||||
<label for="star3" title="3">3 stars</label>
|
||||
|
||||
<input type="radio" id="star2" name="rating" value="2"
|
||||
{{ old('rating', isset($destination) ? ($destination->rating == 2 ? 'checked' : '') : '') }} />
|
||||
<label for="star2" title="2">2 stars</label>
|
||||
|
||||
<input type="radio" id="star1" name="rating"
|
||||
{{ old('rating', isset($destination) ? ($destination->rating == 1 ? 'checked' : '') : '') }} />
|
||||
<label for="star1" title="1">1 star</label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="mb-3 col-md-6 all-activities destination-activities"
|
||||
data-total-activities="{{ json_encode($activities) }}"
|
||||
data-destination-activities="{{ isset($destination->activities) ? json_encode($destination->activities) : '' }}">
|
||||
<label class="form-label" for="basic-default-company">Activities List</label>
|
||||
<input id="TagifyActivityList" name="activities[]" class="form-control" placeholder="select activity"
|
||||
value="" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
@if (empty($destination))
|
||||
Save Destination
|
||||
@else
|
||||
Update Destination
|
||||
@endif
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('required-styles')
|
||||
@include('admin::vendor.tagify.style')
|
||||
@include('admin::vendor.select2.style')
|
||||
@endpush
|
||||
|
||||
@push('required-scripts')
|
||||
@include('admin::vendor.tagify.script')
|
||||
@include('admin::vendor.select2.script')
|
||||
@endpush
|
0
Modules/Destination/routes/.gitkeep
Normal file
0
Modules/Destination/routes/.gitkeep
Normal file
19
Modules/Destination/routes/api.php
Normal file
19
Modules/Destination/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('destination', fn (Request $request) => $request->user())->name('destination');
|
||||
});
|
40
Modules/Destination/routes/web.php
Normal file
40
Modules/Destination/routes/web.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Destination\app\Http\Controllers\DestinationController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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' => 'destinations.',
|
||||
'controller' => 'DestinationController',
|
||||
],
|
||||
function () {
|
||||
Route::get('destinations', 'index')->name('index');
|
||||
Route::get('destinations/create', 'create')->name('create');
|
||||
Route::post('destinations/store', 'store')->name('store');
|
||||
Route::get('destinations/{uuid}/edit', 'edit')->name('edit');
|
||||
Route::put('destinations/{uuid}/update', 'update')->name('update');
|
||||
Route::delete('destinations/{uuid}/delete', 'destroy')->name('delete');
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
0
Modules/Destination/tests/Feature/.gitkeep
Normal file
0
Modules/Destination/tests/Feature/.gitkeep
Normal file
0
Modules/Destination/tests/Unit/.gitkeep
Normal file
0
Modules/Destination/tests/Unit/.gitkeep
Normal file
26
Modules/Destination/vite.config.js
Normal file
26
Modules/Destination/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-destination',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-destination',
|
||||
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