create performance for supervisor
This commit is contained in:
@@ -70,3 +70,4 @@ TRUSTED_IP="127.0.0.1"
|
|||||||
|
|
||||||
NOTIFICATION_SERVER_URL=
|
NOTIFICATION_SERVER_URL=
|
||||||
LOGIN_HASH_VALUE=
|
LOGIN_HASH_VALUE=
|
||||||
|
SETAD_IP=
|
||||||
|
|||||||
32
app/Console/Commands/SendSupervisorCheckStatsCommand.php
Normal file
32
app/Console/Commands/SendSupervisorCheckStatsCommand.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Services\Commands\SendSupervisorCheckStatsReportService;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class SendSupervisorCheckStatsCommand extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'app:send-supervisor-check-stats';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'gather all supervisor check stats report and send them to the center';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*/
|
||||||
|
public function handle(SendSupervisorCheckStatsReportService $service)
|
||||||
|
{
|
||||||
|
$service->execute();
|
||||||
|
$this->info('Done!');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\HeadquartersDashboard;
|
||||||
|
|
||||||
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class CumulativeSupervisorPerformanceStatsController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
$query = DB::table('expert_performances')->selectRaw("
|
||||||
|
province_id,
|
||||||
|
province_name,
|
||||||
|
SUM(calls) AS total,
|
||||||
|
SUM(reviews) AS reviews,
|
||||||
|
SUM(good) AS good,
|
||||||
|
SUM(bad) AS bad
|
||||||
|
")
|
||||||
|
->groupBy('province_id', 'province_name')
|
||||||
|
->unionAll(DB::table('expert_performances')->selectRaw("
|
||||||
|
0 as province_id,
|
||||||
|
'کشوری' as province_name,
|
||||||
|
SUM(calls) AS total,
|
||||||
|
SUM(reviews) AS reviews,
|
||||||
|
SUM(good) AS good,
|
||||||
|
SUM(bad) AS bad
|
||||||
|
"));
|
||||||
|
|
||||||
|
return response()->json(
|
||||||
|
DataTableFacade::run(
|
||||||
|
$query,
|
||||||
|
$request,
|
||||||
|
allowedFilters: ['*'],
|
||||||
|
allowedSortings: ['*'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Hash;
|
|||||||
|
|
||||||
class LoginToProvinceController extends Controller
|
class LoginToProvinceController extends Controller
|
||||||
{
|
{
|
||||||
public function loginToProvince(Request $request)
|
public function authenticate(Request $request)
|
||||||
{
|
{
|
||||||
$province_ip = Province::query()
|
$province_ip = Province::query()
|
||||||
->Where('id', '=', $request->province_id)
|
->Where('id', '=', $request->province_id)
|
||||||
|
|||||||
@@ -9,21 +9,17 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
class CheckSetadController extends Controller
|
class VerifyAuthenticationController extends Controller
|
||||||
{
|
{
|
||||||
use ApiResponse;
|
use ApiResponse;
|
||||||
|
|
||||||
public function verifyToken(Request $request)
|
public function login(Request $request)
|
||||||
{
|
{
|
||||||
if (!Hash::check(config('globalVariables.LOGIN_HASH_VALUE'), $request->token)) {
|
if (!Hash::check(config('globalVariables.LOGIN_HASH_VALUE'), $request->token)) {
|
||||||
return $this->errorResponse('Invalid token');
|
return $this->errorResponse('Invalid token');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = User::query()->find($request->user_id);
|
$user = User::query()->findOrFail($request->user_id);
|
||||||
|
|
||||||
if (!$user) {
|
|
||||||
return $this->errorResponse('User not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
Auth::login($user);
|
Auth::login($user);
|
||||||
|
|
||||||
@@ -11,18 +11,14 @@ class VerifySetadIp
|
|||||||
/**
|
/**
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
* @param Closure(Request): (Response) $next
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): Response
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
$masterServerIp = env('MASTER_SERVER_IP');
|
if ($request->ip() == config('globalVariables.SETAD_IP')) {
|
||||||
if (is_null($masterServerIp)) {
|
|
||||||
return response('Master server IP not configured.', 500);
|
|
||||||
}
|
|
||||||
if ($request->ip() !== $masterServerIp) {
|
|
||||||
return response('Unauthorized.', 401);
|
|
||||||
|
|
||||||
}
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abort(Response::HTTP_FORBIDDEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class ExpertPerformance extends Model
|
|
||||||
{
|
|
||||||
/** @use HasFactory<\Database\Factories\ExpertPerformanceFactory> */
|
|
||||||
use HasFactory;
|
|
||||||
}
|
|
||||||
15
app/Models/SupervisorPerformance.php
Normal file
15
app/Models/SupervisorPerformance.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Database\Factories\SupervisorPerformanceFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SupervisorPerformance extends Model
|
||||||
|
{
|
||||||
|
/** @use HasFactory<SupervisorPerformanceFactory> */
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Commands;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
|
use Illuminate\Http\Client\RequestException;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class SendSupervisorCheckStatsReportService
|
||||||
|
{
|
||||||
|
private string $url;
|
||||||
|
private string $channelName;
|
||||||
|
private string $provinceId;
|
||||||
|
private string $provinceName;
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->url = config('ProvinceInfo.center_ip');
|
||||||
|
$this->channelName = 'send_supervisor_check_stats_report';
|
||||||
|
$this->provinceId = config('ProvinceInfo.id');
|
||||||
|
$this->provinceName = config('ProvinceInfo.name');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws ConnectionException
|
||||||
|
* @throws RequestException
|
||||||
|
*/
|
||||||
|
public function execute(): void
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$data = $this->prepare();
|
||||||
|
Http::post($this->url, $data)->throw();
|
||||||
|
Log::channel($this->channelName)->info(SendSupervisorCheckStatsReportService::class, [$this->provinceName, array_sum($data), 'successful']);
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
Log::channel($this->channelName)->error(SendSupervisorCheckStatsReportService::class, [$e->getMessage()]);
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function prepare(): array
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
SELECT
|
||||||
|
{$this->provinceId} AS province_id,
|
||||||
|
'{$this->provinceName}' AS province_name,
|
||||||
|
od.date,
|
||||||
|
COUNT(*) AS reviews,
|
||||||
|
COUNT(CASE WHEN is_good = 1 THEN 1 END) AS good,
|
||||||
|
COUNT(CASE WHEN is_good = 0 THEN 1 END) AS bad,
|
||||||
|
COALESCE(cdr_data.calls, 0) AS calls
|
||||||
|
FROM (
|
||||||
|
SELECT date, is_good
|
||||||
|
FROM operator_dialogues
|
||||||
|
WHERE supervisor_id IS NOT NULL
|
||||||
|
AND create_at > NOW() - INTERVAL 3 DAY
|
||||||
|
) AS od
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
DATE(calldate) AS d,
|
||||||
|
COUNT(CASE
|
||||||
|
WHEN dcontext = 'from-internal'
|
||||||
|
AND disposition = 'ANSWERED'
|
||||||
|
AND dst > 100 AND dst < 105
|
||||||
|
THEN 1 END) AS calls
|
||||||
|
FROM asteriskcdrdb.cdr
|
||||||
|
WHERE calldate > NOW() - INTERVAL 3 DAY
|
||||||
|
GROUP BY d
|
||||||
|
) AS cdr_data
|
||||||
|
ON od.date = cdr_data.d
|
||||||
|
GROUP BY od.date, cdr_data.calls
|
||||||
|
ORDER BY od.date DESC";
|
||||||
|
|
||||||
|
return DB::select($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,18 +13,18 @@ class ReportService
|
|||||||
$query = DB::table('asteriskcdrdb.cdr')
|
$query = DB::table('asteriskcdrdb.cdr')
|
||||||
->selectRaw("
|
->selectRaw("
|
||||||
DATE(calldate) AS d,
|
DATE(calldate) AS d,
|
||||||
COUNT(CASE WHEN (recordingfile = '' OR recordingfile LIKE 'q-%') THEN 1 END) AS c_all,
|
COUNT(CASE WHEN (recordingfile = '' OR recordingfile LIKE 'q-%') THEN 1 END) AS total,
|
||||||
COUNT(CASE WHEN lastdata = 'IAX2/serverpeer/100' THEN 1 END) AS c_teh4,
|
COUNT(CASE WHEN lastdata = 'IAX2/serverpeer/100' THEN 1 END) AS teh4,
|
||||||
COUNT(CASE WHEN lastdata = 'IAX2/242serverpeer/200' THEN 1 END) AS c_teh5,
|
COUNT(CASE WHEN lastdata = 'IAX2/242serverpeer/200' THEN 1 END) AS teh5,
|
||||||
COUNT(CASE WHEN dst = '500' THEN 1 END) AS c_os4,
|
COUNT(CASE WHEN dst = '500' THEN 1 END) AS os4,
|
||||||
COUNT(CASE WHEN dst = '600' THEN 1 END) AS c_os5,
|
COUNT(CASE WHEN dst = '600' THEN 1 END) AS os5,
|
||||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS c_ok,
|
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS ok,
|
||||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS c_nok,
|
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS nok,
|
||||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS c_b10,
|
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS b10,
|
||||||
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS c_dnd,
|
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS dnd,
|
||||||
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS c_trans,
|
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS trans,
|
||||||
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS ch_all,
|
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS all,
|
||||||
AVG(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' THEN billsec END) AS c_avg
|
AVG(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' THEN billsec END) AS avg
|
||||||
");
|
");
|
||||||
// ->whereBetween('calldate', [$from, $to]) // use Carbon or date strings
|
// ->whereBetween('calldate', [$from, $to]) // use Carbon or date strings
|
||||||
// ->groupBy(DB::raw('DATE(calldate)'))
|
// ->groupBy(DB::raw('DATE(calldate)'))
|
||||||
@@ -44,8 +44,8 @@ class ReportService
|
|||||||
{
|
{
|
||||||
$query = DB::table('people_messages')
|
$query = DB::table('people_messages')
|
||||||
->selectRaw('
|
->selectRaw('
|
||||||
COUNT(CASE WHEN is_listen = 1 THEN 1 END) AS c_l,
|
COUNT(CASE WHEN is_listen = 1 THEN 1 END) AS l,
|
||||||
COUNT(CASE WHEN is_listen = 0 THEN 1 END) AS c_nl
|
COUNT(CASE WHEN is_listen = 0 THEN 1 END) AS nl
|
||||||
');
|
');
|
||||||
// ->whereBetween('date', [$date_from, $date_to])
|
// ->whereBetween('date', [$date_from, $date_to])
|
||||||
// ->first();
|
// ->first();
|
||||||
@@ -85,21 +85,20 @@ class ReportService
|
|||||||
{
|
{
|
||||||
$query = DB::table('asteriskcdrdb.cdr')
|
$query = DB::table('asteriskcdrdb.cdr')
|
||||||
->selectRaw("
|
->selectRaw("
|
||||||
SELECT
|
|
||||||
*
|
*
|
||||||
(ch_all - (c_ok + c_nok)) AS c_fail
|
(all - (ok + nok)) AS fail
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
DATE(calldate) AS d,
|
DATE(calldate) AS d,
|
||||||
dst,
|
dst,
|
||||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS c_ok,
|
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS ok,
|
||||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS c_nok,
|
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS nok,
|
||||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS c_b10,
|
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS b10,
|
||||||
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS c_dnd,
|
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS dnd,
|
||||||
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS c_trans,
|
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS trans,
|
||||||
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS ch_all
|
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS all
|
||||||
FROM asteriskcdrdb.cdr
|
FROM asteriskcdrdb.cdr
|
||||||
WHERE dst BETWEEN 101 AND 105 AND calldate BETWEEN ? AND ?
|
WHERE dst BETWEEN 101 AND 105
|
||||||
GROUP BY d, dst
|
GROUP BY d, dst
|
||||||
ORDER BY d, dst
|
ORDER BY d, dst
|
||||||
);
|
);
|
||||||
@@ -127,24 +126,22 @@ class ReportService
|
|||||||
{
|
{
|
||||||
$query = DB::table('asteriskcdrdb.cdr')
|
$query = DB::table('asteriskcdrdb.cdr')
|
||||||
->selectRaw("
|
->selectRaw("
|
||||||
SELECT
|
|
||||||
*
|
*
|
||||||
(ch_all - (c_ok + c_nok)) AS c_fail
|
(all - (ok + nok)) AS fail
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
DATE(calldate) AS d,
|
DATE(calldate) AS d,
|
||||||
dst,
|
dst,
|
||||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS c_ok,
|
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 THEN 1 END) AS ok,
|
||||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS c_nok,
|
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'NO ANSWER' AND dst BETWEEN 101 AND 104 AND duration > 14 THEN 1 END) AS nok,
|
||||||
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS c_b10,
|
COUNT(CASE WHEN dcontext = 'from-internal' AND disposition = 'ANSWERED' AND dst BETWEEN 101 AND 104 AND billsec > 9 THEN 1 END) AS b10,
|
||||||
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS c_dnd,
|
COUNT(CASE WHEN lastapp = 'Busy' THEN 1 END) AS dnd,
|
||||||
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS c_trans,
|
COUNT(CASE WHEN dst BETWEEN 502 AND 599 THEN 1 END) AS trans,
|
||||||
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS ch_all
|
COUNT(CASE WHEN disposition <> 'BUSY' AND dst BETWEEN 101 AND 105 THEN 1 END) AS all
|
||||||
FROM asteriskcdrdb.cdr
|
FROM asteriskcdrdb.cdr
|
||||||
WHERE dst BETWEEN 101 AND 105 AND calldate BETWEEN ? AND ?
|
WHERE dst BETWEEN 101 AND 105
|
||||||
GROUP dst
|
GROUP BY dst
|
||||||
ORDER dst
|
ORDER BY dst);
|
||||||
);
|
|
||||||
");
|
");
|
||||||
|
|
||||||
return DataTableFacade::run(
|
return DataTableFacade::run(
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ return [
|
|||||||
'TRUSTED_IP' => explode(',', env("TRUSTED_IP", '127.0.0.1')),
|
'TRUSTED_IP' => explode(',', env("TRUSTED_IP", '127.0.0.1')),
|
||||||
'NOTIFICATION_SERVER_URL' => env('NOTIFICATION_SERVER_URL', '127.0.0.1'),
|
'NOTIFICATION_SERVER_URL' => env('NOTIFICATION_SERVER_URL', '127.0.0.1'),
|
||||||
'LOGIN_HASH_VALUE' => env('LOGIN_HASH_VALUE'),
|
'LOGIN_HASH_VALUE' => env('LOGIN_HASH_VALUE'),
|
||||||
|
'SETAD_IP' => env('SETAD_IP'),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -150,6 +150,11 @@ return [
|
|||||||
'path' => storage_path('logs/send_system_message_stats_report.log'),
|
'path' => storage_path('logs/send_system_message_stats_report.log'),
|
||||||
'level' => 'debug',
|
'level' => 'debug',
|
||||||
],
|
],
|
||||||
],
|
|
||||||
|
|
||||||
|
'send_supervisor_check_stats_report' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => storage_path('logs/send_supervisor_check_stats_report.log'),
|
||||||
|
'level' => 'debug',
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ namespace Database\Factories;
|
|||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ExpertPerformance>
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SupervisorPerformance>
|
||||||
*/
|
*/
|
||||||
class ExpertPerformanceFactory extends Factory
|
class SupervisorPerformanceFactory extends Factory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Define the model's default state.
|
* Define the model's default state.
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<?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('expert_performances', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('expert_performances');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -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('supervisor_performances', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->date('date');
|
||||||
|
$table->foreignId('province_id')->constrained('provinces');
|
||||||
|
$table->string('province_name');
|
||||||
|
$table->integer('calls');
|
||||||
|
$table->integer('reviews');
|
||||||
|
$table->integer('good');
|
||||||
|
$table->integer('bad');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('supervisor_performances');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -5,7 +5,7 @@ namespace Database\Seeders;
|
|||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class ExpertPerformanceSeeder extends Seeder
|
class SupervisorPerformanceSeeder extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the database seeds.
|
* Run the database seeds.
|
||||||
@@ -13,7 +13,7 @@ use App\Http\Controllers\HeadquartersDashboard\CumulativeCentersStatsController;
|
|||||||
use App\Http\Controllers\HeadquartersDashboard\CumulativeKeypressStatsController;
|
use App\Http\Controllers\HeadquartersDashboard\CumulativeKeypressStatsController;
|
||||||
use App\Http\Controllers\HeadquartersDashboard\CumulativeMessageRatingStatsController;
|
use App\Http\Controllers\HeadquartersDashboard\CumulativeMessageRatingStatsController;
|
||||||
use App\Http\Controllers\HeadquartersDashboard\CumulativeVoiceRatingStatsController;
|
use App\Http\Controllers\HeadquartersDashboard\CumulativeVoiceRatingStatsController;
|
||||||
use App\Http\Controllers\ProvinceDashboard\CheckSetadController;
|
use App\Http\Controllers\ProvinceDashboard\VerifyAuthenticationController;
|
||||||
use App\Http\Middleware\SuperAdminCheck;
|
use App\Http\Middleware\SuperAdminCheck;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
@@ -203,19 +203,20 @@ Route::prefix('server')->group(function () {
|
|||||||
Route::get('/{peopleMessage}', 'show')->name('show');
|
Route::get('/{peopleMessage}', 'show')->name('show');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Route::middleware(['auth', 'permission:setat_ip'])
|
|
||||||
|
Route::middleware(['auth', 'role:admin'])
|
||||||
->prefix('login_to_province')
|
->prefix('login_to_province')
|
||||||
->name('loginToProvince.')
|
->name('loginToProvince.')
|
||||||
->controller(LoginToProvinceController::class)
|
->controller(LoginToProvinceController::class)
|
||||||
->group(function () {
|
->group(function () {
|
||||||
Route::post('/', 'loginToProvince')->name('loginToProvince');
|
Route::post('/', 'authenticate')->name('authenticate');
|
||||||
});
|
|
||||||
Route::middleware('auth')
|
|
||||||
->prefix('check_setad')
|
|
||||||
->name('checkSetad.')
|
|
||||||
->controller(CheckSetadController::class)
|
|
||||||
->group(function () {
|
|
||||||
Route::get('/', 'verifyToken')->name('verifyToken');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::middleware(['auth', 'setadIp'])
|
||||||
|
->prefix('verify_authentication')
|
||||||
|
->name('verifyAuthentication.')
|
||||||
|
->controller(VerifyAuthenticationController::class)
|
||||||
|
->group(function () {
|
||||||
|
Route::get('/', 'login')->name('login');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user