firstcommit

This commit is contained in:
2025-08-17 16:23:14 +05:45
commit 76bf4c0a18
2648 changed files with 362795 additions and 0 deletions

View File

@@ -0,0 +1,138 @@
<?php
namespace Modules\Client\app\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Modules\Client\app\Http\Requests\CreateClientRequest;
use Modules\Client\app\Repositories\ClientRepository;
class ClientController extends Controller
{
protected $clientRepository;
public function __construct()
{
$this->clientRepository = new ClientRepository();
}
/**
* 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') : [];
$clients = $this->clientRepository->allClients($perPage, $filter);
return view('client::index', compact('clients'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('client::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(CreateClientRequest $request): RedirectResponse
{
try {
$validated = $request->validated();
$this->clientRepository->storeClient($validated);
toastr()->success('Client created successfully.');
return redirect()->route('cms.clients.index');
} catch (\Throwable $th) {
report($th);
toastr()->error('Something went wrong.');
return back();
}
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('client::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($uuid)
{
$client = $this->clientRepository->findClientByUuid($uuid);
if (! $client) {
toastr()->error('Client not found.');
return back();
}
return view('client::edit', compact('client'));
}
/**
* Update the specified resource in storage.
*/
public function update(CreateClientRequest $request, $uuid): RedirectResponse
{
try {
$validated = $request->validated();
$client = $this->clientRepository->updateClient($validated, $uuid);
if (! $client) {
toastr()->error('Client not found !');
return back();
}
toastr()->success('Client updated successfully.');
return redirect()->route('cms.clients.index');
} catch (\Throwable $th) {
report($th);
toastr()->error('Something went wrong.');
return back();
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy($uuid)
{
try {
$client = $this->clientRepository->deleteClient($uuid);
if (! $client) {
toastr()->error('Client not found.');
return back();
}
DB::commit();
toastr()->success('Client deleted successfully.');
return redirect()->route('cms.clients.index');
} catch (\Throwable $th) {
report($th);
toastr()->error('Something went wrong.');
return back();
}
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace Modules\Client\app\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateClientRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'name' => 'required|string|max:255|regex:/^(?![ .]+$)(?!\.)(?!.*[. ])[a-zA-Z. ]+$/',
'status' => 'required|in:active,inactive',
'link' => 'sometimes|nullable|string|max:10000',
'image' => 'sometimes|nullable|mimes:png,jpg,jpeg',
];
}
public function messages()
{
return [
'name.required' => 'The name field is required.',
'name.string' => 'The name field must be a string.',
'name.max' => 'The name may not be greater than 255 characters.',
'name.regex' => 'The name field only accepts letters, spaces, and dots, and must not start with a dot or contain both spaces and dots only.',
'status.required' => 'The status field is required.',
'status.in' => 'The status field must be either "active" or "inactive".',
'link.string' => 'The link field must be a string.',
'link.max' => 'The link may not be greater than 10000 characters.',
'image.mimes' => 'The image must be a file of type: png, jpg, jpeg.',
];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
}

View File

View File

@@ -0,0 +1,43 @@
<?php
namespace Modules\Client\app\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Client\Database\factories\ClientFactory;
class Client extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'uuid',
'name',
'image',
'image_path',
'status',
'link',
];
protected static function newFactory(): ClientFactory
{
//return ClientFactory::new();
}
/**
*
*/
public function getFullImageAttribute()
{
$result = null;
if($this->image_path) {
$result = asset('storage/uploads/' . $this->image_path);
}
return $result;
}
}

View File

View File

@@ -0,0 +1,114 @@
<?php
namespace Modules\Client\app\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class ClientServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Client';
protected string $moduleNameLower = 'client';
/**
* 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;
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace Modules\Client\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\Client\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('Client', '/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('Client', '/routes/api.php'));
}
}

View File

@@ -0,0 +1,126 @@
<?php
namespace Modules\Client\app\Repositories;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Modules\Banner\app\Services\FileManagementService;
use Modules\Client\app\Models\Client;
class ClientRepository
{
//-- Retrieve all Services
public function allClients($perPage = null, $filter = [], $sort = ['by' => 'id', 'sort' => 'DESC'])
{
return Client::when(array_keys($filter, true), function ($query) use ($filter) {
if (! empty($filter['title'])) {
$query->where('title', $filter['title']);
}
if (! empty($filter['price'])) {
$query->where('price', 'like', '%'.$filter['price'].'%');
}
})
->orderBy($sort['by'], $sort['sort'])
->paginate($perPage ?: env('PAGE_LIMIT', 999));
}
//-- Find Client by uuid
public function findClientByUuid($uuid)
{
return Client::where('uuid', $uuid)->first();
}
public function storeClient(array $validated)
{
DB::beginTransaction();
try {
$client = new Client();
$client->uuid = Str::uuid();
$client->name = $validated['name'];
$client->link = $validated['link'];
$client->status = $validated['status'];
$client->save();
//-- store image
if (isset($validated['image']) && $validated['image']->isValid()) {
FileManagementService::storeFile(
file: $validated['image'],
uploadedFolderName: 'clients',
model: $client
);
}
DB::commit();
return $client;
} catch (\Throwable $th) {
report($th);
DB::rollback();
return null;
}
}
public function updateClient($validated, $uuid)
{
DB::beginTransaction();
try {
$client = $this->findClientByUuid($uuid);
if (! $client) {
return null;
}
$client->name = $validated['name'];
$client->link = $validated['link'];
$client->status = $validated['status'];
$client->save();
//-- update image
if (isset($validated['image']) && $validated['image']->isValid()) {
FileManagementService::uploadFile(
file: $validated['image'],
uploadedFolderName: 'clients',
filePath: $client->image_path,
model: $client
);
}
DB::commit();
return $client;
} catch (\Throwable $th) {
report($th);
DB::rollBack();
return null;
}
}
//-- Delete Client
public function deleteClient(string $uuid)
{
DB::beginTransaction();
try {
$client = $this->findClientByUuid($uuid);
if (! $client) {
return null;
}
// Delete the image file associated with the Client
if ($client->image_path !== null) {
FileManagementService::deleteFile($client->image_path);
}
$client->delete();
DB::commit();
return $client;
} catch (\Throwable $th) {
DB::rollBack();
report($th);
return null;
}
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace Modules\Client\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.');
}
}
}

View File

@@ -0,0 +1,31 @@
{
"name": "nwidart/client",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\Client\\": "",
"Modules\\Client\\App\\": "app/",
"Modules\\Client\\Database\\Factories\\": "database/factories/",
"Modules\\Client\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\Client\\Tests\\": "tests/"
}
}
}

View File

View File

@@ -0,0 +1,5 @@
<?php
return [
'name' => 'Client',
];

View File

@@ -0,0 +1,33 @@
<?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('clients', function (Blueprint $table) {
$table->id();
$table->uuid();
$table->string('name');
$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('clients');
}
};

View File

@@ -0,0 +1,29 @@
<?php
namespace Modules\Client;
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::table('clients', function (Blueprint $table) {
$table->string('link', 10000)->nullable()->after('name');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('clients', function (Blueprint $table) {
$table->dropColumn('link');
});
}
};

View File

View File

@@ -0,0 +1,105 @@
<?php
namespace Modules\Client\database\seeders;
use Illuminate\Support\Str;
use Illuminate\Database\Seeder;
use Modules\Client\app\Models\Client;
use Illuminate\Support\Facades\Storage;
class ClientDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
$clients = [
[
'image' => 'c7.png',
'uuid' => Str::uuid(),
'name' => 'logo',
'link' => 'example.com',
],
[
'image' => 'c1.png',
'uuid' => Str::uuid(),
'name' => 'chrome',
'link' => 'example.com',
],
[
'image' => 'c4.png',
'uuid' => Str::uuid(),
'name' => 'echo',
'link' => 'example.com',
],
[
'image' => 'c8.png',
'uuid' => Str::uuid(),
'name' => 'nutrifes',
'link' => 'example.com',
],
[
'image' => 'c2.png',
'uuid' => Str::uuid(),
'name' => 'cocacola',
'link' => 'example.com',
],
[
'image' => 'c3.png',
'uuid' => Str::uuid(),
'name' => 'delly',
'link' => 'example.com',
],
[
'image' => 'c5.png',
'uuid' => Str::uuid(),
'name' => 'google2',
'link' => 'example.com',
],
[
'image' => 'c6.png',
'uuid' => Str::uuid(),
'name' => 'gradeup',
'link' => 'example.com',
],
];
foreach ($clients as $client) {
$cmsactivity = Client::create([
'uuid' => Str::uuid(),
'name' => $client['name'],
'link' => $client['link'],
]);
// Add image to the created banner
$this->uploadImageForClient($client['image'], $cmsactivity);
}
}
private function uploadImageForClient(string $imageFileName, $cmsbanner)
{
$seederDirPath = 'clients/';
// Generate a unique filename for the new image
$newFileName = Str::uuid() . '.jpg';
// Storage path for the new image
$storagePath = '/clients/' . $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();
}
}
}

View File

View File

@@ -0,0 +1,11 @@
{
"name": "Client",
"alias": "client",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Client\\app\\Providers\\ClientServiceProvider"
],
"files": []
}

View 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"
}
}

View File

View File

View File

@@ -0,0 +1,55 @@
@extends('admin::layouts.master')
@section('title')
Create Client
@endsection
@section('breadcrumb')
@php
$breadcrumbData = [
[
'title' => 'Client',
'link' => 'null',
],
[
'title' => 'Dashboard',
'link' => route('dashboard'),
],
[
'title' => 'Clients',
'link' => null,
],
[
'title' => 'Add Client',
'link' => null,
],
];
@endphp
@include('admin::layouts.partials.breadcrumb', $breadcrumbData)
@endsection
@section('content')
{{-- {!! Form::open([
'route' => 'clients.store',
'method' => 'POST',
'role' => 'form',
'files' => true,
]) !!} --}}
{{-- {!! Form::close() !!} --}}
<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 Client</h5>
</div>
<div class="card-body">
<form
action="{{ route('cms.clients.store')}}"
method="POST" enctype="multipart/form-data">
@csrf
@include('client::partial.form')
</form>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,58 @@
@extends('admin::layouts.master')
@section('title')
Update Client
@endsection
@section('breadcrumb')
@php
$breadcrumbData = [
[
'title' => 'Client',
'link' => 'null',
],
[
'title' => 'Dashboard',
'link' => route('dashboard'),
],
[
'title' => 'Clients',
'link' => null,
],
[
'title' => 'Update Client',
'link' => null,
],
];
@endphp
@include('admin::layouts.partials.breadcrumb', $breadcrumbData)
@endsection
@section('content')
{{-- {!! Form::open([
'route' => 'clients.edit',
'method' => 'POST',
'role' => 'form',
'files' => true,
{{-- {!! Form::close() !!} --}}
<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 Client</h5>
</div>
<div class="card-body">
<form action="{{ route('cms.clients.update', ['uuid' => $client->uuid]) }}" method="POST"
enctype="multipart/form-data">
@csrf
@method('PUT')
@include('client::partial.form')
</form>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,134 @@
@extends('admin::layouts.master')
@section('title')
Client
@endsection
@section('breadcrumb')
@php
$breadcrumbData = [
[
'title' => 'Client',
'link' => 'null',
],
[
'title' => 'Dashboard',
'link' => route('dashboard'),
],
[
'title' => 'Clients',
'link' => null,
],
];
@endphp
@include('admin::layouts.partials.breadcrumb', $breadcrumbData)
@endsection
@section('content')
<!-- clients List Table -->
<div class="card">
<div class="row">
<div class="col-md-6">
<h4 class="card-header">List of Client</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.clients.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>Name With Image</th>
<th>Created At</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody class="table-border-bottom-0">
@if(count($clients) > 0)
@foreach ($clients ?? [] as $client)
<tr>
<td>
#{{ $loop->iteration }}
</td>
<td>
<div class="d-flex align-items-center me-3">
<img src="{{ asset($client->image_path ? 'storage/uploads/' . $client->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">{{ $client->name }}</h6>
<small class="text-muted">{{ Str::limit($client->link, 80) }}</small>
</div>
</div>
</td>
<td>
{{ $client->created_at->toFormattedDateString() }}
</td>
<td>
<span
class="badge bg-label-{{ $client->status == 'active' ? 'success' : 'danger' }}">
{{ $client->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.clients.edit', ['uuid' => $client->uuid]) }}"><i
class="bx bx-edit-alt me-1"></i>
Edit</a>
<form method="POST"
action="{{ route('cms.clients.delete', ['uuid' => $client->uuid]) }}"
id="deleteForm_{{ $client->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="6">No record found.</td>
</tr>
@endif
</tbody>
</table>
</div>
<div class="px-3">
{{ $clients->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

View 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>Client 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-client', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-client', 'resources/assets/js/app.js') }} --}}
</body>

View File

@@ -0,0 +1,75 @@
<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($client->image_path) ? 'storage/uploads/' . $client->image_path : 'backend/uploads/images/no-Image.jpg') }}"
alt="client-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">Name</label>
<input type="text" class="form-control" name="name" value="{{ old('name', $client->name ?? '') }}"
placeholder="e.g. Google Drive" required />
@error('name')
<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="select2 form-select" id="basic-default-company select2Basic"
aria-label="Default select example" name="status" required>
<option value="active"{{ ($client->status ?? '') == 'active' ? 'selected' : '' }}>Active</option>
<option value="inactive"{{ ($client->status ?? '') == 'inactive' ? 'selected' : '' }}>Inactive</option>
</select>
@error('status')
<div class="text-danger">{{ $message }}</div>
@enderror
</div>
<div class="mb-3 col-md-12">
<label for="exampleFormControlTextarea1" class="form-label">Link</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3" name="link"
placeholder="e.g:client video link">{{ !empty($client) ? $client->link : '' }}</textarea>
@error('link')
<div class="text-danger">{{ $message }}</div>
@enderror
</div>
</div>
<div>
<button type="submit" class="btn btn-primary">
@if (empty($client))
Save Client
@else
Update Client
@endif
</button>
</div>
</div>
@push('required-styles')
@include('admin::vendor.select2.style')
@endpush
@push('required-scripts')
@include('admin::vendor.select2.script')
@endpush

View File

View 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('client', fn (Request $request) => $request->user())->name('client');
});

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Client\app\Http\Controllers\ClientController;
/*
|--------------------------------------------------------------------------
| 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' => 'clients.',
'controller' => 'ClientController',
],
function () {
Route::get('clients', 'index')->name('index');
Route::get('clients/create', 'create')->name('create');
Route::post('clients/store', 'store')->name('store');
Route::get('clients/{uuid}/edit', 'edit')->name('edit');
Route::put('clients/{uuid}/update', 'update')->name('update');
Route::delete('clients/{uuid}/delete', 'destroy')->name('delete');
}
);
}
);

View File

View File

View File

@@ -0,0 +1,26 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
build: {
outDir: '../../public/build-client',
emptyOutDir: true,
manifest: true,
},
plugins: [
laravel({
publicDirectory: '../../public',
buildDirectory: 'build-client',
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',
//];