fix: update models and views
This commit is contained in:
@@ -3,18 +3,143 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
// Explicitly import models for better readability and IDE support
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\UserActivity;
|
||||||
|
use App\Models\StaffMember;
|
||||||
|
use App\Models\NationalHoliday;
|
||||||
|
use App\Models\DailyQuote;
|
||||||
|
use App\Models\NetworkOps;
|
||||||
|
|
||||||
class DashboardController extends Controller
|
class DashboardController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function index(): View
|
||||||
{
|
{
|
||||||
$data = [
|
// Grouped OR clauses inside a closure to prevent query bleeding
|
||||||
'page_title' => 'Dashboard'
|
$ussd_clients = Client::where(function ($query) {
|
||||||
];
|
$query->where('services', 'LIKE', '%ussd%')
|
||||||
return view('dashboard.index_two', $data);
|
->orWhere('services', 'LIKE', '%A2P%');
|
||||||
|
})->count();
|
||||||
|
|
||||||
|
$airtime_clients = Client::where('services', 'LIKE', '%airtime%')->count();
|
||||||
|
$sms_clients = Client::where('services', 'LIKE', '%sms%')->count();
|
||||||
|
$voice_clients = Client::where('services', 'LIKE', '%ivr%')->count();
|
||||||
|
|
||||||
|
// Cleaned up the null/empty checks and removed the dangerous global orWhere
|
||||||
|
$expiring_contracts = Client::where('contract_auto_renew', '!=', 'YES')
|
||||||
|
->whereNotNull('contract_validity')
|
||||||
|
->where('contract_validity', '!=', '')
|
||||||
|
->orderBy('contract_validity', 'ASC')
|
||||||
|
->take(5)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$user_activities = UserActivity::where('user_id', '>', 1)
|
||||||
|
->with('userInfo')
|
||||||
|
->orderBy('created_at', 'DESC')
|
||||||
|
->take(5)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$recent_clients = Client::with('auth_user_info')
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->take(5)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// Cleaner raw query for upcoming birthdays ignoring the current year
|
||||||
|
$upcoming_birthdays = StaffMember::whereRaw("DATE_FORMAT(dob, '%m-%d') >= DATE_FORMAT(CURDATE(), '%m-%d')")
|
||||||
|
->orderByRaw("DATE_FORMAT(dob, '%m-%d') ASC")
|
||||||
|
->take(5)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$upcoming_hodidays = NationalHoliday::whereDate('event_date', '>=', Carbon::today())
|
||||||
|
->orderBy('event_date', 'ASC')
|
||||||
|
->take(15)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$main_quote = DailyQuote::where('status', 'active')->first();
|
||||||
|
|
||||||
|
return view('dashboard.index_two', [
|
||||||
|
'page_title' => 'Dashboard',
|
||||||
|
'sms' => $sms_clients,
|
||||||
|
'ussd' => $ussd_clients,
|
||||||
|
'voice' => $voice_clients,
|
||||||
|
'airtime' => $airtime_clients,
|
||||||
|
'total' => Client::count(),
|
||||||
|
'main_quote' => $main_quote,
|
||||||
|
'recent_clients' => $recent_clients,
|
||||||
|
'user_activities' => $user_activities,
|
||||||
|
'expiring_contracts' => $expiring_contracts,
|
||||||
|
'upcoming_birthdays' => $upcoming_birthdays,
|
||||||
|
'upcoming_hodidays' => $upcoming_hodidays
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
public function getEvents(): JsonResponse
|
||||||
|
{
|
||||||
|
$event_arr = [
|
||||||
|
[
|
||||||
|
"title" => 'Airtel MW Top Up',
|
||||||
|
"start" => date("Y-m-d") // Fixed format: Most JS calendars expect Y-m-d, not Y, m, d
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"title" => 'Airtel MW Top Down',
|
||||||
|
"start" => date("Y-m-d")
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
return response()->json($event_arr);
|
||||||
|
}
|
||||||
|
|
||||||
// Nana Ekua Banson
|
public function getQuotes(): JsonResponse
|
||||||
|
{
|
||||||
|
// Replaced complex raw SQL with Laravel's native randomized sorting
|
||||||
|
$daily_quote = DailyQuote::inRandomOrder()->first();
|
||||||
|
|
||||||
|
return response()->json($daily_quote);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMnosContracts(): JsonResponse
|
||||||
|
{
|
||||||
|
$threeMonthsLater = Carbon::now()->addMonths(3)->format('m-d');
|
||||||
|
$currentMonth = Carbon::now()->format('m');
|
||||||
|
|
||||||
|
// Added ->count() directly to the query builder to save RAM
|
||||||
|
$expiring_three_months = NetworkOps::where('contract_auto_renew', 'NO')
|
||||||
|
->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') = ?", [$threeMonthsLater])
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$expired_overall = NetworkOps::whereDate('contract_validity', '<', Carbon::now())->count();
|
||||||
|
|
||||||
|
$expiring_current_month = NetworkOps::whereMonth('contract_validity', $currentMonth)->count();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'expiring_three_months' => $expiring_three_months,
|
||||||
|
'expired_overall' => $expired_overall,
|
||||||
|
'expiring_current_month' => $expiring_current_month
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClientContracts(): JsonResponse
|
||||||
|
{
|
||||||
|
$threeMonthsLater = Carbon::now()->addMonths(3)->format('m-d');
|
||||||
|
$currentMonth = Carbon::now()->format('m');
|
||||||
|
|
||||||
|
$expiring_three_months = Client::where('contract_auto_renew', 'NO')
|
||||||
|
->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') = ?", [$threeMonthsLater])
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$expired_overall = Client::whereDate('contract_validity', '<', Carbon::now())->count();
|
||||||
|
|
||||||
|
$expiring_current_month = Client::whereMonth('contract_validity', $currentMonth)->count();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'expiring_three_months' => $expiring_three_months,
|
||||||
|
'expired_overall' => $expired_overall,
|
||||||
|
'expiring_current_month' => $expiring_current_month
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
18
app/Models/BranchFile.php
Normal file
18
app/Models/BranchFile.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class BranchFile extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "branch_files";
|
||||||
|
|
||||||
|
public function branch_info(){
|
||||||
|
return $this->hasOne('App\Models\OfficeLocation', 'id', 'branch_id');
|
||||||
|
}
|
||||||
|
public function staff_info(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'uploaded_by');
|
||||||
|
}
|
||||||
|
}
|
||||||
26
app/Models/ClickApps.php
Executable file
26
app/Models/ClickApps.php
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClickApps extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "apps";
|
||||||
|
protected $fillable = [
|
||||||
|
'app_name',
|
||||||
|
'app_type',
|
||||||
|
'client',
|
||||||
|
'code',
|
||||||
|
'country',
|
||||||
|
'operator',
|
||||||
|
'tollfree',
|
||||||
|
'app_path',
|
||||||
|
'launch_date',
|
||||||
|
'status',
|
||||||
|
'other_info',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
11
app/Models/ClickFile.php
Executable file
11
app/Models/ClickFile.php
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClickFile extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "click_files";
|
||||||
|
}
|
||||||
33
app/Models/ClickServer.php
Executable file
33
app/Models/ClickServer.php
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClickServer extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "click_servers";
|
||||||
|
|
||||||
|
protected $appends = ['root_password'];
|
||||||
|
|
||||||
|
public function direct_connections_info(){
|
||||||
|
return $this->hasMany('App\Models\DirectConnection', 'server_id', 'id');
|
||||||
|
}
|
||||||
|
public function credentials_info(){
|
||||||
|
return $this->hasMany('App\Models\ServerCredential', 'server_id', 'id');
|
||||||
|
}
|
||||||
|
public function modified_by_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'last_modified_by_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getRootPasswordAttribute(){
|
||||||
|
$credentials = $this->credentials_info;
|
||||||
|
foreach ($credentials as $value) {
|
||||||
|
if ($value->username == 'root') {
|
||||||
|
return $value->password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,4 +11,44 @@ class Client extends Model
|
|||||||
];
|
];
|
||||||
public $table = "clients";
|
public $table = "clients";
|
||||||
// protected $appends = ['client_services'];
|
// protected $appends = ['client_services'];
|
||||||
|
|
||||||
|
public function country_info(){
|
||||||
|
return $this->hasOne('App\Models\Country', 'alpha_2_code', 'country');
|
||||||
|
}
|
||||||
|
public function country_flag_info(){
|
||||||
|
return $this->hasOne('App\Models\CountryFlag', 'country', 'country');
|
||||||
|
}
|
||||||
|
public function payment_type_info(){
|
||||||
|
return $this->hasOne('App\Models\PaymentType', 'id', 'pay_mode');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function service_info(){
|
||||||
|
return $this->hasMany('App\Models\ClientCategory', 'client_id', 'id');
|
||||||
|
}
|
||||||
|
public function report_info(){
|
||||||
|
return $this->hasMany('App\Models\MeetingReport', 'client', 'id');
|
||||||
|
}
|
||||||
|
public function auth_user_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'auth_user_id');
|
||||||
|
}
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'created_by');
|
||||||
|
}
|
||||||
|
public function modified_by_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'last_modified_by');
|
||||||
|
}
|
||||||
|
public function short_code_info(){
|
||||||
|
return $this->hasMany('App\Models\ShortCode', 'client_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getClientServicesAttribute(){
|
||||||
|
$services = $this->service_info;
|
||||||
|
$service_name_arr = [];
|
||||||
|
foreach ($services as $value) {
|
||||||
|
$service_name = Models\Service::find($value['category_id']);
|
||||||
|
$service_name_arr[] = $service_name->name;
|
||||||
|
}
|
||||||
|
return $service_name_arr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
app/Models/ClientCategory.php
Executable file
16
app/Models/ClientCategory.php
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClientCategory extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "client_categories";
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
14
app/Models/ClientFile.php
Normal file
14
app/Models/ClientFile.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClientFile extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
10
app/Models/ClientIndicator.php
Normal file
10
app/Models/ClientIndicator.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClientIndicator extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
}
|
||||||
25
app/Models/ClientNote.php
Normal file
25
app/Models/ClientNote.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
|
||||||
|
class ClientNote extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
protected static $logUnguarded = true;
|
||||||
|
|
||||||
|
// public function getActivitylogOptions(): LogOptions{
|
||||||
|
// return LogOptions::defaults()->logUnguarded();
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'auth_user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
10
app/Models/ClientOnboardingMainStage.php
Normal file
10
app/Models/ClientOnboardingMainStage.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClientOnboardingMainStage extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
17
app/Models/ClientOnboardingProgress.php
Normal file
17
app/Models/ClientOnboardingProgress.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClientOnboardingProgress extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "client_onboarding_progress";
|
||||||
|
|
||||||
|
public function stage_info(){
|
||||||
|
return $this->hasOne('App\Models\ClientOnboardingMainStage', 'stage_id', 'id');
|
||||||
|
}
|
||||||
|
//this will produce one stage
|
||||||
|
//I need a relationship to show all sub items
|
||||||
|
}
|
||||||
11
app/Models/ClientOnboardingStage.php
Normal file
11
app/Models/ClientOnboardingStage.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClientOnboardingStage extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "client_onboarding_main_stages";
|
||||||
|
}
|
||||||
10
app/Models/ClientOnboardingSubItem.php
Normal file
10
app/Models/ClientOnboardingSubItem.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClientOnboardingSubItem extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
18
app/Models/ClientPayment.php
Normal file
18
app/Models/ClientPayment.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClientPayment extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "client_finances";
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\Account', 'id', 'auth_user_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
18
app/Models/ClientShortCode.php
Normal file
18
app/Models/ClientShortCode.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClientShortCode extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "client_short_codes";
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
public function update_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'last_updated_by');
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Models/ClientSupportFees.php
Normal file
19
app/Models/ClientSupportFees.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ClientSupportFees extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "client_support_fees";
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
public function created_by_info(){
|
||||||
|
// return $this->hasOne('App\Models\Account', 'id', 'auth_user_id');
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
|
|
||||||
|
|
||||||
class Comment extends Model
|
|
||||||
{
|
|
||||||
protected $guarded = [
|
|
||||||
'id'
|
|
||||||
];
|
|
||||||
public function userInfo(): HasOne
|
|
||||||
{
|
|
||||||
return $this->hasOne(User::class);
|
|
||||||
}
|
|
||||||
public function projectStatus(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(ProjectStatus::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
11
app/Models/Country.php
Executable file
11
app/Models/Country.php
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Country extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "countries";
|
||||||
|
}
|
||||||
11
app/Models/CountryFlag.php
Normal file
11
app/Models/CountryFlag.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class CountryFlag extends Model
|
||||||
|
{
|
||||||
|
public $timestamps = false;
|
||||||
|
public $table = "flags";
|
||||||
|
}
|
||||||
13
app/Models/Currency.php
Executable file
13
app/Models/Currency.php
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Currency extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "currencies";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
10
app/Models/DailyQuote.php
Normal file
10
app/Models/DailyQuote.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class DailyQuote extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
}
|
||||||
10
app/Models/Department.php
Normal file
10
app/Models/Department.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Department extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
}
|
||||||
11
app/Models/Designation.php
Executable file
11
app/Models/Designation.php
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Designation extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "designations";
|
||||||
|
}
|
||||||
11
app/Models/DirectConnection.php
Executable file
11
app/Models/DirectConnection.php
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class DirectConnection extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "direct_connections";
|
||||||
|
}
|
||||||
10
app/Models/GeneralDocument.php
Normal file
10
app/Models/GeneralDocument.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class GeneralDocument extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
}
|
||||||
11
app/Models/Holiday.php
Normal file
11
app/Models/Holiday.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Holiday extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "holidays";
|
||||||
|
}
|
||||||
11
app/Models/IncomingEmail.php
Normal file
11
app/Models/IncomingEmail.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class IncomingEmail extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "incoming_emails";
|
||||||
|
}
|
||||||
10
app/Models/Industry.php
Normal file
10
app/Models/Industry.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Industry extends Model
|
||||||
|
{
|
||||||
|
public $table = "client_industries";
|
||||||
|
}
|
||||||
12
app/Models/LeaveManagement.php
Normal file
12
app/Models/LeaveManagement.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class LeaveManagement extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "leave_management";
|
||||||
|
|
||||||
|
}
|
||||||
16
app/Models/LoggedUser.php
Normal file
16
app/Models/LoggedUser.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class LoggedUser extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "logged_users";
|
||||||
|
|
||||||
|
|
||||||
|
public function auth_user_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
24
app/Models/MarketReport.php
Executable file
24
app/Models/MarketReport.php
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class MarketReport extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "market_reports";
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client');
|
||||||
|
}
|
||||||
|
public function payment_info(){
|
||||||
|
return $this->hasOne('App\Models\PaymentType', 'id', 'payment_type');
|
||||||
|
}
|
||||||
|
public function auth_user_info(){
|
||||||
|
return $this->hasOne('App\Models\Account', 'id', 'auth_user_id');
|
||||||
|
}
|
||||||
|
public function sam_comment_info(){
|
||||||
|
return $this->hasMany('App\Models\SamComment', 'report_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
21
app/Models/MeetingReport.php
Executable file
21
app/Models/MeetingReport.php
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class MeetingReport extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "meeting_reports";
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client');
|
||||||
|
}
|
||||||
|
public function auth_user_info(){
|
||||||
|
return $this->hasOne('App\Models\Account', 'id', 'auth_user_id');
|
||||||
|
}
|
||||||
|
public function sam_comment_info(){
|
||||||
|
return $this->hasMany('App\Models\SamComment', 'report_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
15
app/Models/MnoFile.php
Normal file
15
app/Models/MnoFile.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class MnoFile extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "mno_files";
|
||||||
|
|
||||||
|
public function mno_info(){
|
||||||
|
return $this->hasOne('App\Models\NetworkOps', 'id', 'mno_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
14
app/Models/Mnoips.php
Normal file
14
app/Models/Mnoips.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Mnoips extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "mno_ip_addresses";
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'last_modified_by');
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Models/Mnonote.php
Normal file
19
app/Models/Mnonote.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Mnonote extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "mno_notes";
|
||||||
|
|
||||||
|
public function mno_info(){
|
||||||
|
return $this->hasOne('App\Models\NetworkOps', 'id', 'mno_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Models/Mnopayment.php
Normal file
19
app/Models/Mnopayment.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Mnopayment extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "mno_payments";
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\NetworkOps', 'id', 'mno_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
17
app/Models/NationalHoliday.php
Normal file
17
app/Models/NationalHoliday.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class NationalHoliday extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "national_holidays";
|
||||||
|
|
||||||
|
// public function branch_info(){
|
||||||
|
// return $this->hasOne('App\Models\OfficeLocation', 'id', 'branch_id');
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
15
app/Models/NetworkOps.php
Executable file
15
app/Models/NetworkOps.php
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class NetworkOps extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "network_operators";
|
||||||
|
|
||||||
|
public function account_manager_info(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'account_manager_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/Models/Networkstatus.php
Executable file
11
app/Models/Networkstatus.php
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Networkstatus extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "network_status_responses";
|
||||||
|
}
|
||||||
18
app/Models/OfficeLocation.php
Normal file
18
app/Models/OfficeLocation.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class OfficeLocation extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'user_id');
|
||||||
|
}
|
||||||
|
public function country_manager_info(){
|
||||||
|
// return $this->hasOne('App\Models\StaffMember', 'id', 'country_manager_id');
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'country_manager_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
10
app/Models/OnboardingStage.php
Normal file
10
app/Models/OnboardingStage.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class OnboardingStage extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
}
|
||||||
11
app/Models/PaymentType.php
Executable file
11
app/Models/PaymentType.php
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PaymentType extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "payment_type";
|
||||||
|
}
|
||||||
11
app/Models/Permission.php
Normal file
11
app/Models/Permission.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Permission extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "hlp_permissions";
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
||||||
|
|
||||||
|
|
||||||
class Project extends Model
|
|
||||||
{
|
|
||||||
protected $guarded = [
|
|
||||||
'id'
|
|
||||||
];
|
|
||||||
|
|
||||||
// public function userInfo()
|
|
||||||
// {
|
|
||||||
// return $this->hasMany('App\Models\User', 'org_id', 'id');
|
|
||||||
// }
|
|
||||||
// public function phone(): HasOne
|
|
||||||
// {
|
|
||||||
// return $this->hasOne(Phone::class);
|
|
||||||
// }
|
|
||||||
public function userInfo(): HasMany
|
|
||||||
{
|
|
||||||
return $this->hasMany(User::class);
|
|
||||||
}
|
|
||||||
public function statusInfo(): HasMany
|
|
||||||
{
|
|
||||||
return $this->hasMany(ProjectStatus::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
||||||
|
|
||||||
class ProjectStatus extends Model
|
|
||||||
{
|
|
||||||
protected $guarded = [
|
|
||||||
'id'
|
|
||||||
];
|
|
||||||
|
|
||||||
public function project(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Project::class);
|
|
||||||
}
|
|
||||||
public function comments(): HasMany
|
|
||||||
{
|
|
||||||
return $this->hasMany(Comment::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
13
app/Models/SamComment.php
Executable file
13
app/Models/SamComment.php
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SamComment extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "sam_comments";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
37
app/Models/SenderId.php
Normal file
37
app/Models/SenderId.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
|
||||||
|
class SenderId extends Model{
|
||||||
|
// use LogsActivity;
|
||||||
|
|
||||||
|
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "sender_ids";
|
||||||
|
protected static $logName = 'senderid_log';
|
||||||
|
// protected static $causedBy = $user_model;
|
||||||
|
// protected static $logOnlyDirty = true;
|
||||||
|
// protected static $dontSubmitEmptyLogs = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected static $logUnguarded = true;
|
||||||
|
// public function getActivitylogOptions(): LogOptions{
|
||||||
|
// return LogOptions::defaults()
|
||||||
|
// ->logUnguarded()->useLogName('senderid_log')->logOnlyDirty()->dontSubmitEmptyLogs();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public function modified_by_info(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'last_modified_by');
|
||||||
|
}
|
||||||
|
public function network_info(){
|
||||||
|
return $this->hasOne('App\Models\NetworkOps', 'id', 'network_id');
|
||||||
|
}
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'created_by');
|
||||||
|
}
|
||||||
|
}
|
||||||
27
app/Models/Senderidold.php
Normal file
27
app/Models/Senderidold.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Senderidold extends Model{
|
||||||
|
|
||||||
|
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "sender_ids_copy";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function modified_by_info(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'last_modified_by');
|
||||||
|
}
|
||||||
|
public function network_info(){
|
||||||
|
return $this->hasOne('App\Models\NetworkOps', 'id', 'network_id');
|
||||||
|
}
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'created_by');
|
||||||
|
}
|
||||||
|
}
|
||||||
16
app/Models/ServerCredential.php
Executable file
16
app/Models/ServerCredential.php
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ServerCredential extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "server_credentials";
|
||||||
|
|
||||||
|
public function server_info(){
|
||||||
|
return $this->hasOne('App\Models\ClickServer', 'id', 'server_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/Models/Service.php
Executable file
11
app/Models/Service.php
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Service extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "services";
|
||||||
|
}
|
||||||
21
app/Models/ShortCode.php
Normal file
21
app/Models/ShortCode.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ShortCode extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "short_codes";
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
public function update_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'last_updated_by');
|
||||||
|
}
|
||||||
|
public function account_mgr_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'account_manager_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
25
app/Models/SupportTicket.php
Normal file
25
app/Models/SupportTicket.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SupportTicket extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "support_tickets";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function modified_by_info(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'last_modified_by');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'created_by');
|
||||||
|
}
|
||||||
|
public function assignedTo(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'assigned_to');
|
||||||
|
}
|
||||||
|
}
|
||||||
14
app/Models/SupportTicketsDocument.php
Normal file
14
app/Models/SupportTicketsDocument.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SupportTicketsDocument extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "support_ticket_attachments";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
24
app/Models/SystemCredential.php
Normal file
24
app/Models/SystemCredential.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SystemCredential extends Model{
|
||||||
|
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "sys_credentials";
|
||||||
|
|
||||||
|
public function modified_by_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'last_modified_by_id');
|
||||||
|
}
|
||||||
|
public function network_info(){
|
||||||
|
return $this->hasOne('App\Models\NetworkOps', 'id', 'network_id');
|
||||||
|
}
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
public function created_by_info(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'created_by_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
18
app/Models/SystemUser.php
Executable file
18
app/Models/SystemUser.php
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SystemUser extends Model
|
||||||
|
{
|
||||||
|
// use LogsActivity;
|
||||||
|
//use CausesActivity;
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "auth_users";
|
||||||
|
// protected static $logUnguarded = true;
|
||||||
|
|
||||||
|
public function designation_info(){
|
||||||
|
return $this->hasOne('App\Models\Designation', 'id', 'designation');
|
||||||
|
}
|
||||||
|
}
|
||||||
27
app/Models/UserActivity.php
Normal file
27
app/Models/UserActivity.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class UserActivity extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "user_activities";
|
||||||
|
// protected $appends = ['activity_time'];
|
||||||
|
|
||||||
|
public function userInfo(){
|
||||||
|
return $this->hasOne('App\Models\StaffMember', 'id', 'user_id');
|
||||||
|
}
|
||||||
|
public function userInfoSystem(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
|
||||||
|
}
|
||||||
|
public function getActivityTimeAttribute(){
|
||||||
|
$created = $this->created_at;
|
||||||
|
$parsed_created_date = Carbon::parse($created);
|
||||||
|
$current_date = Carbon::parse(date('Y-m-d'));
|
||||||
|
$days = $parsed_created_date->diffForHumans();
|
||||||
|
return $days;
|
||||||
|
}
|
||||||
|
}
|
||||||
17
app/Models/UssdClientPayment.php
Executable file
17
app/Models/UssdClientPayment.php
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class UssdClientPayment extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "ussd_client_payments";
|
||||||
|
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
app/Models/Utility.php
Normal file
23
app/Models/Utility.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
|
use Spatie\Activitylog\LogOptions;
|
||||||
|
|
||||||
|
|
||||||
|
class Utility extends Model{
|
||||||
|
|
||||||
|
use LogsActivity;
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
protected $table = "utility";
|
||||||
|
protected static $logUnguarded = true;
|
||||||
|
public function getActivitylogOptions(): LogOptions
|
||||||
|
{
|
||||||
|
return LogOptions::defaults()
|
||||||
|
->logUnguarded();
|
||||||
|
// ->logOnly(['name', 'type']);
|
||||||
|
// Chain fluent methods for configuration options
|
||||||
|
}
|
||||||
|
}
|
||||||
109
app/Models/VpnClients.php
Normal file
109
app/Models/VpnClients.php
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class VpnClient extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'vpn_clients';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'username',
|
||||||
|
'type',
|
||||||
|
'server_id',
|
||||||
|
'auth_type',
|
||||||
|
'password',
|
||||||
|
'allowed_ips',
|
||||||
|
'routes',
|
||||||
|
'push_dns',
|
||||||
|
'compress',
|
||||||
|
'notes',
|
||||||
|
'active',
|
||||||
|
'config_path', // optional stored config file path
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'push_dns' => 'boolean',
|
||||||
|
'compress' => 'boolean',
|
||||||
|
'active' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Relationships
|
||||||
|
public function server()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Server::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scopes
|
||||||
|
public function scopeActive($q)
|
||||||
|
{
|
||||||
|
return $q->where('active', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeOfType($q, $type)
|
||||||
|
{
|
||||||
|
return $q->where('type', $type);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate a basic OpenVPN config (example). Adapt to your templates and security needs.
|
||||||
|
public function generateConfig()
|
||||||
|
{
|
||||||
|
// If a pre-generated config is stored, return it
|
||||||
|
if ($this->config_path && Storage::exists($this->config_path)) {
|
||||||
|
return Storage::get($this->config_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example template — replace with your real generation logic
|
||||||
|
$server = $this->server ? $this->server->address : 'vpn.example.com';
|
||||||
|
$proto = 'udp';
|
||||||
|
$port = 1194;
|
||||||
|
|
||||||
|
$conf = [];
|
||||||
|
$conf[] = "client";
|
||||||
|
$conf[] = "dev tun";
|
||||||
|
$conf[] = "proto {$proto}";
|
||||||
|
$conf[] = "remote {$server} {$port}";
|
||||||
|
$conf[] = "resolv-retry infinite";
|
||||||
|
$conf[] = "nobind";
|
||||||
|
if ($this->compress) {
|
||||||
|
$conf[] = "comp-lzo";
|
||||||
|
}
|
||||||
|
if ($this->push_dns) {
|
||||||
|
$conf[] = "dhcp-option DNS 10.8.0.1";
|
||||||
|
}
|
||||||
|
if ($this->allowed_ips) {
|
||||||
|
// allowed_ips are usually server-side; include as comment for operator
|
||||||
|
$conf[] = "# Allowed IPs: " . $this->allowed_ips;
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert certs/keys placeholders — do NOT store private keys in cleartext unless secure
|
||||||
|
if ($this->auth_type === 'cert') {
|
||||||
|
$conf[] = "<ca>\n# CA cert here\n</ca>";
|
||||||
|
$conf[] = "<cert>\n# Client cert here\n</cert>";
|
||||||
|
$conf[] = "<key>\n# Client key hidden\n</key>";
|
||||||
|
} else {
|
||||||
|
// username/password auth
|
||||||
|
$conf[] = "auth-user-pass";
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode("\n", $conf) . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store generated config to disk (optional).
|
||||||
|
* Returns storage path.
|
||||||
|
*/
|
||||||
|
public function storeGeneratedConfig()
|
||||||
|
{
|
||||||
|
$config = $this->generateConfig();
|
||||||
|
$filename = 'vpn/configs/' . Str::slug($this->name) . '-' . $this->id . '.ovpn';
|
||||||
|
Storage::put($filename, $config);
|
||||||
|
$this->config_path = $filename;
|
||||||
|
$this->save();
|
||||||
|
return $filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
20
app/Models/VpnConfig.php
Normal file
20
app/Models/VpnConfig.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class VpnConfig extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
|
public function client_info(){
|
||||||
|
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||||
|
}
|
||||||
|
public function mno_info(){
|
||||||
|
return $this->hasOne('App\Models\NetworkOps', 'id', 'mno_id');
|
||||||
|
}
|
||||||
|
public function userInfo(){
|
||||||
|
return $this->hasOne('App\Models\SystemUser', 'id', 'user_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/Models/Worldwidemno.php
Normal file
11
app/Models/Worldwidemno.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Worldwidemno extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = array('id');
|
||||||
|
public $table = "mno_world_wide";
|
||||||
|
}
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
|
|
||||||
<!-- Footer Area -->
|
<!-- Footer Area -->
|
||||||
<div class="card-footer bg-light border-top-0 text-center py-3">
|
<div class="card-footer bg-light border-top-0 text-center py-3">
|
||||||
<p class="text-muted small mb-0">© {{ date('Y') }} LUSPA. All rights reserved.</p>
|
<p class="text-muted small mb-0">© {{ date('Y') }} Click Mobile. All rights reserved.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -240,6 +240,10 @@
|
|||||||
<td><span class="badge bg-info bg-opacity-10 text-info text-uppercase">${client.pay_mode || 'N/A'}</span></td>
|
<td><span class="badge bg-info bg-opacity-10 text-info text-uppercase">${client.pay_mode || 'N/A'}</span></td>
|
||||||
<td>${statusBadge}</td>
|
<td>${statusBadge}</td>
|
||||||
<td class="text-end">
|
<td class="text-end">
|
||||||
|
<button class="btn btn-sm btn-light text-primary me-1 btn-view-client"
|
||||||
|
data-id="${client.id}">
|
||||||
|
<i class="bi bi-eye"></i>
|
||||||
|
</button>
|
||||||
<button class="btn btn-sm btn-light text-primary me-1 btn-edit-client"
|
<button class="btn btn-sm btn-light text-primary me-1 btn-edit-client"
|
||||||
data-id="${client.id}">
|
data-id="${client.id}">
|
||||||
<i class="bi bi-pencil"></i>
|
<i class="bi bi-pencil"></i>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
<div class="col-xl-3 col-md-6">
|
<div class="col-xl-3 col-md-6">
|
||||||
<div class="content-card p-4 d-flex justify-content-between align-items-center h-100">
|
<div class="content-card p-4 d-flex justify-content-between align-items-center h-100">
|
||||||
<div>
|
<div>
|
||||||
<div class="kpi-value mb-1">150</div>
|
<div class="kpi-value mb-1">{{ $sms }}</div>
|
||||||
<div class="kpi-title">SMS Clients</div>
|
<div class="kpi-title">SMS Clients</div>
|
||||||
</div>
|
</div>
|
||||||
<i class="bi bi-chat-dots kpi-icon"></i>
|
<i class="bi bi-chat-dots kpi-icon"></i>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
<div class="content-card p-4 d-flex justify-content-between align-items-center h-100">
|
<div class="content-card p-4 d-flex justify-content-between align-items-center h-100">
|
||||||
<div>
|
<div>
|
||||||
<div class="kpi-value mb-1">230</div>
|
<div class="kpi-value mb-1">230</div>
|
||||||
<div class="kpi-title">USSD Client</div>
|
<div class="kpi-title">USSD Clients</div>
|
||||||
</div>
|
</div>
|
||||||
<i class="bi bi-phone kpi-icon"></i>
|
<i class="bi bi-phone kpi-icon"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user