first
This commit is contained in:
18
.editorconfig
Normal file
18
.editorconfig
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[docker-compose.yml]
|
||||||
|
indent_size = 4
|
||||||
73
.env.example
Normal file
73
.env.example
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=base64:16NaPaLHALu9iWCMF9QpDBDnzvnmu39A5ac3fU541xo=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_TIMEZONE=UTC
|
||||||
|
APP_URL=http://127.0.0.1:8000
|
||||||
|
APP_URL=http://192.168.101.41:8000
|
||||||
|
# CLIENT=visaz
|
||||||
|
CLIENT=rohini
|
||||||
|
# CLIENT=raffles
|
||||||
|
|
||||||
|
|
||||||
|
APP_LOCALE=en
|
||||||
|
APP_FALLBACK_LOCALE=en
|
||||||
|
APP_FAKER_LOCALE=en_US
|
||||||
|
|
||||||
|
APP_MAINTENANCE_DRIVER=file
|
||||||
|
# APP_MAINTENANCE_STORE=database
|
||||||
|
|
||||||
|
BCRYPT_ROUNDS=12
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_STACK=single
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=null
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=db_rohinimyurls
|
||||||
|
DB_USERNAME=root
|
||||||
|
DB_PASSWORD=
|
||||||
|
|
||||||
|
OPENROUTER_API_KEY=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
|
||||||
|
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1/chat/completions
|
||||||
|
|
||||||
|
# SESSION_DRIVER=file
|
||||||
|
SESSION_DRIVER=database
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
SESSION_ENCRYPT=false
|
||||||
|
SESSION_PATH=/
|
||||||
|
SESSION_DOMAIN=null
|
||||||
|
|
||||||
|
BROADCAST_CONNECTION=log
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
QUEUE_CONNECTION=database
|
||||||
|
|
||||||
|
CACHE_STORE=database
|
||||||
|
CACHE_PREFIX=
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
REDIS_CLIENT=phpredis
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=smtp.gmail.com
|
||||||
|
MAIL_PORT=587
|
||||||
|
MAIL_USERNAME=yuron.stha57@gmail.com
|
||||||
|
MAIL_PASSWORD=akrxjdfhcfqqlzpn
|
||||||
|
MAIL_ENCRYPTION=tls
|
||||||
|
MAIL_FROM_ADDRESS="yuron.stha57@gmail.com"
|
||||||
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||||
|
|
||||||
|
VITE_APP_NAME="${APP_NAME}"
|
||||||
11
.gitattributes
vendored
Normal file
11
.gitattributes
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
*.blade.php diff=html
|
||||||
|
*.css diff=css
|
||||||
|
*.html diff=html
|
||||||
|
*.md diff=markdown
|
||||||
|
*.php diff=php
|
||||||
|
|
||||||
|
/.github export-ignore
|
||||||
|
CHANGELOG.md export-ignore
|
||||||
|
.styleci.yml export-ignore
|
||||||
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/.phpunit.cache
|
||||||
|
/node_modules
|
||||||
|
/public/build
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/storage/*.key
|
||||||
|
/vendor
|
||||||
|
/resources/views/raffels
|
||||||
|
.env
|
||||||
|
.env.backup
|
||||||
|
.env.production
|
||||||
|
.phpactor.json
|
||||||
|
.phpunit.result.cache
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
auth.json
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
/.fleet
|
||||||
|
/.idea
|
||||||
|
/.vscode
|
||||||
|
/.zed
|
||||||
25
.htaccess
Normal file
25
.htaccess
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<ifmodule mod_rewrite.c>
|
||||||
|
<ifmodule mod_negotiation.c>
|
||||||
|
Options -MultiViews
|
||||||
|
</ifmodule>
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_FILENAME} -d [OR]
|
||||||
|
RewriteCond %{REQUEST_FILENAME} -f
|
||||||
|
RewriteRule ^ ^$1 [N]
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
|
||||||
|
RewriteRule ^(.*)$ public/$1
|
||||||
|
|
||||||
|
# Add a RewriteCond to exclude fix-storage.php from redirection
|
||||||
|
RewriteCond %{REQUEST_URI} !^/fix-storage\.php$
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^ server.php
|
||||||
|
</ifmodule>
|
||||||
|
# php -- BEGIN cPanel-generated handler, do not edit
|
||||||
|
# Set the “ea-php82” package as the default “PHP” programming language.
|
||||||
|
|
||||||
|
# php -- END cPanel-generated handler, do not edit
|
||||||
0
Modules/CCMS/app/Http/Controllers/.gitkeep
Normal file
0
Modules/CCMS/app/Http/Controllers/.gitkeep
Normal file
152
Modules/CCMS/app/Http/Controllers/BlogController.php
Normal file
152
Modules/CCMS/app/Http/Controllers/BlogController.php
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Blog;
|
||||||
|
use Modules\CCMS\Models\Category;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class BlogController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Blog::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('image', function (Blog $blog) {
|
||||||
|
return $blog->getRawOriginal('image') ? "<img src='{$blog->image}' alt='{$blog->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>" : '-';
|
||||||
|
})
|
||||||
|
->editColumn('date', '{!! getFormatted(date:$date) ?? "N/A" !!}')
|
||||||
|
->editColumn('status', function (Blog $blog) {
|
||||||
|
$status = $blog->status ? 'Published' : 'Draft';
|
||||||
|
$color = $blog->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::blog.datatable.action')
|
||||||
|
->rawColumns(['image', 'status', 'action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::blog.index', [
|
||||||
|
'title' => 'Blog List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$categoryOptions = Category::pluck('title', 'id');
|
||||||
|
return view('ccms::blog.create', [
|
||||||
|
'title' => 'Create Blog',
|
||||||
|
'editable' => false,
|
||||||
|
'categoryOptions' => $categoryOptions,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$maxOrder = Blog::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Blog::create($request->all());
|
||||||
|
flash()->success("Blog has been created!");
|
||||||
|
return redirect()->route('blog.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('ccms::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$categoryOptions = Category::pluck('title', 'id');
|
||||||
|
$blog = Blog::findOrFail($id);
|
||||||
|
return view('ccms::blog.edit', [
|
||||||
|
'title' => 'Edit Blog',
|
||||||
|
'editable' => true,
|
||||||
|
'blog' => $blog,
|
||||||
|
'categoryOptions' => $categoryOptions,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated = $request->validate([]);
|
||||||
|
$blog = Blog::findOrFail($id);
|
||||||
|
$blog->update($request->all());
|
||||||
|
flash()->success("Blog has been updated.");
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$blog = Blog::findOrFail($id);
|
||||||
|
$blog->delete();
|
||||||
|
return response()->json(['status' => 200, 'message' => "Blog has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$blogs = Blog::all();
|
||||||
|
foreach ($blogs as $blog) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $blog->id) {
|
||||||
|
$blog->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$blog = Blog::findOrFail($id);
|
||||||
|
$blog->update(['status' => !$blog->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
146
Modules/CCMS/app/Http/Controllers/BranchController.php
Normal file
146
Modules/CCMS/app/Http/Controllers/BranchController.php
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Branch;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class BranchController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Branch::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('image', function (Branch $branch) {
|
||||||
|
return "<img src='{$branch->image}' alt='{$branch->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>";
|
||||||
|
})
|
||||||
|
->editColumn('date', '{!! getFormatted(date:$date) ?? "N/A" !!}')
|
||||||
|
->editColumn('status', function (Branch $branch) {
|
||||||
|
$status = $branch->status ? 'Published' : 'Draft';
|
||||||
|
$color = $branch->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::branch.datatable.action')
|
||||||
|
->rawColumns(['image', 'status', 'action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::branch.index', [
|
||||||
|
'title' => 'Branch List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('ccms::branch.create', [
|
||||||
|
'title' => 'Create Branch',
|
||||||
|
'editable' => false,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$maxOrder = Branch::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Branch::create($request->all());
|
||||||
|
flash()->success("Branch has been created!");
|
||||||
|
return redirect()->route('branch.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('ccms::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$branch = Branch::findOrFail($id);
|
||||||
|
return view('ccms::branch.edit', [
|
||||||
|
'title' => 'Edit Branch',
|
||||||
|
'editable' => true,
|
||||||
|
'branch' => $branch,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
$validated = $request->validate([]);
|
||||||
|
$branch = Branch::findOrFail($id);
|
||||||
|
$branch->update($request->all());
|
||||||
|
flash()->success("Branch has been updated.");
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$branch = Branch::findOrFail($id);
|
||||||
|
$branch->delete();
|
||||||
|
return response()->json(['status' => 200, 'message' => "Branch has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$branchs = Branch::all();
|
||||||
|
foreach ($branchs as $branch) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $branch->id) {
|
||||||
|
$branch->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$branch = Branch::findOrFail($id);
|
||||||
|
$branch->update(['status' => !$branch->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
155
Modules/CCMS/app/Http/Controllers/CategoryController.php
Normal file
155
Modules/CCMS/app/Http/Controllers/CategoryController.php
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Category;
|
||||||
|
use Modules\CCMS\Services\CategoryService;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class CategoryController extends Controller
|
||||||
|
{
|
||||||
|
protected $categoryService;
|
||||||
|
|
||||||
|
public function __construct(CategoryService $categoryService)
|
||||||
|
{
|
||||||
|
$this->categoryService = $categoryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(?int $id = null)
|
||||||
|
{
|
||||||
|
$isEditing = !is_null($id);
|
||||||
|
$category = $isEditing ? $this->categoryService->getCategoryById($id) : null;
|
||||||
|
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Category::query()->orderBy('order');
|
||||||
|
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('status', function (Category $category) {
|
||||||
|
$status = $category->status ? 'Published' : 'Draft';
|
||||||
|
$color = $category->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::category.datatable.action')
|
||||||
|
->rawColumns(['action', 'status'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::category.index', [
|
||||||
|
'category' => $category,
|
||||||
|
'title' => $isEditing ? 'Edit Category' : 'Add Category',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$isEditing = $request->has('id');
|
||||||
|
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($isEditing) {
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'max:255','unique:categories,title,'.$request->id],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$category = $this->categoryService->updateCategory($request->id, categoryData: $validated);
|
||||||
|
flash()->success("Category for {$category->title} has been updated.");
|
||||||
|
return to_route('category.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$maxOrder = Category::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'order' => $order
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string','unique:categories,title'],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'order' => ['integer'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$category = $this->categoryService->storeCategory($validated);
|
||||||
|
flash()->success("Category for {$category->title} has been created.");
|
||||||
|
return to_route('category.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$category = $this->categoryService->getCategoryById($id);
|
||||||
|
return view('ccms::category.edit', [
|
||||||
|
'category' => $category,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$category = $this->categoryService->deleteCategory($id);
|
||||||
|
return response()->json(['status' => 200, 'message' => "Category has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$categorys = $this->categoryService->getAllCategories();
|
||||||
|
|
||||||
|
foreach ($categorys as $category) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $category->id) {
|
||||||
|
$category->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$category = Category::findOrFail($id);
|
||||||
|
$category->update(['status' => !$category->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
166
Modules/CCMS/app/Http/Controllers/CounterController.php
Normal file
166
Modules/CCMS/app/Http/Controllers/CounterController.php
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Counter;
|
||||||
|
use Modules\CCMS\Services\CounterService;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class CounterController extends Controller
|
||||||
|
{
|
||||||
|
protected $counterService;
|
||||||
|
|
||||||
|
public function __construct(CounterService $counterService)
|
||||||
|
{
|
||||||
|
$this->counterService = $counterService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(?int $id = null)
|
||||||
|
{
|
||||||
|
$isEditing = !is_null($id);
|
||||||
|
$counter = $isEditing ? $this->counterService->getCounterById($id) : null;
|
||||||
|
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Counter::query()->orderBy('order');
|
||||||
|
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('image', function (Counter $counter) {
|
||||||
|
$html = $counter->getRawOriginal('image') ? "<img src='{$counter->image}' alt='{$counter->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>" : '-';
|
||||||
|
return $html;
|
||||||
|
})
|
||||||
|
->editColumn('icon', function (Counter $counter) {
|
||||||
|
return $counter->icon ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Counter $counter) {
|
||||||
|
$status = $counter->status ? 'Published' : 'Draft';
|
||||||
|
$color = $counter->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::counter.datatable.action')
|
||||||
|
->rawColumns(['image', 'action', 'status'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::counter.index', [
|
||||||
|
'counter' => $counter,
|
||||||
|
'editable' => $isEditing ? true : false,
|
||||||
|
'title' => $isEditing ? 'Edit Counter' : 'Add Counter',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$isEditing = $request->has('id');
|
||||||
|
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($isEditing) {
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'max:255', 'unique:counters,title,' . $request->id],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'counter' => ['nullable'],
|
||||||
|
'icon' => ['nullable'],
|
||||||
|
'image' => ['nullable', 'string'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$counter = $this->counterService->updateCounter($request->id, counterData: $validated);
|
||||||
|
flash()->success("Counter for {$counter->title} has been updated.");
|
||||||
|
return to_route('counter.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$maxOrder = Counter::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'unique:counters,title'],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'icon' => ['nullable'],
|
||||||
|
'counter' => ['nullable'],
|
||||||
|
'image' => ['nullable', 'string'],
|
||||||
|
'order' => ['integer'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$counter = $this->counterService->storeCounter($validated);
|
||||||
|
flash()->success("Counter for {$counter->title} has been created.");
|
||||||
|
return to_route('counter.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$counter = $this->counterService->deleteCounter($id);
|
||||||
|
return response()->json(['status' => 200, 'message' => "Counter has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$counters = $this->counterService->getAllCategories();
|
||||||
|
|
||||||
|
foreach ($counters as $counter) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $counter->id) {
|
||||||
|
$counter->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$counter = Counter::findOrFail($id);
|
||||||
|
$counter->update(['status' => !$counter->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
145
Modules/CCMS/app/Http/Controllers/CountryController.php
Normal file
145
Modules/CCMS/app/Http/Controllers/CountryController.php
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Country;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class CountryController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Country::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('image', function (Country $country) {
|
||||||
|
return "<img src='{$country->image}' alt='{$country->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>";
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Country $country) {
|
||||||
|
$status = $country->status ? 'Published' : 'Draft';
|
||||||
|
$color = $country->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::country.datatable.action')
|
||||||
|
->rawColumns(['image', 'status', 'action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::country.index', [
|
||||||
|
'title' => 'Country List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('ccms::country.create', [
|
||||||
|
'title' => 'Create Country',
|
||||||
|
'editable' => false,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$maxOrder = Country::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Country::create($request->all());
|
||||||
|
flash()->success("Country has been created!");
|
||||||
|
return redirect()->route('country.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('ccms::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$country = Country::findOrFail($id);
|
||||||
|
return view('ccms::country.edit', [
|
||||||
|
'title' => 'Edit Country',
|
||||||
|
'editable' => true,
|
||||||
|
'country' => $country,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
$validated = $request->validate([]);
|
||||||
|
$country = Country::findOrFail($id);
|
||||||
|
$country->update($request->all());
|
||||||
|
flash()->success("Country has been updated.");
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$country = Country::findOrFail($id);
|
||||||
|
$country->delete();
|
||||||
|
return response()->json(['status' => 200, 'message' => "Country has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$countrys = Country::all();
|
||||||
|
foreach ($countrys as $country) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $country->id) {
|
||||||
|
$country->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$country = Country::findOrFail($id);
|
||||||
|
$country->update(['status' => !$country->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
208
Modules/CCMS/app/Http/Controllers/EnquiryController.php
Normal file
208
Modules/CCMS/app/Http/Controllers/EnquiryController.php
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Rules\Recaptcha;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Modules\CCMS\Models\Enquiry;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class EnquiryController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Enquiry::query()->latest();
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass(function (Enquiry $enquiry) {
|
||||||
|
return $enquiry->is_read ? 'text-muted' : 'text-dark';
|
||||||
|
})
|
||||||
|
->editColumn('class', function (Enquiry $enquiry) {
|
||||||
|
return $enquiry->class ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('subject', function (Enquiry $enquiry) {
|
||||||
|
return $enquiry->subject ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('message', function (Enquiry $enquiry) {
|
||||||
|
return $enquiry->message ?? '-';
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::enquiry.datatable.action')
|
||||||
|
->rawColumns(['action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
return view('ccms::enquiry.index', [
|
||||||
|
'title' => 'Enquiry List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function booking()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Enquiry::query()->latest()->where('type', 'booking');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass(function (Enquiry $enquiry) {
|
||||||
|
return $enquiry->is_read ? 'text-muted' : 'text-dark';
|
||||||
|
})
|
||||||
|
->editColumn('class', function (Enquiry $enquiry) {
|
||||||
|
return $enquiry->class ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('subject', function (Enquiry $enquiry) {
|
||||||
|
return $enquiry->subject ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('message', function (Enquiry $enquiry) {
|
||||||
|
return $enquiry->message ?? '-';
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::enquiry.datatable.action')
|
||||||
|
->rawColumns(['action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
return view('ccms::enquiry.index', [
|
||||||
|
'title' => 'Booking List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
$rules = [
|
||||||
|
'name' => 'required|string',
|
||||||
|
'email' => 'required|email',
|
||||||
|
'mobile' => 'nullable|numeric',
|
||||||
|
'subject' => 'nullable',
|
||||||
|
'class' => 'nullable',
|
||||||
|
'message' => 'nullable|max:250',
|
||||||
|
];
|
||||||
|
|
||||||
|
if (setting('enable_reCaptcha') == 1) {
|
||||||
|
$rules['g-recaptcha-response'] = ['required', new Recaptcha];
|
||||||
|
}
|
||||||
|
|
||||||
|
$messages = [
|
||||||
|
'email.email' => 'Must be a valid email address.',
|
||||||
|
'mobile.numeric' => 'Must be a valid phone number.',
|
||||||
|
'mobile.digits' => 'Must be a valid phone number.',
|
||||||
|
'g-recaptcha-response.required' => 'Please complete reCAPTCHA validation.',
|
||||||
|
'g-recaptcha-response' => 'Invalid reCAPTCHA.',
|
||||||
|
];
|
||||||
|
|
||||||
|
$validator = Validator::make($request->all(), $rules, $messages);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json(['errors' => $validator->errors()], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$validatedData = $validator->validated();
|
||||||
|
// $validatedData['type'] = 'enquiries'; // Set the type
|
||||||
|
|
||||||
|
Enquiry::create($validatedData);
|
||||||
|
|
||||||
|
// Enquiry::create($validator->validated());
|
||||||
|
|
||||||
|
return response()->json(['status' => 200, 'message' => "Thank you for reaching out! Your message has been received and we'll get back to you shortly."], 200);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return response()->json(['status' => 500, 'message' => 'Internal server error', 'error' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function store(Request $request)
|
||||||
|
// {
|
||||||
|
// $rules = [
|
||||||
|
// 'name' => 'required|string',
|
||||||
|
// 'email' => 'required|email',
|
||||||
|
// 'mobile' => 'nullable|numeric|digits_between:7,15',
|
||||||
|
// 'subject' => 'nullable|string|max:100',
|
||||||
|
// 'message' => 'nullable|string|max:250',
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// if (setting('enable_reCaptcha') == 1) {
|
||||||
|
// $rules['g-recaptcha-response'] = ['required', new Recaptcha];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $validator = Validator::make($request->all(), $rules);
|
||||||
|
// if ($validator->fails()) {
|
||||||
|
// return response()->json(['errors' => $validator->errors()], 422);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Enquiry::create($validator->validated());
|
||||||
|
|
||||||
|
// return response()->json([
|
||||||
|
// 'status' => 200,
|
||||||
|
// 'message' => "Thank you! We'll get back to you soon."
|
||||||
|
// ], 200);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$enquiry = Enquiry::whereId($id)->first();
|
||||||
|
if ($enquiry) {
|
||||||
|
$enquiry->delete();
|
||||||
|
}
|
||||||
|
return response()->json(['status' => 200, 'message' => 'Enquiry has been deleted!'], 200);
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function markAsRead($id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$enquiry = Enquiry::whereId($id)->first();
|
||||||
|
if ($enquiry) {
|
||||||
|
$enquiry->update(['is_read' => 1]);
|
||||||
|
}
|
||||||
|
return response()->json(['status' => 200, 'message' => 'Enquiry has been marked as read!'], 200);
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
155
Modules/CCMS/app/Http/Controllers/FaqCategoryController.php
Normal file
155
Modules/CCMS/app/Http/Controllers/FaqCategoryController.php
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\FaqCategory;
|
||||||
|
use Modules\CCMS\Services\FaqCategoryService;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class FaqCategoryController extends Controller
|
||||||
|
{
|
||||||
|
protected $faqCategoryService;
|
||||||
|
|
||||||
|
public function __construct(FaqCategoryService $faqCategoryService)
|
||||||
|
{
|
||||||
|
$this->faqCategoryService = $faqCategoryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(?int $id = null)
|
||||||
|
{
|
||||||
|
$isEditing = !is_null($id);
|
||||||
|
$faqCategory = $isEditing ? $this->faqCategoryService->getFaqCategoryById($id) : null;
|
||||||
|
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = FaqCategory::query()->orderBy('order');
|
||||||
|
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('status', function (FaqCategory $faqCategory) {
|
||||||
|
$status = $faqCategory->status ? 'Published' : 'Draft';
|
||||||
|
$color = $faqCategory->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::faqCategory.datatable.action')
|
||||||
|
->rawColumns(['action', 'status'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::faqCategory.index', [
|
||||||
|
'faqCategory' => $faqCategory,
|
||||||
|
'title' => $isEditing ? 'Edit Faq Category' : 'Add Faq Category',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$isEditing = $request->has('id');
|
||||||
|
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($isEditing) {
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'max:255','unique:faq_categories,title,'.$request->id],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$faqCategory = $this->faqCategoryService->updateFaqCategory($request->id, faqCategoryData: $validated);
|
||||||
|
flash()->success("FaqCategory for {$faqCategory->title} has been updated.");
|
||||||
|
return to_route('faqCategory.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$maxOrder = FaqCategory::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'order' => $order
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string','unique:faq_categories,title'],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'order' => ['integer'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$faqCategory = $this->faqCategoryService->storeFaqCategory($validated);
|
||||||
|
flash()->success("FaqCategory for {$faqCategory->title} has been created.");
|
||||||
|
return to_route('faqCategory.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$faqCategory = $this->faqCategoryService->getFaqCategoryById($id);
|
||||||
|
return view('ccms::faqCategory.edit', [
|
||||||
|
'faqCategory' => $faqCategory,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$faqCategory = $this->faqCategoryService->deleteFaqCategory($id);
|
||||||
|
return response()->json(['status' => 200, 'message' => "Faq Category has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$faqCategories = $this->faqCategoryService->getAllfaqCategories();
|
||||||
|
|
||||||
|
foreach ($faqCategories as $faqCategory) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $faqCategory->id) {
|
||||||
|
$faqCategory->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$faqCategory = FaqCategory::findOrFail($id);
|
||||||
|
$faqCategory->update(['status' => !$faqCategory->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
165
Modules/CCMS/app/Http/Controllers/FaqController.php
Normal file
165
Modules/CCMS/app/Http/Controllers/FaqController.php
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Faq;
|
||||||
|
use Modules\CCMS\Models\FaqCategory;
|
||||||
|
use Modules\CCMS\Services\FaqService;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class FaqController extends Controller
|
||||||
|
{
|
||||||
|
protected $faqService;
|
||||||
|
|
||||||
|
public function __construct(FaqService $faqService)
|
||||||
|
{
|
||||||
|
$this->faqService = $faqService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(?int $id = null)
|
||||||
|
{
|
||||||
|
$isEditing = !is_null($id);
|
||||||
|
$faq = $isEditing ? $this->faqService->getFaqById($id) : null;
|
||||||
|
$categoryOptions = FaqCategory::pluck('title', 'id');
|
||||||
|
|
||||||
|
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Faq::query()->orderBy('order');
|
||||||
|
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('category_id', function (Faq $faq) {
|
||||||
|
return $faq->category?->title ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Faq $faq) {
|
||||||
|
$status = $faq->status ? 'Published' : 'Draft';
|
||||||
|
$color = $faq->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::faq.datatable.action')
|
||||||
|
->rawColumns(['action', 'status'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::faq.index', [
|
||||||
|
'faq' => $faq,
|
||||||
|
'editable' => $isEditing ? true : false,
|
||||||
|
'title' => $isEditing ? 'Edit Faq' : 'Add Faq',
|
||||||
|
'categoryOptions' => $categoryOptions,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$isEditing = $request->has('id');
|
||||||
|
// dd($request->all());
|
||||||
|
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($isEditing) {
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'max:255', 'unique:faqs,title,' . $request->id],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'description' => ['required', 'string'],
|
||||||
|
'category_id' => ['nullable']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$faq = $this->faqService->updateFaq($request->id, faqData: $validated );
|
||||||
|
flash()->success("Faq for {$faq->title} has been updated.");
|
||||||
|
return to_route('faq.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$maxOrder = Faq::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'unique:faqs,title'],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'description' => ['required', 'string'],
|
||||||
|
'category_id' => ['nullable'],
|
||||||
|
'order' => ['integer'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$faq = $this->faqService->storeFaq($validated);
|
||||||
|
flash()->success("Faq for {$faq->title} has been created.");
|
||||||
|
return to_route('faq.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$faq = $this->faqService->deleteFaq($id);
|
||||||
|
return response()->json(['status' => 200, 'message' => "Faq has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$faqs = $this->faqService->getAllCategories();
|
||||||
|
|
||||||
|
foreach ($faqs as $faq) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $faq->id) {
|
||||||
|
$faq->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$faq = Faq::findOrFail($id);
|
||||||
|
$faq->update(['status' => !$faq->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
155
Modules/CCMS/app/Http/Controllers/GalleryCategoryController.php
Normal file
155
Modules/CCMS/app/Http/Controllers/GalleryCategoryController.php
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\GalleryCategory;
|
||||||
|
use Modules\CCMS\Services\GalleryCategoryService;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class GalleryCategoryController extends Controller
|
||||||
|
{
|
||||||
|
protected $galleryCategoryService;
|
||||||
|
|
||||||
|
public function __construct(GalleryCategoryService $galleryCategoryService)
|
||||||
|
{
|
||||||
|
$this->galleryCategoryService = $galleryCategoryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(?int $id = null)
|
||||||
|
{
|
||||||
|
$isEditing = !is_null($id);
|
||||||
|
$galleryCategory = $isEditing ? $this->galleryCategoryService->getGalleryCategoryById($id) : null;
|
||||||
|
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = GalleryCategory::query()->orderBy('order');
|
||||||
|
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('status', function (GalleryCategory $galleryCategory) {
|
||||||
|
$status = $galleryCategory->status ? 'Published' : 'Draft';
|
||||||
|
$color = $galleryCategory->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::galleryCategory.datatable.action')
|
||||||
|
->rawColumns(['action', 'status'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::galleryCategory.index', [
|
||||||
|
'galleryCategory' => $galleryCategory,
|
||||||
|
'title' => $isEditing ? 'Edit Gallery Category' : 'Add Gallery Category',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$isEditing = $request->has('id');
|
||||||
|
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($isEditing) {
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'max:255','unique:gallery_categories,title,'.$request->id],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$galleryCategory = $this->galleryCategoryService->updateGalleryCategory($request->id, galleryCategoryData: $validated);
|
||||||
|
flash()->success("GalleryCategory for {$galleryCategory->title} has been updated.");
|
||||||
|
return to_route('galleryCategory.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$maxOrder = GalleryCategory::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'order' => $order
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string','unique:gallery_categories,title'],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'order' => ['integer'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$galleryCategory = $this->galleryCategoryService->storeGalleryCategory($validated);
|
||||||
|
flash()->success("GalleryCategory for {$galleryCategory->title} has been created.");
|
||||||
|
return to_route('galleryCategory.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$galleryCategory = $this->galleryCategoryService->getGalleryCategoryById($id);
|
||||||
|
return view('ccms::galleryCategory.edit', [
|
||||||
|
'galleryCategory' => $galleryCategory,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$galleryCategory = $this->galleryCategoryService->deleteGalleryCategory($id);
|
||||||
|
return response()->json(['status' => 200, 'message' => "Gallery Category has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$galleryCategories = $this->galleryCategoryService->getAllgalleryCategories();
|
||||||
|
|
||||||
|
foreach ($galleryCategories as $galleryCategory) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $galleryCategory->id) {
|
||||||
|
$galleryCategory->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$galleryCategory = GalleryCategory::findOrFail($id);
|
||||||
|
$galleryCategory->update(['status' => !$galleryCategory->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
181
Modules/CCMS/app/Http/Controllers/GalleryController.php
Normal file
181
Modules/CCMS/app/Http/Controllers/GalleryController.php
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Gallery;
|
||||||
|
use Modules\CCMS\Models\GalleryCategory;
|
||||||
|
use Modules\CCMS\Services\GalleryService;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class GalleryController extends Controller
|
||||||
|
{
|
||||||
|
protected $galleryService;
|
||||||
|
|
||||||
|
public function __construct(GalleryService $galleryService)
|
||||||
|
{
|
||||||
|
$this->galleryService = $galleryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(?int $id = null)
|
||||||
|
{
|
||||||
|
// dd("hello world");
|
||||||
|
$isEditing = !is_null($id);
|
||||||
|
$gallery = $isEditing ? $this->galleryService->getGalleryById($id) : null;
|
||||||
|
$categoryOptions = GalleryCategory::pluck('title', 'id');
|
||||||
|
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Gallery::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('images', function (Gallery $gallery) {
|
||||||
|
if (!empty($gallery->images)) {
|
||||||
|
$html = '<div clas="h-stack">';
|
||||||
|
foreach ($gallery->images as $image) {
|
||||||
|
$html .= "<img src='{$image}' alt='{$gallery->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>";
|
||||||
|
}
|
||||||
|
$html .= "</div>";
|
||||||
|
}
|
||||||
|
return $html ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('link', function (Gallery $gallery) {
|
||||||
|
return $gallery->link ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('category_id', function (Gallery $gallery) {
|
||||||
|
return $gallery->category?->title ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Gallery $gallery) {
|
||||||
|
$status = $gallery->status ? 'Published' : 'Draft';
|
||||||
|
$color = $gallery->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::gallery.datatable.action')
|
||||||
|
->rawColumns(['images', 'action', 'status'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::gallery.index', [
|
||||||
|
'gallery' => $gallery,
|
||||||
|
'title' => $isEditing ? 'Edit Gallery' : 'Add Gallery',
|
||||||
|
'editable' => $isEditing ? true : false,
|
||||||
|
'categoryOptions' => $categoryOptions,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$isEditing = $request->has('id');
|
||||||
|
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($isEditing) {
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'max:255', 'unique:categories,title,' . $request->id],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'link' => ['nullable', 'string'],
|
||||||
|
'images' => ['nullable', 'string'],
|
||||||
|
'category_id' => ['nullable', 'integer'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$gallery = $this->galleryService->updateGallery($request->id, galleryData: $validated);
|
||||||
|
flash()->success("Gallery for {$gallery->title} has been updated.");
|
||||||
|
return to_route('gallery.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$maxOrder = Gallery::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'unique:galleries,title'],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'link' => ['nullable', 'string'],
|
||||||
|
'images' => ['nullable', 'string'],
|
||||||
|
'category_id' => ['nullable', 'integer'],
|
||||||
|
'order' => ['integer'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$gallery = $this->galleryService->storeGallery($validated);
|
||||||
|
flash()->success("Gallery for {$gallery->title} has been created.");
|
||||||
|
return to_route('gallery.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$gallery = $this->galleryService->getGalleryById($id);
|
||||||
|
return view('ccms::gallery.edit', [
|
||||||
|
'gallery' => $gallery,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$gallery = $this->galleryService->deleteGallery($id);
|
||||||
|
return response()->json(['status' => 200, 'message' => "Gallery has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$galleries = $this->galleryService->getAllGalleries();
|
||||||
|
|
||||||
|
foreach ($galleries as $gallery) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $gallery->id) {
|
||||||
|
$gallery->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$gallery = Gallery::findOrFail($id);
|
||||||
|
$gallery->update(['status' => !$gallery->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
195
Modules/CCMS/app/Http/Controllers/InstitutionController.php
Normal file
195
Modules/CCMS/app/Http/Controllers/InstitutionController.php
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Country;
|
||||||
|
use Modules\CCMS\Models\Institution;
|
||||||
|
use Modules\CCMS\Services\InstitutionService;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class InstitutionController extends Controller
|
||||||
|
{
|
||||||
|
protected $institutionService;
|
||||||
|
|
||||||
|
public function __construct(InstitutionService $institutionService)
|
||||||
|
{
|
||||||
|
$this->institutionService = $institutionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(?int $id = null)
|
||||||
|
{
|
||||||
|
$countryOptions = Country::where('status', 1)->pluck('title', 'id');
|
||||||
|
$isEditing = !is_null($id);
|
||||||
|
$institution = $isEditing ? $this->institutionService->getInstitutionById($id) : null;
|
||||||
|
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Institution::query()->orderBy('order');
|
||||||
|
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('country_id', function (Institution $institution) {
|
||||||
|
return $institution->country?->title ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('link', function (Institution $institution) {
|
||||||
|
return $institution->link ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('image', function (Institution $institution) {
|
||||||
|
return $institution->getRawOriginal('image') ? "<img src='{$institution->image}' alt='{$institution->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>" : '-';
|
||||||
|
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Institution $institution) {
|
||||||
|
$status = $institution->status ? 'Published' : 'Draft';
|
||||||
|
$color = $institution->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::institution.datatable.action')
|
||||||
|
->rawColumns(['image', 'action', 'status'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::institution.index', [
|
||||||
|
'institution' => $institution,
|
||||||
|
'editable' => $isEditing ? true : false,
|
||||||
|
'title' => $isEditing ? 'Edit Institution' : 'Add Institution',
|
||||||
|
'countryOptions' => $countryOptions,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$isEditing = $request->has('id');
|
||||||
|
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($isEditing) {
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'max:255', 'unique:institutions,title,' . $request->id],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'link' => ['nullable'],
|
||||||
|
'image' => ['nullable', 'string'],
|
||||||
|
'location' => ['nullable', 'string'],
|
||||||
|
'country_id' => ['nullable', 'integer']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$institution = $this->institutionService->updateInstitution($request->id, institutionData: $validated);
|
||||||
|
flash()->success("Institution for {$institution->title} has been updated.");
|
||||||
|
return to_route('institution.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$maxOrder = Institution::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'unique:institutions,title'],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'link' => ['nullable'],
|
||||||
|
'location' => ['nullable'],
|
||||||
|
'image' => ['nullable', 'string'],
|
||||||
|
'order' => ['integer'],
|
||||||
|
'country_id' => ['nullable', 'integer']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$institution = $this->institutionService->storeInstitution($validated);
|
||||||
|
flash()->success("Institution for {$institution->title} has been created.");
|
||||||
|
return to_route('institution.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$institution = $this->institutionService->deleteInstitution($id);
|
||||||
|
return response()->json(['status' => 200, 'message' => "Institution has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$institutions = $this->institutionService->getAllCategories();
|
||||||
|
|
||||||
|
foreach ($institutions as $institution) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $institution->id) {
|
||||||
|
$institution->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$institution = Institution::findOrFail($id);
|
||||||
|
$institution->update(['status' => !$institution->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInstitutionsByCountry(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$institutions = Institution::where(['country_id' => $request->country_id])
|
||||||
|
->select('id', 'status', 'title')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'data' => $institutions,
|
||||||
|
'msg' => 'Fetch',
|
||||||
|
], 200);
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'msg' => $th->getMessage(),
|
||||||
|
], 500);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
142
Modules/CCMS/app/Http/Controllers/NewsletterController.php
Normal file
142
Modules/CCMS/app/Http/Controllers/NewsletterController.php
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Rules\Recaptcha;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Modules\CCMS\Models\Newsletter;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class NewsletterController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Newsletter::query()->latest();
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('name', function (Newsletter $newsletter){
|
||||||
|
return $newsletter->name ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('email', function (Newsletter $newsletter){
|
||||||
|
return $newsletter->email ?? '-';
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::newsletter.datatable.action')
|
||||||
|
->rawColumns(['action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
return view('ccms::newsletter.index', [
|
||||||
|
'title' => 'Newsletter List',
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$rules = [
|
||||||
|
'email' => 'required|email',
|
||||||
|
'name' => 'required|string'
|
||||||
|
];
|
||||||
|
|
||||||
|
if (setting('enable_reCaptcha') == 1) {
|
||||||
|
$rules['g-recaptcha-response'] = ['required', new Recaptcha];
|
||||||
|
}
|
||||||
|
|
||||||
|
$messages = [
|
||||||
|
'email.email' => 'Must be a valid email address.',
|
||||||
|
// 'mobile.numeric' => 'Must be a valid phone number.',
|
||||||
|
// 'mobile.digits' => 'Must be a valid phone number.',
|
||||||
|
// 'g-recaptcha-response.required' => 'Please complete reCAPTCHA validation.',
|
||||||
|
// 'g-recaptcha-response' => 'Invalid reCAPTCHA.',
|
||||||
|
];
|
||||||
|
|
||||||
|
$validator = Validator::make($request->all(), $rules, $messages);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json(['errors' => $validator->errors()], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
Newsletter::create($validator->validated());
|
||||||
|
|
||||||
|
return response()->json(['status' => 200, 'message' => "Thank you for subscribing."], 200);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return response()->json(['status' => 500, 'message' => 'Internal server error', 'error' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$newsletter = Newsletter::whereId($id)->first();
|
||||||
|
if ($newsletter) {
|
||||||
|
$newsletter->delete();
|
||||||
|
}
|
||||||
|
return response()->json(['status' => 200, 'message' => 'Newsletter has been deleted!'],200);
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function markAsRead($id)
|
||||||
|
// {
|
||||||
|
// try {
|
||||||
|
// $newsletter = Newsletter::whereId($id)->first();
|
||||||
|
// if ($newsletter) {
|
||||||
|
// $newsletter->update(['is_read' => 1]);
|
||||||
|
// }
|
||||||
|
// return response()->json(['status' => 200, 'message' => 'Newsletter has been marked as read!'], 200);
|
||||||
|
|
||||||
|
// } catch (\Throwable $th) {
|
||||||
|
// return redirect()->back()->with('error', $th->getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
206
Modules/CCMS/app/Http/Controllers/PageController.php
Normal file
206
Modules/CCMS/app/Http/Controllers/PageController.php
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Modules\CCMS\Models\Page;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class PageController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Page::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('type', '{!! config("constants.page_type_options")[$type] !!}')
|
||||||
|
->editColumn('date', '{!! getFormatted(date:$date) ?? "-" !!}')
|
||||||
|
->editColumn('image', function (Page $page) {
|
||||||
|
return $page->getRawOriginal('image') ? "<img src='{$page->image}' alt='{$page->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>" : '-';
|
||||||
|
})
|
||||||
|
->addColumn('parents', function (Page $page) {
|
||||||
|
if ($page->parents->isEmpty()) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = $page->parents->map(function ($parent) {
|
||||||
|
return "<span class='badge bg-primary p-1'>{$parent->title}</span>";
|
||||||
|
})->implode(' ');
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
})
|
||||||
|
|
||||||
|
->editColumn('status', function (Page $page) {
|
||||||
|
$status = $page->status ? 'Published' : 'Draft';
|
||||||
|
$color = $page->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::page.datatable.action')
|
||||||
|
->rawColumns(['parents', 'image', 'status', 'action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::page.index', [
|
||||||
|
'title' => 'Page List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$isEditing = $request->has('id');
|
||||||
|
|
||||||
|
if ($isEditing) {
|
||||||
|
$page = Page::findOrFail($request->id);
|
||||||
|
$request->merge([
|
||||||
|
'section' => $request->section ?? null,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$maxOrder = Page::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
$request->merge([
|
||||||
|
'order' => $order,
|
||||||
|
'status' => 0,
|
||||||
|
'slug' => $request->title == 'Homepage' ? '/' : Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'max:255',
|
||||||
|
Rule::unique('pages', 'title')->ignore($isEditing ? $request->id : null),
|
||||||
|
],
|
||||||
|
'type' => ['required', 'string'],
|
||||||
|
'order' => ['nullable', 'integer'],
|
||||||
|
'section' => ['nullable', 'array'],
|
||||||
|
'slug' => ['nullable', 'string'],
|
||||||
|
'status' => ['nullable', 'integer'],
|
||||||
|
], [
|
||||||
|
'title.unique' => 'Page already exists!',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($isEditing) {
|
||||||
|
$page->update($validated);
|
||||||
|
} else {
|
||||||
|
$page = Page::create($validated);
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = $isEditing ? "Page setting for {$page->title} has been updated." : "Page setting for {$page->title} has been created.";
|
||||||
|
flash()->success($message);
|
||||||
|
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('ccms::page.show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$page = Page::findOrFail($id);
|
||||||
|
return view('ccms::page.partials._form', [
|
||||||
|
'editable' => true,
|
||||||
|
'page' => $page,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editContent($id)
|
||||||
|
{
|
||||||
|
$pageOptions = Page::where(['status' => 1, 'type' => 'page'])->pluck('title', 'id');
|
||||||
|
$page = Page::findOrFail($id);
|
||||||
|
return view('ccms::page.content', [
|
||||||
|
'title' => 'Update Page Content',
|
||||||
|
'page' => $page,
|
||||||
|
'editable' => true,
|
||||||
|
'pageOptions' => $pageOptions,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateContent(Request $request, $id)
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'parent_id' => ['nullable', 'array'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$page = Page::findOrFail($id);
|
||||||
|
|
||||||
|
if (is_null($page->date) && $request->status == 1) {
|
||||||
|
$page->date = now()->format('Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::transaction(function () use ($page, $request) {
|
||||||
|
$page->update($request->all());
|
||||||
|
if ($request->parent_id) {
|
||||||
|
$page->parents()->sync($request->parent_id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
flash()->success("Page content for {$page->title} has been updated.");
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$page = Page::findOrFail($id);
|
||||||
|
$page->delete();
|
||||||
|
return response()->json(['status' => 200, 'message' => "Page has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$pages = Page::all();
|
||||||
|
foreach ($pages as $page) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $page->id) {
|
||||||
|
$page->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$page = Page::findOrFail($id);
|
||||||
|
$page->update(['status' => !$page->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
161
Modules/CCMS/app/Http/Controllers/PartnerController.php
Normal file
161
Modules/CCMS/app/Http/Controllers/PartnerController.php
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Partner;
|
||||||
|
use Modules\CCMS\Services\PartnerService;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class PartnerController extends Controller
|
||||||
|
{
|
||||||
|
protected $partnerService;
|
||||||
|
|
||||||
|
public function __construct(PartnerService $partnerService)
|
||||||
|
{
|
||||||
|
$this->partnerService = $partnerService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(?int $id = null)
|
||||||
|
{
|
||||||
|
$isEditing = !is_null($id);
|
||||||
|
$partner = $isEditing ? $this->partnerService->getPartnerById($id) : null;
|
||||||
|
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Partner::query()->orderBy('order');
|
||||||
|
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('image', function (Partner $partner) {
|
||||||
|
return $partner->getRawOriginal('image') ? "<img src='{$partner->image}' alt='{$partner->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>" : '-';
|
||||||
|
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Partner $partner) {
|
||||||
|
$status = $partner->status ? 'Published' : 'Draft';
|
||||||
|
$color = $partner->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::partner.datatable.action')
|
||||||
|
->rawColumns(['image', 'action', 'status'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::partner.index', [
|
||||||
|
'partner' => $partner,
|
||||||
|
'editable' => $isEditing ? true : false,
|
||||||
|
'title' => $isEditing ? 'Edit Partner' : 'Add Partner',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$isEditing = $request->has('id');
|
||||||
|
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($isEditing) {
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'max:255', 'unique:partners,title,' . $request->id],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'link' => ['nullable'],
|
||||||
|
'image' => ['nullable', 'string'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$partner = $this->partnerService->updatePartner($request->id, partnerData: $validated);
|
||||||
|
flash()->success("Partner for {$partner->title} has been updated.");
|
||||||
|
return to_route('partner.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$maxOrder = Partner::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => ['required', 'string', 'unique:partners,title'],
|
||||||
|
'slug' => ['required', 'string'],
|
||||||
|
'link' => ['nullable'],
|
||||||
|
'image' => ['nullable', 'string'],
|
||||||
|
'order' => ['integer'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$partner = $this->partnerService->storePartner($validated);
|
||||||
|
flash()->success("Partner for {$partner->title} has been created.");
|
||||||
|
return to_route('partner.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$partner = $this->partnerService->deletePartner($id);
|
||||||
|
return response()->json(['status' => 200, 'message' => "Partner has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$partners = $this->partnerService->getAllCategories();
|
||||||
|
|
||||||
|
foreach ($partners as $partner) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $partner->id) {
|
||||||
|
$partner->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$partner = Partner::findOrFail($id);
|
||||||
|
$partner->update(['status' => !$partner->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
184
Modules/CCMS/app/Http/Controllers/PopupController.php
Normal file
184
Modules/CCMS/app/Http/Controllers/PopupController.php
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Popup;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class PopupController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Popup::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('images', function (Popup $popup) {
|
||||||
|
$html = '<div clas="h-stack">';
|
||||||
|
foreach ($popup->images as $image) {
|
||||||
|
$html .= "<img src='{$image}' alt='{$popup->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>";
|
||||||
|
}
|
||||||
|
$html .= "</div>";
|
||||||
|
return $html;
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Popup $popup) {
|
||||||
|
$status = $popup->status ? 'Published' : 'Draft';
|
||||||
|
$color = $popup->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::popup.datatable.action')
|
||||||
|
->rawColumns(['status', 'images', 'action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::popup.index', [
|
||||||
|
'title' => 'Popup List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('ccms::popup.create', [
|
||||||
|
'title' => 'Create Popup',
|
||||||
|
'editable' => false,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$maxOrder = Popup::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Popup::create($request->all());
|
||||||
|
flash()->success("Popup has been created!");
|
||||||
|
return redirect()->route('popup.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('ccms::popup.show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$popup = Popup::findOrFail($id);
|
||||||
|
return view('ccms::popup.edit', [
|
||||||
|
'title' => 'Edit Popup',
|
||||||
|
'editable' => true,
|
||||||
|
'popup' => $popup,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$popup = Popup::findOrFail($id);
|
||||||
|
$popup->update($request->all());
|
||||||
|
|
||||||
|
flash()->success("Popup has been updated!");
|
||||||
|
return redirect()->route('popup.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
DB::transaction(function () use ($id) {
|
||||||
|
$popup = Popup::findOrFail($id);
|
||||||
|
$popup->delete();
|
||||||
|
|
||||||
|
$higherOrders = Popup::where('id', '>', $id)->get();
|
||||||
|
|
||||||
|
if ($higherOrders) {
|
||||||
|
foreach ($higherOrders as $higherOrder) {
|
||||||
|
$higherOrder->order--;
|
||||||
|
$higherOrder->saveQuietly();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => 200, 'message' => 'Popup has been deleted!']);
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$popups = Popup::all();
|
||||||
|
|
||||||
|
foreach ($popups as $popup) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $popup->id) {
|
||||||
|
$popup->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => 200, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$popup = Popup::findOrFail($id);
|
||||||
|
$popup->update(['status' => !$popup->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
154
Modules/CCMS/app/Http/Controllers/ServiceController.php
Normal file
154
Modules/CCMS/app/Http/Controllers/ServiceController.php
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Service;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class ServiceController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Service::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('image', function (Service $service) {
|
||||||
|
return $service->getRawOriginal('image') ? "<img src='{$service->image}' alt='{$service->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>" : '-';
|
||||||
|
})
|
||||||
|
->editColumn('parent_id', function (Service $service) {
|
||||||
|
return $service->parent ? "<span class='badge bg-primary p-1'>{$service->parent?->title}</span>" : '-';
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Service $service) {
|
||||||
|
$status = $service->status ? 'Published' : 'Draft';
|
||||||
|
$color = $service->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::service.datatable.action')
|
||||||
|
->rawColumns(['parent_id','image', 'status', 'action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::service.index', [
|
||||||
|
'title' => 'Service List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$serviceOptions = Service::where('status', 1)->pluck('title', 'id');
|
||||||
|
return view('ccms::service.create', [
|
||||||
|
'title' => 'Create Service',
|
||||||
|
'editable' => false,
|
||||||
|
'serviceOptions' => $serviceOptions
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$maxOrder = Service::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// try {
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Service::create($request->all());
|
||||||
|
flash()->success("Service has been created!");
|
||||||
|
return redirect()->route('service.index');
|
||||||
|
|
||||||
|
// } catch (\Throwable $th) {
|
||||||
|
// flash()->error($th->getMessage());
|
||||||
|
|
||||||
|
// return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('ccms::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$serviceOptions = Service::where('status', 1)->pluck('title', 'id');
|
||||||
|
$service = Service::findOrFail($id);
|
||||||
|
return view('ccms::service.edit', [
|
||||||
|
'title' => 'Edit Service',
|
||||||
|
'editable' => true,
|
||||||
|
'service' => $service,
|
||||||
|
'serviceOptions' => $serviceOptions
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
$validated = $request->validate([]);
|
||||||
|
$service = Service::findOrFail($id);
|
||||||
|
$service->update($request->all());
|
||||||
|
flash()->success("Service has been updated.");
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$service = Service::findOrFail($id);
|
||||||
|
$service->delete();
|
||||||
|
return response()->json(['status' => 200, 'message' => "Service has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$services = Service::all();
|
||||||
|
foreach ($services as $service) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $service->id) {
|
||||||
|
$service->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$service = Service::findOrFail($id);
|
||||||
|
$service->update(['status' => !$service->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
84
Modules/CCMS/app/Http/Controllers/SettingController.php
Normal file
84
Modules/CCMS/app/Http/Controllers/SettingController.php
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Modules\CCMS\Models\Setting;
|
||||||
|
|
||||||
|
class SettingController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('ccms::setting.index', [
|
||||||
|
'editable' => true,
|
||||||
|
'title' => 'Edit Setting',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'enable_reCaptcha' => 0,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$input = $request->except(['_token', '_method']);
|
||||||
|
|
||||||
|
foreach ($input as $key => $value) {
|
||||||
|
Setting::updateOrCreate(
|
||||||
|
['key' => $key],
|
||||||
|
['value' => $value]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Cache::forget('setting');
|
||||||
|
return to_route('setting.index')->with('success', 'Setting have been updated!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
187
Modules/CCMS/app/Http/Controllers/SliderController.php
Normal file
187
Modules/CCMS/app/Http/Controllers/SliderController.php
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Slider;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class SliderController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Slider::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('images', function (Slider $slider) {
|
||||||
|
if (!isEmptyArray($slider->images)) {
|
||||||
|
$html = '<div clas="h-stack">';
|
||||||
|
foreach ($slider->images as $image) {
|
||||||
|
$html .= "<img src='{$image}' alt='{$slider->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$html .= "</div>";
|
||||||
|
}
|
||||||
|
return $html ?? '-';
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Slider $slider) {
|
||||||
|
$status = $slider->status ? 'Published' : 'Draft';
|
||||||
|
$color = $slider->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::slider.datatable.action')
|
||||||
|
->rawColumns(['status', 'images', 'action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::slider.index', [
|
||||||
|
'title' => 'Slider List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('ccms::slider.create', [
|
||||||
|
'title' => 'Create Slider',
|
||||||
|
'editable' => false,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$maxOrder = Slider::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// $validated = $request->validate([
|
||||||
|
// 'title' => 'required',
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
Slider::create($request->all());
|
||||||
|
flash()->success("Slider has been created!");
|
||||||
|
return redirect()->route('slider.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('ccms::slider.show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$slider = Slider::findOrFail($id);
|
||||||
|
return view('ccms::slider.edit', [
|
||||||
|
'title' => 'Edit Slider',
|
||||||
|
'editable' => true,
|
||||||
|
'slider' => $slider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// $request->validate([
|
||||||
|
// 'title' => 'required',
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
$slider = Slider::findOrFail($id);
|
||||||
|
$slider->update($request->all());
|
||||||
|
|
||||||
|
flash()->success("Slider has been updated!");
|
||||||
|
return redirect()->route('slider.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
DB::transaction(function () use ($id) {
|
||||||
|
$slider = Slider::findOrFail($id);
|
||||||
|
$slider->delete();
|
||||||
|
|
||||||
|
$higherOrders = Slider::where('id', '>', $id)->get();
|
||||||
|
|
||||||
|
if ($higherOrders) {
|
||||||
|
foreach ($higherOrders as $higherOrder) {
|
||||||
|
$higherOrder->order--;
|
||||||
|
$higherOrder->saveQuietly();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => 200, 'message' => 'Slider has been deleted!']);
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$sliders = Slider::all();
|
||||||
|
|
||||||
|
foreach ($sliders as $slider) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $slider->id) {
|
||||||
|
$slider->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => 200, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$slider = Slider::findOrFail($id);
|
||||||
|
$slider->update(['status' => !$slider->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
186
Modules/CCMS/app/Http/Controllers/TeamController.php
Normal file
186
Modules/CCMS/app/Http/Controllers/TeamController.php
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Branch;
|
||||||
|
use Modules\CCMS\Models\Team;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class TeamController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Team::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('image', function (Team $team) {
|
||||||
|
return $team->getRawOriginal('image') ? "<img src='{$team->image}' alt='{$team->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>" : '-';
|
||||||
|
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Team $team) {
|
||||||
|
$status = $team->status ? 'Published' : 'Draft';
|
||||||
|
$color = $team->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::team.datatable.action')
|
||||||
|
->rawColumns(['status', 'image', 'action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::team.index', [
|
||||||
|
'title' => 'Team List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$branchOptions = Branch::where('status', 1)->pluck('title', 'id');
|
||||||
|
return view('ccms::team.create', [
|
||||||
|
'title' => 'Create Team',
|
||||||
|
'editable' => false,
|
||||||
|
'branchOptions' => $branchOptions
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$maxOrder = Team::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Team::create($request->all());
|
||||||
|
flash()->success("Team has been created!");
|
||||||
|
return redirect()->route('team.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('ccms::team.show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$branchOptions = Branch::where('status', 1)->pluck('title', 'id');
|
||||||
|
$team = Team::findOrFail($id);
|
||||||
|
|
||||||
|
return view('ccms::team.edit', [
|
||||||
|
'title' => 'Edit Team',
|
||||||
|
'editable' => true,
|
||||||
|
'team' => $team,
|
||||||
|
'branchOptions' => $branchOptions
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$team = Team::findOrFail($id);
|
||||||
|
$team->update($request->all());
|
||||||
|
|
||||||
|
flash()->success("Team has been updated!");
|
||||||
|
return redirect()->route('team.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
DB::transaction(function () use ($id) {
|
||||||
|
$team = Team::findOrFail($id);
|
||||||
|
$team->delete();
|
||||||
|
|
||||||
|
$higherOrders = Team::where('id', '>', $id)->get();
|
||||||
|
|
||||||
|
if ($higherOrders) {
|
||||||
|
foreach ($higherOrders as $higherOrder) {
|
||||||
|
$higherOrder->order--;
|
||||||
|
$higherOrder->saveQuietly();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => 200, 'message' => 'Team has been deleted!']);
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$teams = Team::all();
|
||||||
|
|
||||||
|
foreach ($teams as $team) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $team->id) {
|
||||||
|
$team->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => 200, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$team = Team::findOrFail($id);
|
||||||
|
$team->update(['status' => !$team->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
153
Modules/CCMS/app/Http/Controllers/TestController.php
Normal file
153
Modules/CCMS/app/Http/Controllers/TestController.php
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Test;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class TestController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Test::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('image', function (Test $test) {
|
||||||
|
return $test->getRawOriginal('image') ? "<img src='{$test->image}' alt='{$test->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>" : '-';
|
||||||
|
})
|
||||||
|
->editColumn('parent_id', function (Test $test) {
|
||||||
|
return $test->parent ? "<span class='badge bg-primary p-1'>{$test->parent?->title}</span>" : '-';
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Test $test) {
|
||||||
|
$status = $test->status ? 'Published' : 'Draft';
|
||||||
|
$color = $test->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::test.datatable.action')
|
||||||
|
->rawColumns(['parent_id','image', 'status', 'action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::test.index', [
|
||||||
|
'title' => 'Test List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$testOptions = Test::where('status', 1)
|
||||||
|
->pluck('title', 'id');
|
||||||
|
return view('ccms::test.create', [
|
||||||
|
'title' => 'Create Test',
|
||||||
|
'editable' => false,
|
||||||
|
'testOptions' => $testOptions
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$maxOrder = Test::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Test::create($request->all());
|
||||||
|
flash()->success("Test has been created!");
|
||||||
|
return redirect()->route('test.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('ccms::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$testOptions = Test::where('status', 1)->pluck('title', 'id');
|
||||||
|
$test = Test::findOrFail($id);
|
||||||
|
return view('ccms::test.edit', [
|
||||||
|
'title' => 'Edit Test',
|
||||||
|
'editable' => true,
|
||||||
|
'test' => $test,
|
||||||
|
'testOptions' => $testOptions
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->merge([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
$validated = $request->validate([]);
|
||||||
|
$test = Test::findOrFail($id);
|
||||||
|
$test->update($request->all());
|
||||||
|
flash()->success("Test has been updated.");
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$test = Test::findOrFail($id);
|
||||||
|
$test->delete();
|
||||||
|
return response()->json(['status' => 200, 'message' => "Test has been deleted."], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
$tests = Test::all();
|
||||||
|
foreach ($tests as $test) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $test->id) {
|
||||||
|
$test->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => true, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$test = Test::findOrFail($id);
|
||||||
|
$test->update(['status' => !$test->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
184
Modules/CCMS/app/Http/Controllers/TestimonialController.php
Normal file
184
Modules/CCMS/app/Http/Controllers/TestimonialController.php
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Modules\CCMS\Models\Branch;
|
||||||
|
use Modules\CCMS\Models\Testimonial;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class TestimonialController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if (request()->ajax()) {
|
||||||
|
$model = Testimonial::query()->orderBy('order');
|
||||||
|
return DataTables::eloquent($model)
|
||||||
|
->addIndexColumn()
|
||||||
|
->setRowClass('tableRow')
|
||||||
|
->editColumn('image', function (Testimonial $testimonial) {
|
||||||
|
return $testimonial->getRawOriginal('image') ? "<img src='{$testimonial->image}' alt='{$testimonial->title}' class='rounded avatar-sm material-shadow ms-2 img-thumbnail'>" : '-';
|
||||||
|
})
|
||||||
|
->editColumn('status', function (Testimonial $testimonial) {
|
||||||
|
$status = $testimonial->status ? 'Published' : 'Draft';
|
||||||
|
$color = $testimonial->status ? 'text-success' : 'text-danger';
|
||||||
|
return "<p class='{$color}'>{$status}</p>";
|
||||||
|
})
|
||||||
|
->addColumn('action', 'ccms::testimonial.datatable.action')
|
||||||
|
->rawColumns(['status', 'image', 'action'])
|
||||||
|
->toJson();
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('ccms::testimonial.index', [
|
||||||
|
'title' => 'Testimonial List',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$branchOptions = Branch::where('status', 1)->pluck('title', 'id');
|
||||||
|
return view('ccms::testimonial.create', [
|
||||||
|
'title' => 'Create Testimonial',
|
||||||
|
'editable' => false,
|
||||||
|
'branchOptions' => $branchOptions
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$maxOrder = Testimonial::max('order');
|
||||||
|
$order = $maxOrder ? ++$maxOrder : 1;
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
'order' => $order,
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$validated = $request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Testimonial::create($request->all());
|
||||||
|
flash()->success("Testimonial has been created!");
|
||||||
|
return redirect()->route('testimonial.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
return view('ccms::testimonial.show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$branchOptions = Branch::where('status', 1)->pluck('title', 'id');
|
||||||
|
$testimonial = Testimonial::findOrFail($id);
|
||||||
|
return view('ccms::testimonial.edit', [
|
||||||
|
'title' => 'Edit Testimonial',
|
||||||
|
'editable' => true,
|
||||||
|
'testimonial' => $testimonial,
|
||||||
|
'branchOptions' => $branchOptions
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$request->mergeIfMissing([
|
||||||
|
'slug' => Str::slug($request->title),
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'title' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$testimonial = Testimonial::findOrFail($id);
|
||||||
|
$testimonial->update($request->all());
|
||||||
|
|
||||||
|
flash()->success("Testimonial has been updated!");
|
||||||
|
return redirect()->route('testimonial.index');
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage())->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
DB::transaction(function () use ($id) {
|
||||||
|
$testimonial = Testimonial::findOrFail($id);
|
||||||
|
$testimonial->delete();
|
||||||
|
|
||||||
|
$higherOrders = Testimonial::where('id', '>', $id)->get();
|
||||||
|
|
||||||
|
if ($higherOrders) {
|
||||||
|
foreach ($higherOrders as $higherOrder) {
|
||||||
|
$higherOrder->order--;
|
||||||
|
$higherOrder->saveQuietly();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => 200, 'message' => 'Testimonial has been deleted!']);
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return redirect()->back()->with('error', $th->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reorder(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$testimonials = Testimonial::all();
|
||||||
|
|
||||||
|
foreach ($testimonials as $testimonial) {
|
||||||
|
foreach ($request->order as $order) {
|
||||||
|
if ($order['id'] == $testimonial->id) {
|
||||||
|
$testimonial->update(['order' => $order['position']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response(['status' => 200, 'message' => 'Reordered successfully'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($id)
|
||||||
|
{
|
||||||
|
$testimonial = Testimonial::findOrFail($id);
|
||||||
|
$testimonial->update(['status' => !$testimonial->status]);
|
||||||
|
return response(['status' => 200, 'message' => 'Toggled successfully'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
93
Modules/CCMS/app/Models/Blog.php
Normal file
93
Modules/CCMS/app/Models/Blog.php
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Modules\CCMS\Traits\UpdatesCustomFieldTrait;
|
||||||
|
|
||||||
|
// use Modules\CCMS\Database\Factories\BlogFactory;
|
||||||
|
|
||||||
|
class Blog extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, UpdatesCustomFieldTrait, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'short_description',
|
||||||
|
'description',
|
||||||
|
'category_id',
|
||||||
|
'image',
|
||||||
|
'images',
|
||||||
|
'custom',
|
||||||
|
'banner',
|
||||||
|
'views',
|
||||||
|
'meta_title',
|
||||||
|
'meta_description',
|
||||||
|
'meta_keywords',
|
||||||
|
'sidebar_title',
|
||||||
|
'sidebar_content',
|
||||||
|
'sidebar_image',
|
||||||
|
'button_text',
|
||||||
|
'button_url',
|
||||||
|
'button_target',
|
||||||
|
'author',
|
||||||
|
'date',
|
||||||
|
'status',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
'order',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'custom' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function images(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
if (empty($value)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(',', $value);
|
||||||
|
return array_map(fn($part) => asset(trim($part)), $parts);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function banner(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function sidebarImage(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function category(){
|
||||||
|
return $this->belongsTo(Category::class, 'category_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
89
Modules/CCMS/app/Models/Branch.php
Normal file
89
Modules/CCMS/app/Models/Branch.php
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Modules\CCMS\Traits\UpdatesCustomFieldTrait;
|
||||||
|
|
||||||
|
// use Modules\CCMS\Database\Factories\BranchFactory;
|
||||||
|
|
||||||
|
class Branch extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, UpdatesCustomFieldTrait, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'short_description',
|
||||||
|
'description',
|
||||||
|
'image',
|
||||||
|
'images',
|
||||||
|
'custom',
|
||||||
|
'location',
|
||||||
|
'mobile',
|
||||||
|
'phone',
|
||||||
|
'email',
|
||||||
|
'banner',
|
||||||
|
'meta_title',
|
||||||
|
'meta_description',
|
||||||
|
'meta_keywords',
|
||||||
|
'sidebar_title',
|
||||||
|
'sidebar_content',
|
||||||
|
'sidebar_image',
|
||||||
|
'button_text',
|
||||||
|
'button_url',
|
||||||
|
'button_target',
|
||||||
|
'status',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
'order',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'custom' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function images(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
if (empty($value)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(',', $value);
|
||||||
|
return array_map(fn($part) => asset(trim($part)), $parts);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function banner(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function sidebarImage(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Modules/CCMS/app/Models/Category.php
Normal file
24
Modules/CCMS/app/Models/Category.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Category extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
];
|
||||||
|
}
|
||||||
38
Modules/CCMS/app/Models/Counter.php
Normal file
38
Modules/CCMS/app/Models/Counter.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
// use Modules\CCMS\Database\Factories\CounterFactory;
|
||||||
|
|
||||||
|
class Counter extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'icon',
|
||||||
|
'image',
|
||||||
|
'counter',
|
||||||
|
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
88
Modules/CCMS/app/Models/Country.php
Normal file
88
Modules/CCMS/app/Models/Country.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Modules\CCMS\Traits\UpdatesCustomFieldTrait;
|
||||||
|
|
||||||
|
class Country extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, UpdatesCustomFieldTrait, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'short_description',
|
||||||
|
'description',
|
||||||
|
'image',
|
||||||
|
'images',
|
||||||
|
'custom',
|
||||||
|
'banner',
|
||||||
|
'meta_title',
|
||||||
|
'meta_description',
|
||||||
|
'meta_keywords',
|
||||||
|
'sidebar_title',
|
||||||
|
'sidebar_content',
|
||||||
|
'sidebar_image',
|
||||||
|
'button_text',
|
||||||
|
'button_url',
|
||||||
|
'button_target',
|
||||||
|
'status',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
'order',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'custom' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function images(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
if (empty($value)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(',', $value);
|
||||||
|
return array_map(fn($part) => asset(trim($part)), $parts);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function banner(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function sidebarImage(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function institutions()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Institution::class, 'country_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
27
Modules/CCMS/app/Models/Enquiry.php
Normal file
27
Modules/CCMS/app/Models/Enquiry.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
// use Modules\CCMS\Database\Factories\EnquiryFactory;
|
||||||
|
|
||||||
|
class Enquiry extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'email',
|
||||||
|
'mobile',
|
||||||
|
'class',
|
||||||
|
'subject',
|
||||||
|
'message',
|
||||||
|
'is_read',
|
||||||
|
'type',
|
||||||
|
];
|
||||||
|
}
|
||||||
33
Modules/CCMS/app/Models/Faq.php
Normal file
33
Modules/CCMS/app/Models/Faq.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
// use Modules\CCMS\Database\Factories\FaqFactory;
|
||||||
|
|
||||||
|
class Faq extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'description',
|
||||||
|
'category_id',
|
||||||
|
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function category(){
|
||||||
|
return $this->belongsTo(FaqCategory::class, 'category_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Modules/CCMS/app/Models/FaqCategory.php
Normal file
30
Modules/CCMS/app/Models/FaqCategory.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
// use Modules\CCMS\Database\Factories\FaqCategoryFactory;
|
||||||
|
|
||||||
|
class FaqCategory extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function faqs()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Faq::class, 'category_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Modules/CCMS/app/Models/Gallery.php
Normal file
49
Modules/CCMS/app/Models/Gallery.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
// use Modules\CCMS\Database\Factories\GalleryFactory;
|
||||||
|
|
||||||
|
class Gallery extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'link',
|
||||||
|
'images',
|
||||||
|
'category_id',
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function category()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(GalleryCategory::class, 'category_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function images(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
if (empty($value)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(',', $value);
|
||||||
|
return array_map(fn($part) => asset(trim($part)), $parts);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
29
Modules/CCMS/app/Models/GalleryCategory.php
Normal file
29
Modules/CCMS/app/Models/GalleryCategory.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class GalleryCategory extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function galleries()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Gallery::class, 'category_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
43
Modules/CCMS/app/Models/Institution.php
Normal file
43
Modules/CCMS/app/Models/Institution.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
// use Modules\CCMS\Database\Factories\InstutionFactory;
|
||||||
|
|
||||||
|
class Institution extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'link',
|
||||||
|
'image',
|
||||||
|
'country_id',
|
||||||
|
'location',
|
||||||
|
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function country(){
|
||||||
|
return $this->belongsTo(Country::class, 'country_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Modules/CCMS/app/Models/Newsletter.php
Normal file
21
Modules/CCMS/app/Models/Newsletter.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
// use Modules\CCMS\Database\Factories\NewsletterFactory;
|
||||||
|
|
||||||
|
class Newsletter extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'email',
|
||||||
|
];
|
||||||
|
}
|
||||||
109
Modules/CCMS/app/Models/Page.php
Normal file
109
Modules/CCMS/app/Models/Page.php
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Modules\CCMS\Traits\UpdatesCustomFieldTrait;
|
||||||
|
|
||||||
|
// use Modules\CCMS\Database\Factories\PageFactory;
|
||||||
|
|
||||||
|
class Page extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, UpdatesCustomFieldTrait, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'section',
|
||||||
|
'template',
|
||||||
|
'type',
|
||||||
|
'description',
|
||||||
|
'short_description',
|
||||||
|
'image',
|
||||||
|
'images',
|
||||||
|
'banner',
|
||||||
|
'custom',
|
||||||
|
|
||||||
|
'link',
|
||||||
|
|
||||||
|
'sidebar_title',
|
||||||
|
'sidebar_content',
|
||||||
|
'sidebar_image',
|
||||||
|
|
||||||
|
'button_text',
|
||||||
|
'button_url',
|
||||||
|
'button_target',
|
||||||
|
|
||||||
|
'meta_title',
|
||||||
|
'meta_keywords',
|
||||||
|
'meta_description',
|
||||||
|
|
||||||
|
'date',
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
|
||||||
|
'created_by',
|
||||||
|
'updated_by',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'section' => 'array',
|
||||||
|
'custom' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function images(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
if (empty($value)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(',', $value);
|
||||||
|
return array_map(fn($part) => asset(trim($part)), $parts);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function banner(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function sidebarImage(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function children()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Page::class, 'page_relationship',
|
||||||
|
'parent_page_id', 'child_page_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function parents()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Page::class, 'page_relationship',
|
||||||
|
'child_page_id', 'parent_page_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
38
Modules/CCMS/app/Models/Partner.php
Normal file
38
Modules/CCMS/app/Models/Partner.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
// use Modules\CCMS\Database\Factories\PartnerFactory;
|
||||||
|
|
||||||
|
class Partner extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'link',
|
||||||
|
'image',
|
||||||
|
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Modules/CCMS/app/Models/Popup.php
Normal file
49
Modules/CCMS/app/Models/Popup.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
// use Modules\CCMS\Database\Factories\PopupFactory;
|
||||||
|
|
||||||
|
class Popup extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'description',
|
||||||
|
|
||||||
|
'images',
|
||||||
|
|
||||||
|
'button_text',
|
||||||
|
'button_url',
|
||||||
|
'button_target',
|
||||||
|
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
|
||||||
|
'created_by',
|
||||||
|
'updated_by',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function images(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
if (empty($value)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(',', $value);
|
||||||
|
return array_map(fn($part) => asset(trim($part)), $parts);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/CCMS/app/Models/Scopes/.gitkeep
Normal file
0
Modules/CCMS/app/Models/Scopes/.gitkeep
Normal file
103
Modules/CCMS/app/Models/Service.php
Normal file
103
Modules/CCMS/app/Models/Service.php
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Modules\CCMS\Traits\UpdatesCustomFieldTrait;
|
||||||
|
|
||||||
|
class Service extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, UpdatesCustomFieldTrait, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'short_description',
|
||||||
|
'description',
|
||||||
|
'parent_id',
|
||||||
|
'icon_class',
|
||||||
|
'icon_image',
|
||||||
|
'image',
|
||||||
|
'images',
|
||||||
|
'custom',
|
||||||
|
'banner',
|
||||||
|
'meta_title',
|
||||||
|
'meta_description',
|
||||||
|
'meta_keywords',
|
||||||
|
'sidebar_title',
|
||||||
|
'sidebar_content',
|
||||||
|
'sidebar_image',
|
||||||
|
'button_text',
|
||||||
|
'button_url',
|
||||||
|
'button_target',
|
||||||
|
'status',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
'order',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'custom' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function images(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
if (empty($value)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(',', $value);
|
||||||
|
return array_map(fn($part) => asset(trim($part)), $parts);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function banner(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function sidebarImage(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function iconImage(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function children()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Service::class, 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function parent()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Service::class, 'parent_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Modules/CCMS/app/Models/Setting.php
Normal file
23
Modules/CCMS/app/Models/Setting.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
// use Modules\CCMS\Database\Factories\SettingFactory;
|
||||||
|
|
||||||
|
class Setting extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'key',
|
||||||
|
'value',
|
||||||
|
];
|
||||||
|
}
|
||||||
48
Modules/CCMS/app/Models/Slider.php
Normal file
48
Modules/CCMS/app/Models/Slider.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Slider extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'description',
|
||||||
|
|
||||||
|
'images',
|
||||||
|
|
||||||
|
'button_text',
|
||||||
|
'button_url',
|
||||||
|
'button_target',
|
||||||
|
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
|
||||||
|
'created_by',
|
||||||
|
'updated_by',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function images(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
if (empty($value)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(',', $value);
|
||||||
|
return array_map(fn($part) => asset(trim($part)), $parts);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
56
Modules/CCMS/app/Models/Team.php
Normal file
56
Modules/CCMS/app/Models/Team.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
// use Modules\CCMS\Database\Factories\TeamFactory;
|
||||||
|
|
||||||
|
class Team extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'description',
|
||||||
|
|
||||||
|
'designation',
|
||||||
|
'branch_id',
|
||||||
|
'degree',
|
||||||
|
|
||||||
|
'address',
|
||||||
|
'email',
|
||||||
|
'mobile',
|
||||||
|
'image',
|
||||||
|
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
|
||||||
|
'facebook',
|
||||||
|
'twitter',
|
||||||
|
'linkedin',
|
||||||
|
'youtube',
|
||||||
|
'whatsapp',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function branch(){
|
||||||
|
return $this->belongsTo(Branch::class, 'branch_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
97
Modules/CCMS/app/Models/Test.php
Normal file
97
Modules/CCMS/app/Models/Test.php
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Modules\CCMS\Traits\UpdatesCustomFieldTrait;
|
||||||
|
// use Modules\CCMS\Database\Factories\TestFactory;
|
||||||
|
|
||||||
|
class Test extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, UpdatesCustomFieldTrait, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'short_description',
|
||||||
|
'description',
|
||||||
|
'image',
|
||||||
|
'images',
|
||||||
|
'custom',
|
||||||
|
'banner',
|
||||||
|
'parent_id',
|
||||||
|
'meta_title',
|
||||||
|
'meta_description',
|
||||||
|
'meta_keywords',
|
||||||
|
'sidebar_title',
|
||||||
|
'sidebar_content',
|
||||||
|
'sidebar_image',
|
||||||
|
'button_text',
|
||||||
|
'button_url',
|
||||||
|
'button_target',
|
||||||
|
'icon_class',
|
||||||
|
'icon_image',
|
||||||
|
'status',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
'order',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'custom' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function images(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function ($value) {
|
||||||
|
if (empty($value)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(',', $value);
|
||||||
|
return array_map(fn($part) => asset(trim($part)), $parts);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function banner(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function sidebarImage(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function children()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Test::class, 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function parent()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Test::class, 'parent_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
43
Modules/CCMS/app/Models/Testimonial.php
Normal file
43
Modules/CCMS/app/Models/Testimonial.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Models;
|
||||||
|
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
// use Modules\CCMS\Database\Factories\TestimonialFactory;
|
||||||
|
|
||||||
|
class Testimonial extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'slug',
|
||||||
|
'description',
|
||||||
|
'designation',
|
||||||
|
'company',
|
||||||
|
'image',
|
||||||
|
'branch_id',
|
||||||
|
'status',
|
||||||
|
'order',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function image(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => asset($value),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function branch(){
|
||||||
|
return $this->belongsTo(Branch::class, 'branch_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/CCMS/app/Providers/.gitkeep
Normal file
0
Modules/CCMS/app/Providers/.gitkeep
Normal file
118
Modules/CCMS/app/Providers/CCMSServiceProvider.php
Normal file
118
Modules/CCMS/app/Providers/CCMSServiceProvider.php
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Blade;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Nwidart\Modules\Traits\PathNamespace;
|
||||||
|
|
||||||
|
class CCMSServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
use PathNamespace;
|
||||||
|
|
||||||
|
protected string $name = 'CCMS';
|
||||||
|
|
||||||
|
protected string $nameLower = 'ccms';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boot the application events.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
$this->registerCommands();
|
||||||
|
$this->registerCommandSchedules();
|
||||||
|
$this->registerTranslations();
|
||||||
|
$this->registerConfig();
|
||||||
|
$this->registerViews();
|
||||||
|
$this->loadMigrationsFrom(module_path($this->name, 'database/migrations'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
$this->app->register(EventServiceProvider::class);
|
||||||
|
$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->nameLower);
|
||||||
|
|
||||||
|
if (is_dir($langPath)) {
|
||||||
|
$this->loadTranslationsFrom($langPath, $this->nameLower);
|
||||||
|
$this->loadJsonTranslationsFrom($langPath);
|
||||||
|
} else {
|
||||||
|
$this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower);
|
||||||
|
$this->loadJsonTranslationsFrom(module_path($this->name, 'lang'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register config.
|
||||||
|
*/
|
||||||
|
protected function registerConfig(): void
|
||||||
|
{
|
||||||
|
$this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config');
|
||||||
|
$this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register views.
|
||||||
|
*/
|
||||||
|
public function registerViews(): void
|
||||||
|
{
|
||||||
|
$viewPath = resource_path('views/modules/'.$this->nameLower);
|
||||||
|
$sourcePath = module_path($this->name, 'resources/views');
|
||||||
|
|
||||||
|
$this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']);
|
||||||
|
|
||||||
|
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower);
|
||||||
|
|
||||||
|
$componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path')));
|
||||||
|
Blade::componentNamespace($componentNamespace, $this->nameLower);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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->nameLower)) {
|
||||||
|
$paths[] = $path.'/modules/'.$this->nameLower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Modules/CCMS/app/Providers/EventServiceProvider.php
Normal file
30
Modules/CCMS/app/Providers/EventServiceProvider.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class EventServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The event handler mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array<string, array<int, string>>
|
||||||
|
*/
|
||||||
|
protected $listen = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if events should be discovered.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected static $shouldDiscoverEvents = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the proper event listeners for email verification.
|
||||||
|
*/
|
||||||
|
protected function configureEmailVerification(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
50
Modules/CCMS/app/Providers/RouteServiceProvider.php
Normal file
50
Modules/CCMS/app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
protected string $name = 'CCMS';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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')->group(module_path($this->name, '/routes/web.php'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "api" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes are typically stateless.
|
||||||
|
*/
|
||||||
|
protected function mapApiRoutes(): void
|
||||||
|
{
|
||||||
|
Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php'));
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/CCMS/app/Services/.gitkeep
Normal file
0
Modules/CCMS/app/Services/.gitkeep
Normal file
50
Modules/CCMS/app/Services/CategoryService.php
Normal file
50
Modules/CCMS/app/Services/CategoryService.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Modules\CCMS\Models\Category;
|
||||||
|
|
||||||
|
class CategoryService
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getAllCategories()
|
||||||
|
{
|
||||||
|
$query = Category::query();
|
||||||
|
return $query->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeCategory(array $categoryData): Category
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($categoryData) {
|
||||||
|
$category = Category::create($categoryData);
|
||||||
|
|
||||||
|
return $category;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCategoryById(int $id)
|
||||||
|
{
|
||||||
|
return Category::findOrFail($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateCategory(int $id, array $categoryData)
|
||||||
|
{
|
||||||
|
$category = $this->getCategoryById($id);
|
||||||
|
|
||||||
|
return DB::transaction(function () use ($category, $categoryData) {
|
||||||
|
$category->update($categoryData);
|
||||||
|
return $category;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteCategory(int $id)
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($id) {
|
||||||
|
$category = $this->getCategoryById($id);
|
||||||
|
$category->delete();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Modules/CCMS/app/Services/CounterService.php
Normal file
49
Modules/CCMS/app/Services/CounterService.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Modules\CCMS\Models\Counter;
|
||||||
|
|
||||||
|
class CounterService
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getAllCategories()
|
||||||
|
{
|
||||||
|
$query = Counter::query();
|
||||||
|
return $query->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeCounter(array $counterData): Counter
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($counterData) {
|
||||||
|
$counter = Counter::create($counterData);
|
||||||
|
|
||||||
|
return $counter;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCounterById(int $id)
|
||||||
|
{
|
||||||
|
return Counter::findOrFail($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateCounter(int $id, array $counterData)
|
||||||
|
{
|
||||||
|
$counter = $this->getCounterById($id);
|
||||||
|
|
||||||
|
return DB::transaction(function () use ($counter, $counterData) {
|
||||||
|
$counter->update($counterData);
|
||||||
|
return $counter;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteCounter(int $id)
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($id) {
|
||||||
|
$counter = $this->getCounterById($id);
|
||||||
|
$counter->delete();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Modules/CCMS/app/Services/FaqCategoryService.php
Normal file
49
Modules/CCMS/app/Services/FaqCategoryService.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Modules\CCMS\Models\FaqCategory;
|
||||||
|
|
||||||
|
class FaqCategoryService
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getAllFaqCategories()
|
||||||
|
{
|
||||||
|
$query = FaqCategory::query();
|
||||||
|
return $query->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeFaqCategory(array $faqCategoryData): FaqCategory
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($faqCategoryData) {
|
||||||
|
$faqCategory = FaqCategory::create($faqCategoryData);
|
||||||
|
|
||||||
|
return $faqCategory;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFaqCategoryById(int $id)
|
||||||
|
{
|
||||||
|
return FaqCategory::findOrFail($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateFaqCategory(int $id, array $faqCategoryData)
|
||||||
|
{
|
||||||
|
$faqCategory = $this->getFaqCategoryById($id);
|
||||||
|
|
||||||
|
return DB::transaction(function () use ($faqCategory, $faqCategoryData) {
|
||||||
|
$faqCategory->update($faqCategoryData);
|
||||||
|
return $faqCategory;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteFaqCategory(int $id)
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($id) {
|
||||||
|
$faqCategory = $this->getFaqCategoryById($id);
|
||||||
|
$faqCategory->delete();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Modules/CCMS/app/Services/FaqService.php
Normal file
49
Modules/CCMS/app/Services/FaqService.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Modules\CCMS\Models\Faq;
|
||||||
|
|
||||||
|
class FaqService
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getAllCategories()
|
||||||
|
{
|
||||||
|
$query = Faq::query();
|
||||||
|
return $query->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeFaq(array $faqData): Faq
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($faqData) {
|
||||||
|
$faq = Faq::create($faqData);
|
||||||
|
|
||||||
|
return $faq;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFaqById(int $id)
|
||||||
|
{
|
||||||
|
return Faq::findOrFail($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateFaq(int $id, array $faqData)
|
||||||
|
{
|
||||||
|
$faq = $this->getFaqById($id);
|
||||||
|
|
||||||
|
return DB::transaction(function () use ($faq, $faqData) {
|
||||||
|
$faq->update($faqData);
|
||||||
|
return $faq;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteFaq(int $id)
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($id) {
|
||||||
|
$faq = $this->getFaqById($id);
|
||||||
|
$faq->delete();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Modules/CCMS/app/Services/GalleryCategoryService.php
Normal file
49
Modules/CCMS/app/Services/GalleryCategoryService.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Modules\CCMS\Models\GalleryCategory;
|
||||||
|
|
||||||
|
class GalleryCategoryService
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getAllgalleryCategories()
|
||||||
|
{
|
||||||
|
$query = GalleryCategory::query();
|
||||||
|
return $query->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeGalleryCategory(array $galleryCategoryData): GalleryCategory
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($galleryCategoryData) {
|
||||||
|
$galleryCategory = GalleryCategory::create($galleryCategoryData);
|
||||||
|
|
||||||
|
return $galleryCategory;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGalleryCategoryById(int $id)
|
||||||
|
{
|
||||||
|
return GalleryCategory::findOrFail($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateGalleryCategory(int $id, array $galleryCategoryData)
|
||||||
|
{
|
||||||
|
$galleryCategory = $this->getGalleryCategoryById($id);
|
||||||
|
|
||||||
|
return DB::transaction(function () use ($galleryCategory, $galleryCategoryData) {
|
||||||
|
$galleryCategory->update($galleryCategoryData);
|
||||||
|
return $galleryCategory;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteGalleryCategory(int $id)
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($id) {
|
||||||
|
$galleryCategory = $this->getGalleryCategoryById($id);
|
||||||
|
$galleryCategory->delete();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
50
Modules/CCMS/app/Services/GalleryService.php
Normal file
50
Modules/CCMS/app/Services/GalleryService.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Modules\CCMS\Models\Gallery;
|
||||||
|
|
||||||
|
class GalleryService
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getAllGalleries()
|
||||||
|
{
|
||||||
|
$query = Gallery::query();
|
||||||
|
return $query->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeGallery(array $galleryData): Gallery
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($galleryData) {
|
||||||
|
$gallery = Gallery::create($galleryData);
|
||||||
|
|
||||||
|
return $gallery;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGalleryById(int $id)
|
||||||
|
{
|
||||||
|
return Gallery::findOrFail($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateGallery(int $id, array $galleryData)
|
||||||
|
{
|
||||||
|
$gallery = $this->getGalleryById($id);
|
||||||
|
|
||||||
|
return DB::transaction(function () use ($gallery, $galleryData) {
|
||||||
|
$gallery->update($galleryData);
|
||||||
|
return $gallery;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteGallery(int $id)
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($id) {
|
||||||
|
$gallery = $this->getGalleryById($id);
|
||||||
|
$gallery->delete();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Modules/CCMS/app/Services/InstitutionService.php
Normal file
49
Modules/CCMS/app/Services/InstitutionService.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Modules\CCMS\Models\Institution;
|
||||||
|
|
||||||
|
class InstitutionService
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getAllCategories()
|
||||||
|
{
|
||||||
|
$query = Institution::query();
|
||||||
|
return $query->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeInstitution(array $institutionData): Institution
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($institutionData) {
|
||||||
|
$institution = Institution::create($institutionData);
|
||||||
|
|
||||||
|
return $institution;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInstitutionById(int $id)
|
||||||
|
{
|
||||||
|
return Institution::findOrFail($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateInstitution(int $id, array $institutionData)
|
||||||
|
{
|
||||||
|
$institution = $this->getInstitutionById($id);
|
||||||
|
|
||||||
|
return DB::transaction(function () use ($institution, $institutionData) {
|
||||||
|
$institution->update($institutionData);
|
||||||
|
return $institution;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteInstitution(int $id)
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($id) {
|
||||||
|
$institution = $this->getInstitutionById($id);
|
||||||
|
$institution->delete();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
49
Modules/CCMS/app/Services/PartnerService.php
Normal file
49
Modules/CCMS/app/Services/PartnerService.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Modules\CCMS\Models\Partner;
|
||||||
|
|
||||||
|
class PartnerService
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getAllCategories()
|
||||||
|
{
|
||||||
|
$query = Partner::query();
|
||||||
|
return $query->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storePartner(array $partnerData): Partner
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($partnerData) {
|
||||||
|
$partner = Partner::create($partnerData);
|
||||||
|
|
||||||
|
return $partner;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPartnerById(int $id)
|
||||||
|
{
|
||||||
|
return Partner::findOrFail($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updatePartner(int $id, array $partnerData)
|
||||||
|
{
|
||||||
|
$partner = $this->getPartnerById($id);
|
||||||
|
|
||||||
|
return DB::transaction(function () use ($partner, $partnerData) {
|
||||||
|
$partner->update($partnerData);
|
||||||
|
return $partner;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deletePartner(int $id)
|
||||||
|
{
|
||||||
|
return DB::transaction(function () use ($id) {
|
||||||
|
$partner = $this->getPartnerById($id);
|
||||||
|
$partner->delete();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
29
Modules/CCMS/app/Traits/UpdatesCustomFieldTrait.php
Normal file
29
Modules/CCMS/app/Traits/UpdatesCustomFieldTrait.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Traits;
|
||||||
|
|
||||||
|
trait UpdatesCustomFieldTrait
|
||||||
|
{
|
||||||
|
public static function bootUpdatesCustomFieldTrait()
|
||||||
|
{
|
||||||
|
static::saving(function ($model) {
|
||||||
|
$model->processCustomFields(request());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processCustomFields($request)
|
||||||
|
{
|
||||||
|
$data = null;
|
||||||
|
if (!is_null($request->key) && !isEmptyArray($request->key)) {
|
||||||
|
foreach ($request->key as $index => $value) {
|
||||||
|
$data[] = [
|
||||||
|
'symbol' => $request->symbol[$index] ?? null,
|
||||||
|
'key' => $request->key[$index] ?? null,
|
||||||
|
'value' => $request->value[$index] ?? null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->custom = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Modules/CCMS/app/View/Components/CustomFormField.php
Normal file
25
Modules/CCMS/app/View/Components/CustomFormField.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\View\Components;
|
||||||
|
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class CustomFormField extends Component
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create a new component instance.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the view/contents that represent the component.
|
||||||
|
*/
|
||||||
|
public function render(): View|string
|
||||||
|
{
|
||||||
|
return view('ccms::components.custom-form-field');
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Modules/CCMS/composer.json
Normal file
30
Modules/CCMS/composer.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "nwidart/ccms",
|
||||||
|
"description": "",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Widart",
|
||||||
|
"email": "n.widart@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [],
|
||||||
|
"aliases": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Modules\\CCMS\\": "app/",
|
||||||
|
"Modules\\CCMS\\Database\\Factories\\": "database/factories/",
|
||||||
|
"Modules\\CCMS\\Database\\Seeders\\": "database/seeders/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Modules\\CCMS\\Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
0
Modules/CCMS/config/.gitkeep
Normal file
0
Modules/CCMS/config/.gitkeep
Normal file
5
Modules/CCMS/config/config.php
Normal file
5
Modules/CCMS/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => 'CCMS',
|
||||||
|
];
|
||||||
0
Modules/CCMS/database/factories/.gitkeep
Normal file
0
Modules/CCMS/database/factories/.gitkeep
Normal file
0
Modules/CCMS/database/migrations/.gitkeep
Normal file
0
Modules/CCMS/database/migrations/.gitkeep
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?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('pages', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->text('title');
|
||||||
|
$table->text('slug')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
$table->json('custom')->nullable();
|
||||||
|
|
||||||
|
$table->json('section')->nullable();
|
||||||
|
$table->string('banner')->nullable();
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->text('images')->nullable();
|
||||||
|
// $table->integer('parent_id')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->string('template')->nullable();
|
||||||
|
$table->string('type')->nullable();
|
||||||
|
|
||||||
|
$table->text('meta_title')->nullable();
|
||||||
|
$table->longText('meta_description')->nullable();
|
||||||
|
$table->longText('meta_keywords')->nullable();
|
||||||
|
|
||||||
|
$table->text('sidebar_title')->nullable();
|
||||||
|
$table->mediumText('sidebar_content')->nullable();
|
||||||
|
$table->string('sidebar_image')->nullable();
|
||||||
|
|
||||||
|
$table->string('button_text')->nullable();
|
||||||
|
$table->string('button_url')->nullable();
|
||||||
|
$table->string('button_target')->nullable();
|
||||||
|
|
||||||
|
$table->date('date')->nullable();
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->integer('order')->nullable();
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('pages');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?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('settings', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('key');
|
||||||
|
$table->longText('value')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('settings');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?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('sliders', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
|
||||||
|
$table->string('images')->nullable();
|
||||||
|
|
||||||
|
$table->string('button_text')->nullable();
|
||||||
|
$table->string('button_url')->nullable();
|
||||||
|
$table->string('button_target')->nullable();
|
||||||
|
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('sliders');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?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('teams', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
|
||||||
|
$table->string('designation')->nullable();
|
||||||
|
$table->string('degree')->nullable();
|
||||||
|
$table->integer('branch_id')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->string('address')->nullable();
|
||||||
|
$table->string('email')->nullable();
|
||||||
|
$table->string('mobile')->nullable();
|
||||||
|
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->string('facebook')->nullable();
|
||||||
|
$table->string('twitter')->nullable();
|
||||||
|
$table->string('linkedin')->nullable();
|
||||||
|
$table->string('youtube')->nullable();
|
||||||
|
$table->string('whatsapp')->nullable();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('teams');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?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('categories', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('categories');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?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('blogs', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->text('title');
|
||||||
|
$table->text('slug')->nullable();
|
||||||
|
$table->text('short_description')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
$table->json('custom')->nullable();
|
||||||
|
$table->integer('category_id')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->integer('views')->default(20);
|
||||||
|
$table->string('banner')->nullable();
|
||||||
|
|
||||||
|
$table->text('images')->nullable();
|
||||||
|
|
||||||
|
$table->text('meta_title')->nullable();
|
||||||
|
$table->text('meta_description')->nullable();
|
||||||
|
$table->text('meta_keywords')->nullable();
|
||||||
|
|
||||||
|
$table->text('sidebar_title')->nullable();
|
||||||
|
$table->mediumText('sidebar_content')->nullable();
|
||||||
|
$table->string('sidebar_image')->nullable();
|
||||||
|
|
||||||
|
$table->string('button_text')->nullable();
|
||||||
|
$table->string('button_url')->nullable();
|
||||||
|
$table->string('button_target')->nullable();
|
||||||
|
|
||||||
|
$table->date('date')->nullable();
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->integer('order')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('blogs');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?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('testimonials', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
|
||||||
|
$table->string('designation')->nullable();
|
||||||
|
$table->string('company')->nullable();
|
||||||
|
$table->integer('branch_id')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('testimonials');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?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('partners', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
|
||||||
|
$table->string('linka')->nullable();
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('partners');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?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('services', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->text('title');
|
||||||
|
$table->text('slug')->nullable();
|
||||||
|
$table->text('short_description')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
$table->json('custom')->nullable();
|
||||||
|
$table->integer('parent_id')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->string('banner')->nullable();
|
||||||
|
|
||||||
|
$table->text('images')->nullable();
|
||||||
|
|
||||||
|
$table->text('meta_title')->nullable();
|
||||||
|
$table->text('meta_description')->nullable();
|
||||||
|
$table->text('meta_keywords')->nullable();
|
||||||
|
|
||||||
|
$table->text('sidebar_title')->nullable();
|
||||||
|
$table->mediumText('sidebar_content')->nullable();
|
||||||
|
$table->string('sidebar_image')->nullable();
|
||||||
|
|
||||||
|
$table->string('button_text')->nullable();
|
||||||
|
$table->string('button_url')->nullable();
|
||||||
|
$table->string('button_target')->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->integer('order')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('services');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?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('countries', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->text('title');
|
||||||
|
$table->text('slug')->nullable();
|
||||||
|
$table->text('short_description')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
$table->json('custom')->nullable();
|
||||||
|
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->string('banner')->nullable();
|
||||||
|
$table->text('images')->nullable();
|
||||||
|
|
||||||
|
$table->text('meta_title')->nullable();
|
||||||
|
$table->text('meta_description')->nullable();
|
||||||
|
$table->text('meta_keywords')->nullable();
|
||||||
|
|
||||||
|
$table->text('sidebar_title')->nullable();
|
||||||
|
$table->mediumText('sidebar_content')->nullable();
|
||||||
|
$table->string('sidebar_image')->nullable();
|
||||||
|
|
||||||
|
$table->string('button_text')->nullable();
|
||||||
|
$table->string('button_url')->nullable();
|
||||||
|
$table->string('button_target')->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->integer('order')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('countries');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?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::table('pages', function (Blueprint $table) {
|
||||||
|
// $table->text('link')->nullable();
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('link');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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('gallery_categories', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('gallery_categories');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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('galleries', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->text('title');
|
||||||
|
$table->text('slug')->nullable();
|
||||||
|
$table->integer('category_id')->unsigned()->nullable();
|
||||||
|
$table->text('link')->nullable();
|
||||||
|
$table->text('images')->nullable();
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->integer('order')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('galleries');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?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('institutions', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
|
||||||
|
$table->string('link')->nullable();
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('country_id')->unsigned()->nullable();
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('institutions');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?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('faq_categories', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('faq_categories');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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('faqs', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
$table->integer('category_id')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('faqs');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?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('popups', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
|
||||||
|
$table->string('images')->nullable();
|
||||||
|
|
||||||
|
$table->string('button_text')->nullable();
|
||||||
|
$table->string('button_url')->nullable();
|
||||||
|
$table->string('button_target')->nullable();
|
||||||
|
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('popups');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?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('tests', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->text('title');
|
||||||
|
$table->text('slug')->nullable();
|
||||||
|
$table->text('short_description')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
$table->json('custom')->nullable();
|
||||||
|
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->string('banner')->nullable();
|
||||||
|
$table->text('images')->nullable();
|
||||||
|
|
||||||
|
$table->text('meta_title')->nullable();
|
||||||
|
$table->text('meta_description')->nullable();
|
||||||
|
$table->text('meta_keywords')->nullable();
|
||||||
|
|
||||||
|
$table->text('sidebar_title')->nullable();
|
||||||
|
$table->mediumText('sidebar_content')->nullable();
|
||||||
|
$table->string('sidebar_image')->nullable();
|
||||||
|
|
||||||
|
$table->string('button_text')->nullable();
|
||||||
|
$table->string('button_url')->nullable();
|
||||||
|
$table->string('button_target')->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
|
||||||
|
$table->integer('parent_id')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->integer('order')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('tests');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?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('branches', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->text('title');
|
||||||
|
$table->text('slug')->nullable();
|
||||||
|
$table->string('mobile')->nullable();
|
||||||
|
$table->string('phone')->nullable();
|
||||||
|
$table->string('location')->nullable();
|
||||||
|
$table->text('short_description')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
$table->json('custom')->nullable();
|
||||||
|
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->string('banner')->nullable();
|
||||||
|
|
||||||
|
$table->text('images')->nullable();
|
||||||
|
|
||||||
|
$table->text('meta_title')->nullable();
|
||||||
|
$table->text('meta_description')->nullable();
|
||||||
|
$table->text('meta_keywords')->nullable();
|
||||||
|
|
||||||
|
$table->text('sidebar_title')->nullable();
|
||||||
|
$table->mediumText('sidebar_content')->nullable();
|
||||||
|
$table->string('sidebar_image')->nullable();
|
||||||
|
|
||||||
|
$table->string('button_text')->nullable();
|
||||||
|
$table->string('button_url')->nullable();
|
||||||
|
$table->string('button_target')->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->integer('order')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('branches');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?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('counters', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->string('slug')->nullable();
|
||||||
|
|
||||||
|
$table->string('icon')->nullable();
|
||||||
|
$table->string('counter')->nullable();
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('order')->unsigned()->nullable();
|
||||||
|
|
||||||
|
$table->integer('createdby')->unsigned()->nullable();
|
||||||
|
$table->integer('updatedby')->unsigned()->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('counters');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?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::table('pages', function (Blueprint $table) {
|
||||||
|
$table->text('short_description')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('pages', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('short_description');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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('page_relationship', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('parent_page_id');
|
||||||
|
$table->unsignedBigInteger('child_page_id');
|
||||||
|
// $table->foreign('parent_page_id')->references('id')->on('pages')->onDelete('cascade');
|
||||||
|
// $table->foreign('child_page_id')->references('id')->on('pages')->onDelete('cascade');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('page_relationship');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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::table('services', function (Blueprint $table) {
|
||||||
|
$table->string('icon')->nullable();
|
||||||
|
$table->string('icon_class')->nullable();
|
||||||
|
$table->string('icon_image')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('services', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('icon');
|
||||||
|
$table->dropColumn('icon_class');
|
||||||
|
$table->dropColumn('icon_image');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?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('enquiries', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name')->nullable();
|
||||||
|
$table->string('email')->nullable();
|
||||||
|
$table->string('mobile')->nullable();
|
||||||
|
$table->string('type')->nullable();
|
||||||
|
$table->text('subject')->nullable();
|
||||||
|
$table->boolean('is_read')->default(0);
|
||||||
|
$table->longText('message')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('enquiries');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?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::table('institutions', function (Blueprint $table) {
|
||||||
|
$table->string('location')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('institutions', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('location');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?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('newsletters', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name')->nullable();
|
||||||
|
$table->string('email')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('newsletters');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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::table('tests', function (Blueprint $table) {
|
||||||
|
$table->string('icon')->nullable();
|
||||||
|
$table->string('icon_class')->nullable();
|
||||||
|
$table->string('icon_image')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('tests', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('icon');
|
||||||
|
$table->dropColumn('icon_class');
|
||||||
|
$table->dropColumn('icon_image');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?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::table('blogs', function (Blueprint $table) {
|
||||||
|
$table->string('author')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('blogs', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('author');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
0
Modules/CCMS/database/seeders/.gitkeep
Normal file
0
Modules/CCMS/database/seeders/.gitkeep
Normal file
16
Modules/CCMS/database/seeders/CCMSDatabaseSeeder.php
Normal file
16
Modules/CCMS/database/seeders/CCMSDatabaseSeeder.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\CCMS\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class CCMSDatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
// $this->call([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Modules/CCMS/module.json
Normal file
11
Modules/CCMS/module.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "CCMS",
|
||||||
|
"alias": "ccms",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"priority": 0,
|
||||||
|
"providers": [
|
||||||
|
"Modules\\CCMS\\Providers\\CCMSServiceProvider"
|
||||||
|
],
|
||||||
|
"files": []
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user