fixed shortcode edit issues plus refactoring
This commit is contained in:
@@ -23,7 +23,6 @@ class LoginController extends Controller
|
||||
return redirect(url('login'))->withErrors("No session found. You need to be logged in!");
|
||||
}
|
||||
$otp_code = Str::random(6);
|
||||
\Log::info($otp_code);
|
||||
request()->session()->put('current_otpuser.otp', $otp_code);
|
||||
$otp_user = session('current_otpuser');
|
||||
|
||||
@@ -33,6 +32,7 @@ class LoginController extends Controller
|
||||
'auth_name' => $otp_user['name']
|
||||
];
|
||||
dispatch(new SendOtpEmailAlert($otp_set));
|
||||
\Log::info($otp_code);
|
||||
$data = [
|
||||
'otp_user_id' => $otp_user['id'],
|
||||
'page_title' => 'Login OTP',
|
||||
@@ -46,6 +46,9 @@ class LoginController extends Controller
|
||||
return redirect(url('login'))->withErrors("$random | You need to be logged in ");
|
||||
}
|
||||
$otp_user = session('current_otpuser');
|
||||
|
||||
// dump(session('current_otpuser.otp'));
|
||||
\Log::info(session('current_otpuser.otp'));
|
||||
$data = [
|
||||
'otp_user_id' => $otp_user['id'],
|
||||
'page_title' => 'Login OTP',
|
||||
|
||||
@@ -353,6 +353,7 @@ class NetworkOperatorsController extends Controller
|
||||
$status_bg = "danger";
|
||||
}
|
||||
$rate_types = ['flat_rate' => 'Flat Rate', 'sliding' => 'Sliding Scale'];
|
||||
$contract_types = ['Bilateral' => 'Bilateral', 'Unilateral' => 'Unilateral'];
|
||||
$data = [
|
||||
'page_title' => 'Edit Network Operator',
|
||||
'network_arr' => $network_arr,
|
||||
@@ -375,7 +376,8 @@ class NetworkOperatorsController extends Controller
|
||||
'ip_addresses' => $ip_addresses,
|
||||
'notes_arr' => $notes_arr,
|
||||
'recent_payments' => $recent_payments,
|
||||
'service_type_names' => $service_type_names
|
||||
'service_type_names' => $service_type_names,
|
||||
'contract_types' => $contract_types
|
||||
];
|
||||
return view('network_ops.edit', $data);
|
||||
}
|
||||
|
||||
@@ -98,9 +98,24 @@ class ShortCodesController extends Controller{
|
||||
->select('code_type', \DB::raw('count(*) as total'))
|
||||
->groupBy('code_type')
|
||||
->get();
|
||||
$networks_raw = [
|
||||
'AirtelTigo GH' => 'AirtelTigo GH',
|
||||
'MTN GH' => 'MTN GH',
|
||||
'Airtel MW' => 'Airtel MW',
|
||||
'Airtel Zambia' => 'Airtel Zambia',
|
||||
'TNM MW' => 'TNM MW',
|
||||
'Airtel MW' => 'Airtel MW',
|
||||
'Safaricom Kenya' => 'Safaricom Kenya',
|
||||
'Airtel Kenya' => 'Airtel Kenya',
|
||||
'Telkom Kenya' => 'Telkom Kenya',
|
||||
'Orange Kenya' => 'Orange Kenya'
|
||||
];
|
||||
sort($networks_raw);
|
||||
|
||||
$data = [
|
||||
'page_title' => 'Short Codes',
|
||||
'type' => 'USSD',
|
||||
'networks_raw' => array_combine($networks_raw, $networks_raw),
|
||||
'codes_data' => $codes_data,
|
||||
'country_network_arr' => $country_networks,
|
||||
'client_arr' => $client_arr,
|
||||
@@ -145,9 +160,23 @@ class ShortCodesController extends Controller{
|
||||
->select('code_type', \DB::raw('count(*) as total'))
|
||||
->groupBy('code_type')
|
||||
->get();
|
||||
$networks_raw = [
|
||||
'AirtelTigo GH' => 'AirtelTigo GH',
|
||||
'MTN GH' => 'MTN GH',
|
||||
'Airtel MW' => 'Airtel MW',
|
||||
'Airtel Zambia' => 'Airtel Zambia',
|
||||
'TNM MW' => 'TNM MW',
|
||||
'Airtel MW' => 'Airtel MW',
|
||||
'Safaricom Kenya' => 'Safaricom Kenya',
|
||||
'Airtel Kenya' => 'Airtel Kenya',
|
||||
'Telkom Kenya' => 'Telkom Kenya',
|
||||
'Orange Kenya' => 'Orange Kenya'
|
||||
];
|
||||
sort($networks_raw);
|
||||
$data = [
|
||||
'page_title' => 'Short Codes',
|
||||
'type' => 'Voice',
|
||||
'networks_raw' => array_combine($networks_raw, $networks_raw),
|
||||
'codes_data' => $codes_data,
|
||||
'country_network_arr' => $country_networks,
|
||||
'client_arr' => $client_arr,
|
||||
@@ -181,6 +210,10 @@ class ShortCodesController extends Controller{
|
||||
}
|
||||
return response()->json($shortcode_arr);
|
||||
}
|
||||
public function handle_delete($id){
|
||||
$result = Models\ClientShortCode::destroy($id);
|
||||
return response()->json(['code' => 1, 'msg' => $result]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ use App\Models;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
use Illuminate\Contracts\Mail\Mailer;
|
||||
use App\Jobs\SendTestEmail;
|
||||
use App\Notifications\EmailNotification;
|
||||
|
||||
|
||||
class UtilityController extends Controller
|
||||
{
|
||||
@@ -247,5 +249,16 @@ class UtilityController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function sendEmailNotification(Request $request){
|
||||
$user = Models\StaffMember::find(1);
|
||||
|
||||
// Create a new instance of your notification
|
||||
$notification = new EmailNotification('This is a test notification.', 'https://example.com');
|
||||
|
||||
// Send the notification
|
||||
$user->notify($notification);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// https://www.tokyvideo.com/video/sheena-the-queen-of-the-jungle-1984-movie-with-tanya-roberts-ted-wass-donovan-scott
|
||||
|
||||
@@ -21,6 +21,9 @@ class CheckCurrentlyLoggedInUsers
|
||||
$device = $request->server('HTTP_USER_AGENT');
|
||||
$realm = $id . $device;
|
||||
$current_user = Models\LoggedUser::where('user_id', $id)->where('device', $device)->first();
|
||||
if($current_user == null){
|
||||
return $next($request);
|
||||
}
|
||||
$current_user->last_seen_time = date('Y-m-d H:i:s');
|
||||
$current_user->ip_address = \Request::ip();
|
||||
|
||||
@@ -29,3 +32,6 @@ class CheckCurrentlyLoggedInUsers
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
|
||||
class StaffMember extends Model
|
||||
{
|
||||
use Notifiable;
|
||||
protected $guarded = array('id');
|
||||
public $table = "staff_members";
|
||||
|
||||
|
||||
68
app/Notifications/DesktopNotification.php
Normal file
68
app/Notifications/DesktopNotification.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class DesktopNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
public $message;
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message){
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
// return ['mail'];
|
||||
return ['broadcast'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
/*
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage)
|
||||
->line('The introduction to the notification.')
|
||||
->action('Notification Action', url('/'))
|
||||
->line('Thank you for using our application!');
|
||||
}
|
||||
*/
|
||||
public function toBroadcast($notifiable){
|
||||
return new BroadcastMessage([
|
||||
'message' => $this->message
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
40
app/Notifications/EmailNotification.php
Normal file
40
app/Notifications/EmailNotification.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class EmailNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
protected $message;
|
||||
protected $url;
|
||||
|
||||
public function __construct($message, $url = null)
|
||||
{
|
||||
$this->message = $message;
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail']; // Use 'mail' channel
|
||||
}
|
||||
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
$mailMessage = (new MailMessage)
|
||||
->greeting('Hello!')
|
||||
->line($this->message);
|
||||
|
||||
if ($this->url) {
|
||||
$mailMessage->action('View Details', $this->url);
|
||||
}
|
||||
|
||||
return $mailMessage->salutation('Regards, Your Application');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user