mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-15 11:07:53 -04:00
82 lines
2.5 KiB
PHP
82 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace Modules\GeneralSetting\Http\Controllers;
|
|
|
|
use Brian2694\Toastr\Facades\Toastr;
|
|
use Exception;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Routing\Controller;
|
|
use Modules\GeneralSetting\Repositories\GeneralSettingRepository;
|
|
use \Modules\GeneralSetting\Services\NotificationSettingService;
|
|
use Modules\UserActivityLog\Traits\LogActivity;
|
|
|
|
class NotificationSettingController extends Controller
|
|
{
|
|
|
|
protected $notificationSettingService;
|
|
|
|
public function __construct(NotificationSettingService $notificationSettingService)
|
|
{
|
|
$this->middleware('maintenance_mode');
|
|
$this->notificationSettingService = $notificationSettingService;
|
|
}
|
|
|
|
|
|
public function index()
|
|
{
|
|
try {
|
|
$notificationSettings = $this->notificationSettingService->all();
|
|
return view('generalsetting::notifications.index', compact('notificationSettings'));
|
|
} catch (Exception $e) {
|
|
LogActivity::errorLog($e->getMessage());
|
|
Toastr::error(__('common.Something Went Wrong'));
|
|
return back();
|
|
}
|
|
}
|
|
|
|
|
|
public function edit($id)
|
|
{
|
|
try {
|
|
$notificationSetting = $this->notificationSettingService->single($id);
|
|
return view('generalsetting::notifications.edit', compact('notificationSetting'));
|
|
} catch (Exception $e) {
|
|
LogActivity::errorLog($e->getMessage());
|
|
Toastr::error(__('common.Something Went Wrong'));
|
|
return back();
|
|
}
|
|
}
|
|
|
|
|
|
public function update(Request $request, $id)
|
|
{
|
|
|
|
try {
|
|
$request->validate([
|
|
'message' => 'required',
|
|
]);
|
|
$this->notificationSettingService->update($request, $id);
|
|
Toastr::success(__('common.updated_successfully'),__('common.success'));
|
|
LogActivity::successLog('notification updated successful.');
|
|
return redirect()->route('notificationsetting.index');
|
|
} catch (Exception $e) {
|
|
LogActivity::errorLog($e->getMessage());
|
|
Toastr::error(__('common.Something Went Wrong'));
|
|
return back();
|
|
}
|
|
}
|
|
|
|
public function pushNotification(){
|
|
return view('generalsetting::push_notifications.index');
|
|
}
|
|
|
|
public function pushNotificationStore(Request $request){
|
|
if($request->ajax())
|
|
{
|
|
$general_repo = new GeneralSettingRepository();
|
|
$general_repo->overWriteEnvFile('FCM_SERVER_KEY', $request->server_key);
|
|
return true;
|
|
}
|
|
}
|
|
}
|