commit
This commit is contained in:
parent
b5ac0faac3
commit
63bd830484
|
@ -0,0 +1,18 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[docker-compose.yml]
|
||||||
|
indent_size = 4
|
|
@ -0,0 +1,53 @@
|
||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=base64:u22Aaio6kG74akCVWIKP0GP5tL9PQyqIrURDZ5w0cEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
APP_FORCE_HTTPS=true
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=null
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=database_wulan
|
||||||
|
DB_USERNAME=root
|
||||||
|
DB_PASSWORD=
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
FILESYSTEM_DRIVER=local
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
# MAIL_MAILER=smtp
|
||||||
|
# MAIL_HOST=kelola.biz.id
|
||||||
|
# MAIL_PORT=465
|
||||||
|
# MAIL_USERNAME=info@kelola.biz.id
|
||||||
|
# MAIL_PASSWORD="default123@#"
|
||||||
|
# MAIL_ENCRYPTION=ssl
|
||||||
|
# MAIL_FROM_ADDRESS=info@kelola.biz.id
|
||||||
|
# MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=cd5094c0f1086272cf69ed521c5ec316
|
||||||
|
AWS_SECRET_ACCESS_KEY=bd99a32384636d52baa21504faafe0d60c5a4a6449131bccb7ba6468d7010021
|
||||||
|
AWS_DEFAULT_REGION=auto
|
||||||
|
AWS_BUCKET=cdn-progriva
|
||||||
|
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||||
|
|
||||||
|
PUSHER_APP_ID=
|
||||||
|
PUSHER_APP_KEY=
|
||||||
|
PUSHER_APP_SECRET=
|
||||||
|
PUSHER_APP_CLUSTER=mt1
|
||||||
|
|
||||||
|
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||||
|
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
@ -0,0 +1,52 @@
|
||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=null
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=laravel
|
||||||
|
DB_USERNAME=root
|
||||||
|
DB_PASSWORD=
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=file
|
||||||
|
FILESYSTEM_DRIVER=local
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
SESSION_DRIVER=file
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=mailhog
|
||||||
|
MAIL_PORT=1025
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
MAIL_FROM_ADDRESS=null
|
||||||
|
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
|
||||||
|
|
||||||
|
PUSHER_APP_ID=
|
||||||
|
PUSHER_APP_KEY=
|
||||||
|
PUSHER_APP_SECRET=
|
||||||
|
PUSHER_APP_CLUSTER=mt1
|
||||||
|
|
||||||
|
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||||
|
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
@ -0,0 +1,8 @@
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{HTTPS} off
|
||||||
|
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||||
|
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteRule ^(.*)$ public/$1 [L]
|
||||||
|
</IfModule>
|
|
@ -0,0 +1,14 @@
|
||||||
|
php:
|
||||||
|
preset: laravel
|
||||||
|
version: 8
|
||||||
|
disabled:
|
||||||
|
- no_unused_imports
|
||||||
|
finder:
|
||||||
|
not-name:
|
||||||
|
- index.php
|
||||||
|
- server.php
|
||||||
|
js:
|
||||||
|
finder:
|
||||||
|
not-name:
|
||||||
|
- webpack.mix.js
|
||||||
|
css: true
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => 'User'
|
||||||
|
];
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\User\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class UserDatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
Model::unguard();
|
||||||
|
|
||||||
|
// $this->call("OthersTableSeeder");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,227 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\User\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use App\Models\Gejala;
|
||||||
|
use App\Models\Penyakit;
|
||||||
|
use App\Models\Riwayat;
|
||||||
|
use App\Models\Rule;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Kondisi;
|
||||||
|
|
||||||
|
use DataTables;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class UserController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Diagnosa',
|
||||||
|
];
|
||||||
|
|
||||||
|
$gejala = Gejala::all();
|
||||||
|
return view('user::index', compact('data', 'gejala'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function profile()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Akun anda',
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('user::setting', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function riwayat(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$data = Riwayat::where('id_user', user()->id)->get();
|
||||||
|
// Convert the Eloquent Collection to a regular PHP array
|
||||||
|
$data->each(function ($item, $key) {
|
||||||
|
$item->rowIndex = $key + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
return Datatables::of($data)
|
||||||
|
->addIndexColumn()
|
||||||
|
->addColumn('title-post', function($row){
|
||||||
|
$text = '
|
||||||
|
<p class="mb-0">' . $row->gejala . '</p>
|
||||||
|
';
|
||||||
|
return $text;
|
||||||
|
})
|
||||||
|
->addColumn('penyakit', function($row){
|
||||||
|
$getPenyakit = unserialize($row->penyakit);
|
||||||
|
$namePenyakit = [];
|
||||||
|
$i = 0;
|
||||||
|
foreach ($getPenyakit as $key1 => $value1) {
|
||||||
|
$i++;
|
||||||
|
$namePenyakit[$i] = $key1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Penyakit::where('kode_penyakit', $namePenyakit[1])->first()->nama_penyakit;
|
||||||
|
})
|
||||||
|
->addColumn('tingkat', function($row){
|
||||||
|
$persen = round($row->persen *100, 2);
|
||||||
|
return "<span class='text-success'>{$persen}%</span>";
|
||||||
|
})
|
||||||
|
->addColumn('penanganan', function($row){
|
||||||
|
$getPenyakit = unserialize($row->penyakit);
|
||||||
|
$namePenyakit = [];
|
||||||
|
$i = 0;
|
||||||
|
foreach ($getPenyakit as $key1 => $value1) {
|
||||||
|
$i++;
|
||||||
|
$namePenyakit[$i] = $key1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Penyakit::where('kode_penyakit', $namePenyakit[1])->first()->penanganan;
|
||||||
|
})
|
||||||
|
->addColumn('penjelasan', function($row){
|
||||||
|
return '1';
|
||||||
|
})
|
||||||
|
->addColumn('waktu_diagnosa', function($row){
|
||||||
|
return Carbon::parse($row->waktu)->format('j F Y H:i:s');
|
||||||
|
})
|
||||||
|
->rawColumns(['title-post', 'jenis_gejala', 'tingkat', 'waktu_diagnosa', 'penjelasan'])
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Riwayat Diagnosa'
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('user::riwayat.index', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$id = user()->id;
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'name' => 'required',
|
||||||
|
'email' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->with('error', $validator->errors()->first())->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$input = $request->all();
|
||||||
|
$findUser = User::find($id);
|
||||||
|
|
||||||
|
if($findUser) {
|
||||||
|
// update data
|
||||||
|
$findUser->name = $input['name'];
|
||||||
|
$findUser->email = $input['email'];
|
||||||
|
if(!empty($input['password'])) {
|
||||||
|
$findUser->password = bcrypt($input['password']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// save data
|
||||||
|
$findUser->save();
|
||||||
|
return redirect()->back()->with('success', 'Successfully update data');
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('error', 'Unexpected error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function diagnosa(Request $request)
|
||||||
|
{
|
||||||
|
$arcolor = array('#ffffff', '#cc66ff', '#019AFF', '#00CBFD', '#00FEFE', '#A4F804', '#FFFC00', '#FDCD01', '#FD9A01', '#FB6700');
|
||||||
|
$inptanggal = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
$arbobot = array('1', '0.8', '0.6', '0.4', '0.2', '0');
|
||||||
|
$argejala = array();
|
||||||
|
$arkondisitext = array();
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($_POST['kondisi']); $i++) {
|
||||||
|
$arkondisi = explode("_", $_POST['kondisi'][$i]);
|
||||||
|
if (strlen($_POST['kondisi'][$i]) > 1) {
|
||||||
|
$argejala += array($arkondisi[0] => $arkondisi[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(Kondisi::all() as $kondisi) {
|
||||||
|
$arkondisitext[$kondisi->id] = $kondisi->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
//print_r($arkondisitext);
|
||||||
|
// -------- perhitungan certainty factor (CF) ---------
|
||||||
|
// --------------------- START ------------------------
|
||||||
|
$arpenyakit = array();
|
||||||
|
foreach(Penyakit::all() as $rpenyakit) {
|
||||||
|
|
||||||
|
$cftotal_temp = 0;
|
||||||
|
$cf = 0;
|
||||||
|
$cflama = 0;
|
||||||
|
$urutancf = 1;
|
||||||
|
|
||||||
|
foreach(Rule::where('kode_penyakit', $rpenyakit->kode_penyakit)->get() as $rgejala) {
|
||||||
|
for ($i = 0; $i < count($_POST['kondisi']); $i++) {
|
||||||
|
$arkondisi = explode("_", $_POST['kondisi'][$i]);
|
||||||
|
$gejala = $arkondisi[0];
|
||||||
|
|
||||||
|
// echo $arkondisi[1] . '<br>';
|
||||||
|
|
||||||
|
if ($rgejala->kode_gejala === $gejala) {
|
||||||
|
// kondisi terpilih
|
||||||
|
$bobotNilai = Kondisi::where('id', $arkondisi[1])->first()->nilai;
|
||||||
|
// CF[H]
|
||||||
|
$cf = ($rgejala->mb - $rgejala->md) * $bobotNilai;
|
||||||
|
|
||||||
|
// echo 'CF GEJALA SAAT INI ( ' . $rpenyakit->nama_penyakit . ' - ' . $rgejala->kode_gejala . ' ) : CF PAKAR * CF KONDISI DIPILIH USER <br>';
|
||||||
|
// echo 'CF GEJALA SAAT INI:' . $cf . ' * ' . $bobotNilai . '<br>';
|
||||||
|
// echo 'CF GEJALA SAAT ini: ' . $cf * $bobotNilai . '<br><br>';
|
||||||
|
|
||||||
|
if (($cf >= 0) && ($cf * $cflama >= 0)) {
|
||||||
|
$cflama = $cflama + ($cf * (1 - $cflama));
|
||||||
|
}
|
||||||
|
if ($cf * $cflama < 0) {
|
||||||
|
$cflama = ($cflama + $cf) / (1 - min(abs($cflama), abs($cf)));
|
||||||
|
}
|
||||||
|
if (($cf < 0) && ($cf * $cflama >= 0)) {
|
||||||
|
$cflama = $cflama + ($cf * (1 + $cflama));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cflama > 0) {
|
||||||
|
$arpenyakit += array($rpenyakit->kode_penyakit => number_format($cflama, 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
arsort($arpenyakit);
|
||||||
|
|
||||||
|
$inpgejala = serialize($argejala);
|
||||||
|
$inppenyakit = serialize($arpenyakit);
|
||||||
|
|
||||||
|
$simpan = Riwayat::create([
|
||||||
|
'id_user' => user()->id,
|
||||||
|
'jawaban' => $inpgejala,
|
||||||
|
'penyakit' => $inppenyakit,
|
||||||
|
'persen' => reset($arpenyakit)
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data['arpenyakit'] = $arpenyakit;
|
||||||
|
$data['arcolor'] = $arcolor;
|
||||||
|
$data['list_gejala'] = $argejala;
|
||||||
|
$data['arkondisitext'] = $arkondisitext;
|
||||||
|
|
||||||
|
if($simpan) {
|
||||||
|
$data['subtitle'] = 'Hasil Diagnosa';
|
||||||
|
return view('user::diagnosa', compact('data'));
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('error', 'Unexpected error in diagnosa process');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\User\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The module namespace to assume when generating URLs to actions.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $moduleNamespace = 'Modules\User\Http\Controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before routes are registered.
|
||||||
|
*
|
||||||
|
* Register any model bindings or pattern based filters.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the routes for the application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function map()
|
||||||
|
{
|
||||||
|
$this->mapApiRoutes();
|
||||||
|
|
||||||
|
$this->mapWebRoutes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "web" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes all receive session state, CSRF protection, etc.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function mapWebRoutes()
|
||||||
|
{
|
||||||
|
Route::middleware('web')
|
||||||
|
->namespace($this->moduleNamespace)
|
||||||
|
->group(module_path('User', '/Routes/web.php'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "api" routes for the application.
|
||||||
|
*
|
||||||
|
* These routes are typically stateless.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function mapApiRoutes()
|
||||||
|
{
|
||||||
|
Route::prefix('api')
|
||||||
|
->middleware('api')
|
||||||
|
->namespace($this->moduleNamespace)
|
||||||
|
->group(module_path('User', '/Routes/api.php'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\User\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Database\Eloquent\Factory;
|
||||||
|
|
||||||
|
class UserServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string $moduleName
|
||||||
|
*/
|
||||||
|
protected $moduleName = 'User';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string $moduleNameLower
|
||||||
|
*/
|
||||||
|
protected $moduleNameLower = 'user';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boot the application events.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->registerTranslations();
|
||||||
|
$this->registerConfig();
|
||||||
|
$this->registerViews();
|
||||||
|
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
$this->app->register(RouteServiceProvider::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register config.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function registerConfig()
|
||||||
|
{
|
||||||
|
$this->publishes([
|
||||||
|
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||||
|
], 'config');
|
||||||
|
$this->mergeConfigFrom(
|
||||||
|
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register views.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function registerViews()
|
||||||
|
{
|
||||||
|
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||||
|
|
||||||
|
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||||
|
|
||||||
|
$this->publishes([
|
||||||
|
$sourcePath => $viewPath
|
||||||
|
], ['views', $this->moduleNameLower . '-module-views']);
|
||||||
|
|
||||||
|
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register translations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function registerTranslations()
|
||||||
|
{
|
||||||
|
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||||
|
|
||||||
|
if (is_dir($langPath)) {
|
||||||
|
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||||
|
} else {
|
||||||
|
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the services provided by the provider.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function provides()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPublishableViewPaths(): array
|
||||||
|
{
|
||||||
|
$paths = [];
|
||||||
|
foreach (\Config::get('view.paths') as $path) {
|
||||||
|
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||||
|
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $paths;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
@include('components.theme.pages.header-user')
|
||||||
|
<section>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<h1 class="h4 text-gray-800 mb-2 font-weight-bold">{{ $data['subtitle'] }}</h1>
|
||||||
|
<p class="mb-0">Terima kasih telah menggunakan layanan ini, kami menemukan indikasi penyakit dari gejala yang dipilih sebelumnya. Berikut informasi ringkas dan cara penanganannya.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<!--begin::Wrapper-->
|
||||||
|
<h6 class="mb-3 font-weight-bold">Gejala yang dialami</h6>
|
||||||
|
<table id="tbl-list" class="table table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th width="50px" style="background: #67CDFF; color: white">No</th>
|
||||||
|
<th style="background: #67CDFF; color: white">Gejala</th>
|
||||||
|
<th style="background: #67CDFF; color: white">Pilihan</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<?php $i = 1; foreach($data['list_gejala'] as $key => $value){ ?>
|
||||||
|
@php
|
||||||
|
$kondisi = $value;
|
||||||
|
$gejala = \App\Models\Gejala::where('kode_gejala', $key)->first();
|
||||||
|
@endphp
|
||||||
|
<tr>
|
||||||
|
<td width="30px"><?php echo $i++?></td>
|
||||||
|
<td><?php echo $gejala->kode_gejala ." - " . $gejala->gejala ?></td>
|
||||||
|
<td><span style="color:{{ $data['arcolor'][$kondisi] }}">{{ $data['arkondisitext'][$kondisi] }}</span></td>
|
||||||
|
</tr>
|
||||||
|
<?php }?>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!--end::Wrapper-->
|
||||||
|
<h6 class="mt-3 mb-2 font-weight-bold">Hasil Diagnosis</h6>
|
||||||
|
<p class="mb-2">Berdasarkan data gejala yang dipilih, kami memberikan hasil preferensi dari diagnosis yang dilakukan oleh {{ user()->name }}</p>
|
||||||
|
|
||||||
|
@php
|
||||||
|
$detailPenyakit = \App\Models\Penyakit::where('kode_penyakit', array_keys($data['arpenyakit'])[0])->first();
|
||||||
|
$persentase = reset($data['arpenyakit']);
|
||||||
|
@endphp
|
||||||
|
<p class="mt-3">
|
||||||
|
Berdasarkan gejalanya, sapi milik {{ user()->name }} di prediksi mengidap penyakit <b>{{ $detailPenyakit->nama_penyakit }}</b> dengan tingkat kepercayaan <b>{{ round($persentase * 100, 2) . ' %' . '(' . $persentase . ')' }}</b><br/>
|
||||||
|
Penjelasan: {{ $detailPenyakit->penjelasan }}. Penyakit ini dapat ditangani dengan cara <i>{{ $detailPenyakit->penanganan }}</i>. <p class="text-danger small">*Hasil diagnosa ini masih membutuhkan pemeriksaan lebih lanjut untuk mendapatkan hasil yang lebih akurat.</p>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="mb-2">Kemungkinan lain:</p>
|
||||||
|
@php
|
||||||
|
array_shift($data['arpenyakit']);
|
||||||
|
$no = 1;
|
||||||
|
@endphp
|
||||||
|
@foreach($data['arpenyakit'] as $key => $value)
|
||||||
|
@php
|
||||||
|
$getDetailAlternatif = \App\Models\Penyakit::where('kode_penyakit', $key)->first();
|
||||||
|
@endphp
|
||||||
|
<h6 class="mb-2">
|
||||||
|
<i class='fas fa-caret-square-o-right'></i> {{ $no++ }}. {{ $getDetailAlternatif->nama_penyakit }} dengan tingkat kepercayaan <b>{{ round($value * 100, 2) }} %</b> <br>
|
||||||
|
</h6>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group mt-3">
|
||||||
|
<a href="{{ site_url('user', '/') }}" class="btn btn-dark"><i class="fa fa-arrow-left"></i> Kembali</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,95 @@
|
||||||
|
@include('components.theme.pages.header-user')
|
||||||
|
<section>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
|
||||||
|
<div class="d-flex mb-4">
|
||||||
|
<h1 class="h3 text-gray-800">Selamat datang kembali! <b>{{ user()->name }}</b></h1>
|
||||||
|
@if(!empty($data['button']))
|
||||||
|
<!--begin::Action-->
|
||||||
|
<div class="ml-auto">
|
||||||
|
@php
|
||||||
|
$url = $data['module']['url'];
|
||||||
|
@endphp
|
||||||
|
<a href="{{ $data['module']['url'] }}" class="btn btn-primary">
|
||||||
|
{{ explode(' ', $data['module']['name'])[0] }} <span class="d-none d-sm-inline ps-2">{{ ucfirst(explode(' ', $data['module']['name'])[1]) }}</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header d-flex align-items-center">
|
||||||
|
<h6 class="m-0 h6 font-weight-bold text-primary">Formulir Diagnosa</h6>
|
||||||
|
<span class="ml-auto text-danger small">* harap pilih</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
@if(session()->has('success'))
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{{ session()->get('success') }}
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
@if(session()->has('error'))
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
{{ session()->get('error') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
<!--begin::Wrapper-->
|
||||||
|
<h5>Pilih <b>Gejala</b> Yang Sapi Anda Alami</h5>
|
||||||
|
<p class="text-muted small">Dengan melakukan diagnosa, anda akan mendapatkan edukasi dini terkait penyakit yang dialami berdasarkan gejala-gejala yang timbul</p>
|
||||||
|
<hr>
|
||||||
|
<form method="POST" id="form-diagnosa" action="{{ route('diagnosa') }}">
|
||||||
|
@csrf
|
||||||
|
<div class="table-responsive mb-0">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr style="background: #67CDFF; color: white">
|
||||||
|
<th>No.</th>
|
||||||
|
<th>Gejala</th>
|
||||||
|
<th>Kondisi</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@php $no = 1; @endphp
|
||||||
|
<?php foreach ($gejala as $gjl) : ?>
|
||||||
|
<tr>
|
||||||
|
<td class="align-middle text-center">{{ $no++ }}</td>
|
||||||
|
<td class="align-middle">{{ $gjl->kode_gejala }} - {{ $gjl->gejala }}</td>
|
||||||
|
<td>
|
||||||
|
<select class="form-control" name="kondisi[]">
|
||||||
|
<option value="">Pilih Kondisi</option>
|
||||||
|
@foreach(\App\Models\Kondisi::all() as $kondisi)
|
||||||
|
<option value="{{ $gjl->kode_gejala . '_' . $kondisi->id }}"><?= $kondisi->name; ?></option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-0 mt-4">
|
||||||
|
<button class="btn btn-primary process" type="button">Diagnosa</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.process').on('click', function() {
|
||||||
|
$(this).html('<i class="fa fa-spinner fa-spin"></i> Processing...').attr('disabled', 'disabled');
|
||||||
|
setTimeout(function() {
|
||||||
|
$('.process').html('Diagnosa').removeAttr('disabled');
|
||||||
|
$('#form-diagnosa').submit();
|
||||||
|
}, 5000);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,79 @@
|
||||||
|
@include('components.theme.pages.header-user')
|
||||||
|
<section>
|
||||||
|
<!-- basic table -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
|
||||||
|
<div class="d-flex mb-4">
|
||||||
|
<h1 class="h3 text-gray-800">{{ $data['subtitle'] }}</h1>
|
||||||
|
@if(!empty($data['button']))
|
||||||
|
<!--begin::Action-->
|
||||||
|
<div class="ml-auto">
|
||||||
|
@php
|
||||||
|
$url = $data['module']['url'];
|
||||||
|
@endphp
|
||||||
|
<a href="{{ $data['module']['url'] }}" class="btn btn-primary">
|
||||||
|
{{ explode(' ', $data['module']['name'])[0] }} <span class="d-none d-sm-inline ps-2">{{ ucfirst(explode(' ', $data['module']['name'])[1]) }}</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
@if(session()->has('success'))
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{{ session()->get('success') }}
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
@if(session()->has('error'))
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
{{ session()->get('error') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
<!--end::Wrapper-->
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="data-table" class="table" width="100%">
|
||||||
|
<thead>
|
||||||
|
<tr class="text-start">
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Waktu Diagnosa</th>
|
||||||
|
<th>Persentase (%)</th>
|
||||||
|
<th>Indikasi Penyakit</th>
|
||||||
|
<th>Penanganan</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function () {
|
||||||
|
|
||||||
|
var table = $('#data-table').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
|
ajax: "{{ site_url('user', 'riwayat') }}",
|
||||||
|
columns: [
|
||||||
|
{data: null, name: 'id_jawaban'},
|
||||||
|
{data: 'waktu_diagnosa', name: 'waktu_diagnosa'},
|
||||||
|
{data: 'tingkat', name: 'tingkat'},
|
||||||
|
{data: 'penyakit', name: 'penyakit'},
|
||||||
|
{data: 'penanganan', name: 'penanganan'},
|
||||||
|
],
|
||||||
|
createdRow: function (row, data, dataIndex) {
|
||||||
|
// Set the sequential number starting from 1
|
||||||
|
$('td', row).eq(0).html(dataIndex + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,47 @@
|
||||||
|
@include('components.theme.pages.header-user')
|
||||||
|
<section>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 mt-9">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="h6 m-0 text-primary font-weight-bold">Umum</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="{{ site_url('user', 'account/update') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
@if(session()->has('success'))
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{{ session()->get('success') }}
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
@if(session()->has('error'))
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
{{ session()->get('error') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6 form-group">
|
||||||
|
<label class="form-label">Nama Lengkap<sup class="ml-1 text-danger">*</sup></label>
|
||||||
|
<input type="text" name="name" class="form-control" value="{{ user()->name }}" placeholder="Nama Lengkap">
|
||||||
|
</div>
|
||||||
|
<div class="col-6 form-group">
|
||||||
|
<label class="form-label">Alamat Email<sup class="ml-1 text-danger">*</sup></label>
|
||||||
|
<input type="email" name="email" class="form-control" id="email" value="{{ user()->email }}" placeholder="Alamat Email">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group mb-3">
|
||||||
|
<label class="form-label mb-3">Kata Sandi<span class="ml-2 small text-danger">opsional (kosongi jika tidak ingin merubah)</span></label>
|
||||||
|
<input type="password" name="password" class="form-control" value="" placeholder="Kata Sandi">
|
||||||
|
</div>
|
||||||
|
<div class="form-group mb-n1">
|
||||||
|
<button type="submit" class="btn btn-primary">Simpan</button>
|
||||||
|
<a href="{{ site_url('user', '/') }}" class="btn btn-dark">Kembali</a>
|
||||||
|
</div>
|
||||||
|
{!! Form::close() !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
@include('components.theme.pages.footer')
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| API Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is where you can register API routes for your application. These
|
||||||
|
| routes are loaded by the RouteServiceProvider within a group which
|
||||||
|
| is assigned the "api" middleware group. Enjoy building your API!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||||
|
return $request->user();
|
||||||
|
});
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Web Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is where you can register web routes for your application. These
|
||||||
|
| routes are loaded by the RouteServiceProvider within a group which
|
||||||
|
| contains the "web" middleware group. Now create something great!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Route::group(['middleware' => ['auth'], 'prefix' => 'user'], function () {
|
||||||
|
Route::get('/', 'UserController@index');
|
||||||
|
Route::prefix('account')->group(function () {
|
||||||
|
Route::get('/', 'UserController@profile');
|
||||||
|
Route::post('update', 'UserController@update');
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::post('diagnosa', 'UserController@diagnosa')->name('diagnosa');
|
||||||
|
Route::get('riwayat', 'UserController@riwayat')->name('riwayat');
|
||||||
|
});
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"name": "nwidart/user",
|
||||||
|
"description": "",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Widart",
|
||||||
|
"email": "n.widart@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [],
|
||||||
|
"aliases": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Modules\\User\\": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name": "User",
|
||||||
|
"alias": "user",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"priority": 0,
|
||||||
|
"providers": [
|
||||||
|
"Modules\\User\\Providers\\UserServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [],
|
||||||
|
"requires": []
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "npm run development",
|
||||||
|
"development": "mix",
|
||||||
|
"watch": "mix watch",
|
||||||
|
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||||
|
"hot": "mix watch --hot",
|
||||||
|
"prod": "npm run production",
|
||||||
|
"production": "mix --production"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"axios": "^0.21.4",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
|
"dotenv-expand": "^5.1.0",
|
||||||
|
"laravel-mix": "^6.0.31",
|
||||||
|
"laravel-mix-merge-manifest": "^2.0.0",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"postcss": "^8.3.7"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
const dotenvExpand = require('dotenv-expand');
|
||||||
|
dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/}));
|
||||||
|
|
||||||
|
const mix = require('laravel-mix');
|
||||||
|
require('laravel-mix-merge-manifest');
|
||||||
|
|
||||||
|
mix.setPublicPath('../../public').mergeManifest();
|
||||||
|
|
||||||
|
mix.js(__dirname + '/Resources/assets/js/app.js', 'js/user.js')
|
||||||
|
.sass( __dirname + '/Resources/assets/sass/app.scss', 'css/user.css');
|
||||||
|
|
||||||
|
if (mix.inProduction()) {
|
||||||
|
mix.version();
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Modules\Seller\Entities\PaymentModel as Payment;
|
||||||
|
use App\Enums\GlobalEnum as Status;
|
||||||
|
|
||||||
|
class DepositCommand extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'deposit:update';
|
||||||
|
protected $description = 'Update status in deposit every minutes';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$orders = Payment::where('is_status', Status::isDepositPending)->get(); // Sesuaikan dengan logika pengambilan data
|
||||||
|
$currentTimestamp = time(); // Get the current timestamp
|
||||||
|
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
$createdAtTimestamp = strtotime($order->created_at);
|
||||||
|
|
||||||
|
// Add 3 days to the creation date timestamp
|
||||||
|
$expiryTimestamp = $createdAtTimestamp + (3 * 24 * 60 * 60); // 3 days in seconds
|
||||||
|
|
||||||
|
// Compare the expiry timestamp with the current timestamp
|
||||||
|
$isExpired = $expiryTimestamp < $currentTimestamp;
|
||||||
|
$expired = $isExpired ? true : false;
|
||||||
|
|
||||||
|
if($expired == true) {
|
||||||
|
$findOrder = Payment::find($order->id);
|
||||||
|
$findOrder->is_status = Status::isDepositCancel;
|
||||||
|
|
||||||
|
// save
|
||||||
|
$findOrder->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info('Status updated successfully!');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Modules\User\Entities\OrderModel as Order;
|
||||||
|
use App\Enums\GlobalEnum as Status;
|
||||||
|
|
||||||
|
class OrdersCommand extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'orders:update';
|
||||||
|
protected $description = 'Update status in orders every minutes';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$orders = Order::where('is_status', Status::isOrderRequested)->get(); // Sesuaikan dengan logika pengambilan data
|
||||||
|
$currentTimestamp = time(); // Get the current timestamp
|
||||||
|
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
$createdAtTimestamp = strtotime($order->created_at);
|
||||||
|
|
||||||
|
// Add 3 days to the creation date timestamp
|
||||||
|
$expiryTimestamp = $createdAtTimestamp + (3 * 24 * 60 * 60); // 3 days in seconds
|
||||||
|
|
||||||
|
// Compare the expiry timestamp with the current timestamp
|
||||||
|
$isExpired = $expiryTimestamp < $currentTimestamp;
|
||||||
|
$expired = $isExpired ? true : false;
|
||||||
|
|
||||||
|
if($expired == true) {
|
||||||
|
$findOrder = Order::find($order->id);
|
||||||
|
$findOrder->is_status = Status::isOrderCancelled;
|
||||||
|
$findOrder->last_buyer_message = 'Dibatalkan secara otomatis oleh sistem karena melebihi batas waktu 3 hari reseller tidak menanggapi permintaan pesanan';
|
||||||
|
$findOrder->cancel_reason = 'Dibatalkan secara otomatis oleh sistem karena melebihi batas waktu 3 hari reseller tidak menanggapi permintaan pesanan';
|
||||||
|
|
||||||
|
// save
|
||||||
|
$findOrder->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info('Status updated successfully!');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Modules\Seller\Entities\PaymentModel as Payment;
|
||||||
|
use Modules\Seller\Entities\AccountModel as User;
|
||||||
|
use App\Enums\GlobalEnum as Status;
|
||||||
|
|
||||||
|
class RealtimeDepositCommand extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'realtime-deposit:update';
|
||||||
|
protected $description = 'Update status in deposit every minutes';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$orders = Payment::where('is_status', Status::isDepositPending)->get(); // Sesuaikan dengan logika pengambilan data
|
||||||
|
$currentTimestamp = time(); // Get the current timestamp
|
||||||
|
|
||||||
|
foreach ($orders as $order) {
|
||||||
|
$merchantCode = app_info('duitku_merchant');
|
||||||
|
$apiKey = app_info('duitku_client');
|
||||||
|
$merchantOrderId = $order->deposit_number; // dari anda (merchant), bersifat unik
|
||||||
|
$signature = md5($merchantCode . $merchantOrderId . $apiKey);
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
'merchantCode' => $merchantCode,
|
||||||
|
'merchantOrderId' => $merchantOrderId,
|
||||||
|
'signature' => $signature
|
||||||
|
);
|
||||||
|
|
||||||
|
$params_string = json_encode($params);
|
||||||
|
if(app_info('duitku_sandbox') == 1) {
|
||||||
|
$url = 'https://sandbox.duitku.com/webapi/api/merchant/transactionStatus'; // Sandbox
|
||||||
|
} else {
|
||||||
|
$url = 'https://passport.duitku.com/webapi/api/merchant/transactionStatus'; // Production
|
||||||
|
}
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $params_string);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Content-Length: ' . strlen($params_string))
|
||||||
|
);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||||
|
|
||||||
|
//execute post
|
||||||
|
$request = curl_exec($ch);
|
||||||
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
|
||||||
|
if($httpCode == 200)
|
||||||
|
{
|
||||||
|
$results = json_decode($request, true);
|
||||||
|
if($results['statusCode'] == 02) {
|
||||||
|
$findOrder = Payment::find($order->id);
|
||||||
|
$findOrder->is_status = Status::isDepositCancel;
|
||||||
|
$findOrder->urlRedirect = NULL;
|
||||||
|
|
||||||
|
// save
|
||||||
|
$findOrder->save();
|
||||||
|
} elseif($results['statusCode'] == 00) {
|
||||||
|
$findOrder = Payment::find($order->id);
|
||||||
|
$findOrder->is_status = Status::isDepositPaid;
|
||||||
|
$findOrder->urlRedirect = NULL;
|
||||||
|
|
||||||
|
$findUser = User::where('id', $order->user_id)->first();
|
||||||
|
$findUser->balance = ($findUser->balance + $order->amount);
|
||||||
|
|
||||||
|
// save
|
||||||
|
$findOrder->save();
|
||||||
|
$findUser->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info('Status updated successfully!');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console;
|
||||||
|
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
|
class Kernel extends ConsoleKernel
|
||||||
|
{
|
||||||
|
protected function schedule(Schedule $schedule)
|
||||||
|
{
|
||||||
|
$schedule->command('orders:update')->everyFiveMinutes();
|
||||||
|
$schedule->command('deposit:update')->everyFiveMinutes();
|
||||||
|
$schedule->command('realtime-deposit:update')->everyFiveMinutes();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function commands()
|
||||||
|
{
|
||||||
|
$this->load(__DIR__.'/Commands');
|
||||||
|
require base_path('routes/console.php');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,167 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
use MadWeb\Enum\Enum;
|
||||||
|
|
||||||
|
final class GlobalEnum extends Enum
|
||||||
|
{
|
||||||
|
// enum management menu
|
||||||
|
const isAdmin = 1;
|
||||||
|
const isEditor = 2;
|
||||||
|
const isModerator = 3;
|
||||||
|
const isMembers = 4;
|
||||||
|
const isKepalaSekolah = 2;
|
||||||
|
const isKonselor = 3;
|
||||||
|
const isSiswa = 4;
|
||||||
|
const isWaliMurid = 5;
|
||||||
|
|
||||||
|
// enum sites status
|
||||||
|
const isWebsiteActive = 1;
|
||||||
|
const isWebsiteInReview = 2;
|
||||||
|
const isWebsiteNotActive = 3;
|
||||||
|
const isWebsiteRejected = 4;
|
||||||
|
const isWebsiteDeactivated = 5;
|
||||||
|
|
||||||
|
// enum domain status
|
||||||
|
const isDomainActive = 1;
|
||||||
|
const isDomainInReview = 2;
|
||||||
|
const isDomainNotActive = 3;
|
||||||
|
const isDomainRejected = 4;
|
||||||
|
const isDomainDeactivated = 5;
|
||||||
|
|
||||||
|
// enum log type
|
||||||
|
const LogOfLogin = 1;
|
||||||
|
const LogOfGeneral = 2;
|
||||||
|
|
||||||
|
// enum buzzer services status
|
||||||
|
const isServiceActive = 1;
|
||||||
|
const isServiceNotActive = 2;
|
||||||
|
|
||||||
|
// enum withdrawal status
|
||||||
|
const isWithdrawPending = 1;
|
||||||
|
const isWithdrawOnProgress = 2;
|
||||||
|
const isWithdrawPaid = 3;
|
||||||
|
const isWithdrawCancel = 4;
|
||||||
|
|
||||||
|
// enum order status
|
||||||
|
const isOrderRequested = 1;
|
||||||
|
const isOrderOnWorking = 2;
|
||||||
|
const isOrderSubmitted = 3;
|
||||||
|
const isOrderRevision = 4;
|
||||||
|
const isOrderCompleted = 5;
|
||||||
|
const isOrderReqCancel = 6;
|
||||||
|
const isOrderCancelled = 7;
|
||||||
|
const isOrderRejected = 8;
|
||||||
|
|
||||||
|
// enum order history status
|
||||||
|
const isHistoryDone = 1;
|
||||||
|
const isHistoryRevision = 2;
|
||||||
|
const isHistoryJobDone = 3;
|
||||||
|
const isHistoryReqCancel = 4;
|
||||||
|
const isHistoryCanceled = 5;
|
||||||
|
|
||||||
|
// enum product buzzer & services status
|
||||||
|
const isProductActive = 1;
|
||||||
|
const isProductNotActive = 2;
|
||||||
|
|
||||||
|
// enum product buzzer order status
|
||||||
|
const isProductOrderPending = 1;
|
||||||
|
const isProductOrderPaymentAlready = 2;
|
||||||
|
const isProductOrderProcess = 3;
|
||||||
|
const isProductOrderDone = 4;
|
||||||
|
const isProductOrderCancel = 5;
|
||||||
|
|
||||||
|
const isProductOrderTypeMixed = 1;
|
||||||
|
const isProductOrderTypeMen = 2;
|
||||||
|
const isProductOrderTypeWomen = 3;
|
||||||
|
|
||||||
|
// enum product buzzer order detail comment status
|
||||||
|
const isProductCommentPending = 1;
|
||||||
|
const isProductCommentInReview = 2;
|
||||||
|
const isProductCommentDeclined = 3;
|
||||||
|
const isProductCommentApproved = 4;
|
||||||
|
|
||||||
|
// enum order type
|
||||||
|
const isOrderSites = 1;
|
||||||
|
const isOrderDomain = 2;
|
||||||
|
|
||||||
|
// enum user status
|
||||||
|
const isActive = 1;
|
||||||
|
const isInactive = 2;
|
||||||
|
const isDeactive = 3;
|
||||||
|
const isNotVerified = 4;
|
||||||
|
|
||||||
|
// enum seller status
|
||||||
|
const isSellerActive = 1;
|
||||||
|
const isSellerInActive = 2;
|
||||||
|
|
||||||
|
// enum order status
|
||||||
|
const isOrderPending = 1;
|
||||||
|
const isOrderProcessing = 2;
|
||||||
|
const isOrderInReview = 3;
|
||||||
|
const isOrderDeclined = 4;
|
||||||
|
const isOrderSuccessed = 5;
|
||||||
|
|
||||||
|
// enum deposit status
|
||||||
|
const isDepositPending = 1;
|
||||||
|
const isDepositInquiry = 2;
|
||||||
|
const isDepositFailed = 3;
|
||||||
|
const isDepositPaid = 4;
|
||||||
|
const isDepositCancel = 5;
|
||||||
|
|
||||||
|
// enum methodWithDeposit
|
||||||
|
const isMethodPayLater = 0;
|
||||||
|
const isMethodVirtual = 1;
|
||||||
|
|
||||||
|
// enum promotion status
|
||||||
|
const isPromotionAvailable = 1;
|
||||||
|
const isPromotionUsed = 2;
|
||||||
|
|
||||||
|
// enum content status
|
||||||
|
const isPostPublished = 1;
|
||||||
|
const isPostDraft = 2;
|
||||||
|
|
||||||
|
// enum ticket status
|
||||||
|
const isTicketPending = 1;
|
||||||
|
const isTicketClosed = 2;
|
||||||
|
const isTicketReplied = 3;
|
||||||
|
|
||||||
|
/* enum website-config
|
||||||
|
[1] SMTP Config
|
||||||
|
[2] Maintenance Mode
|
||||||
|
*/
|
||||||
|
const isMailerEnabled = 1;
|
||||||
|
const isMailerDisabled = 2;
|
||||||
|
const isMaintenanceMode = 3;
|
||||||
|
|
||||||
|
/* enum for seller modules
|
||||||
|
[1] Sites Listing
|
||||||
|
[2] Rekening
|
||||||
|
*/
|
||||||
|
const isSiteActive = 1;
|
||||||
|
const isSiteInReview = 2;
|
||||||
|
const isSiteNotActive = 3;
|
||||||
|
const isSiteRejected = 4;
|
||||||
|
const isSiteDeactivated = 5;
|
||||||
|
|
||||||
|
const isSiteOwner = 1;
|
||||||
|
const isSiteAuthor = 2;
|
||||||
|
|
||||||
|
const isSiteTypeDoFollow = 1;
|
||||||
|
const isSiteTypeNoFollow = 2;
|
||||||
|
|
||||||
|
// rekening status
|
||||||
|
const isRekeningActive = 1;
|
||||||
|
const isRekeningInactive = 2;
|
||||||
|
|
||||||
|
// ticket status
|
||||||
|
const isTicketSellerPending = 1;
|
||||||
|
const isTicketUserReplied = 2;
|
||||||
|
const isTicketAdminReplied = 3;
|
||||||
|
const isTicketSellerClosed = 4;
|
||||||
|
|
||||||
|
const isTicketPriorityNormal = 1;
|
||||||
|
const isTicketPriorityMedium = 2;
|
||||||
|
const isTicketPriorityHigh = 3;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
use MadWeb\Enum\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method static ProjectStatusEnum FOO()
|
||||||
|
* @method static ProjectStatusEnum BAR()
|
||||||
|
* @method static ProjectStatusEnum BAZ()
|
||||||
|
*/
|
||||||
|
final class ProjectStatusEnum extends Enum
|
||||||
|
{
|
||||||
|
const default = 0;
|
||||||
|
const PUBLISH = 1;
|
||||||
|
const DRAFT = 0;
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exceptions;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class Handler extends ExceptionHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A list of the exception types that are not reported.
|
||||||
|
*
|
||||||
|
* @var array<int, class-string<Throwable>>
|
||||||
|
*/
|
||||||
|
protected $dontReport = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of the inputs that are never flashed for validation exceptions.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $dontFlash = [
|
||||||
|
'current_password',
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the exception handling callbacks for the application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
$this->reportable(function (Throwable $e) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,523 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
if (!function_exists('isAttachment')) {
|
||||||
|
/**
|
||||||
|
* Determines if the given image is an attachment.
|
||||||
|
*
|
||||||
|
* @param string $image The path of the image file.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function isAttachment($image){
|
||||||
|
$extension = pathinfo($image, PATHINFO_EXTENSION);
|
||||||
|
$imgExtArr = ['jpg', 'jpeg', 'png'];
|
||||||
|
if(in_array($extension, $imgExtArr)){
|
||||||
|
echo 'images';
|
||||||
|
} elseif(in_array($extension, ['xls','xlsx'])) {
|
||||||
|
echo 'excel';
|
||||||
|
} else {
|
||||||
|
echo 'word';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('app_info'))
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Retrieves the website configuration for the specified name.
|
||||||
|
*
|
||||||
|
* @param string $name The name of the website.
|
||||||
|
* @throws \Some_Exception_Class Description of the exception that can be thrown.
|
||||||
|
* @return mixed The website configuration.
|
||||||
|
*/
|
||||||
|
function app_info($name)
|
||||||
|
{
|
||||||
|
$websiteConfiguration = \App\Models\Website::where('name', $name)->first()->value;
|
||||||
|
return $websiteConfiguration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('app_smtp_info'))
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Retrieves the website configuration for the specified name.
|
||||||
|
*
|
||||||
|
* @param string $name The name of the website.
|
||||||
|
* @throws \Some_Exception_Class Description of the exception that can be thrown.
|
||||||
|
* @return mixed The website configuration.
|
||||||
|
*/
|
||||||
|
function app_smtp_info()
|
||||||
|
{
|
||||||
|
$mailConfiguration = \App\Models\Mail::find(1)->first();
|
||||||
|
return $mailConfiguration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('hasExpired'))
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determines if the given date has expired.
|
||||||
|
*
|
||||||
|
* @param string $date The date to check.
|
||||||
|
* @return bool True if the date has expired, false otherwise.
|
||||||
|
*/
|
||||||
|
function hasExpired($accountCreatedAt)
|
||||||
|
{
|
||||||
|
// Konversi tanggal pembuatan akun menjadi objek DateTime
|
||||||
|
$accountCreatedTime = new DateTime($accountCreatedAt);
|
||||||
|
$currentTime = new DateTime();
|
||||||
|
|
||||||
|
// Hitung selisih waktu antara tanggal pembuatan akun dan waktu saat ini
|
||||||
|
$interval = $accountCreatedTime->diff($currentTime);
|
||||||
|
|
||||||
|
// Periksa jika selisih waktu lebih dari atau sama dengan 60 menit (3600 detik)
|
||||||
|
return $interval->format('%i') >= 60;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('checkExpired'))
|
||||||
|
{
|
||||||
|
function checkExpired($createdAt, $isExpired)
|
||||||
|
{
|
||||||
|
$givenDate = new DateTime($createdAt);
|
||||||
|
$currentDate = new DateTime();
|
||||||
|
|
||||||
|
// Add 3 days to the current date
|
||||||
|
$currentDate->modify('+3 days');
|
||||||
|
// Compare the given date timestamp with the current date + 3 days timestamp
|
||||||
|
$isExpired = $givenDate > $currentDate;
|
||||||
|
return $isExpired;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate an application URL.
|
||||||
|
*
|
||||||
|
* @param string $url The URL to append to the application URL.
|
||||||
|
* @return string The generated application URL.
|
||||||
|
*/
|
||||||
|
if (!function_exists('app_url')) {
|
||||||
|
function app_url($url)
|
||||||
|
{
|
||||||
|
return url('app/' . $url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('site_url')) {
|
||||||
|
function site_url($type, $url)
|
||||||
|
{
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'user':
|
||||||
|
return url('user/' . $url);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('removeUrlPrefix')) {
|
||||||
|
function removeUrlPrefix($url)
|
||||||
|
{
|
||||||
|
$url = preg_replace('#^https?://#', '', $url);
|
||||||
|
// Remove www. prefix
|
||||||
|
$url = preg_replace('#^www\.#', '', $url);
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('invoiceGenerator')) {
|
||||||
|
function invoiceGenerator()
|
||||||
|
{
|
||||||
|
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||||
|
$randomString = '';
|
||||||
|
for ($i = 0; $i < 8; $i++) {
|
||||||
|
$randomString .= $characters[rand(0, strlen($characters) - 1)];
|
||||||
|
}
|
||||||
|
// Membuat invoice dengan format INV-{timestamp}-{karakter-acak}
|
||||||
|
$invoice = 'INV-' . time() . '-' . $randomString;
|
||||||
|
return $invoice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('virtual_gateway')) {
|
||||||
|
function virtual_gateway($data)
|
||||||
|
{
|
||||||
|
$merchantCode = app_info('duitku_merchant');
|
||||||
|
$apiKey = app_info('duitku_client');
|
||||||
|
|
||||||
|
$paymentAmount = $data['amount'];
|
||||||
|
$merchantOrderId = $data['invoice'];
|
||||||
|
$productDetails = 'Pembayaran Deposit Saldo mengggunakan Duitku';
|
||||||
|
$email = user()->email;
|
||||||
|
$phoneNumber = '';
|
||||||
|
$additionalParam = '';
|
||||||
|
$merchantUserInfo = '';
|
||||||
|
$customerVaName = user()->name;
|
||||||
|
$callbackUrl = site_url('user', 'payment/deposit/callback');
|
||||||
|
$returnUrl = site_url('user', 'payment/deposit/return');
|
||||||
|
$expiryPeriod = 1440;
|
||||||
|
$signature = md5($merchantCode . $merchantOrderId . $paymentAmount . $apiKey);
|
||||||
|
|
||||||
|
// Customer Detail
|
||||||
|
$firstName = 'DEPA';
|
||||||
|
$lastName = 'Auto Deposit';
|
||||||
|
$alamat = "Jl. Jakarta";
|
||||||
|
$city = "Jakarta";
|
||||||
|
$postalCode = "11530";
|
||||||
|
$countryCode = "ID";
|
||||||
|
|
||||||
|
$address = array(
|
||||||
|
'firstName' => $firstName,
|
||||||
|
'lastName' => $lastName,
|
||||||
|
'address' => $alamat,
|
||||||
|
'city' => $city,
|
||||||
|
'postalCode' => $postalCode,
|
||||||
|
'phone' => $phoneNumber,
|
||||||
|
'countryCode' => $countryCode
|
||||||
|
);
|
||||||
|
|
||||||
|
$customerDetail = array(
|
||||||
|
'firstName' => $firstName,
|
||||||
|
'lastName' => $lastName,
|
||||||
|
'email' => $email,
|
||||||
|
'phoneNumber' => $phoneNumber,
|
||||||
|
'billingAddress' => $address,
|
||||||
|
'shippingAddress' => $address
|
||||||
|
);
|
||||||
|
|
||||||
|
$item1 = array(
|
||||||
|
'name' => 'Deposit Saldo POSTAMU',
|
||||||
|
'price' => $data['amount'],
|
||||||
|
'quantity' => 1
|
||||||
|
);
|
||||||
|
|
||||||
|
$itemDetails = array($item1);
|
||||||
|
$params = array(
|
||||||
|
'merchantCode' => $merchantCode,
|
||||||
|
'paymentAmount' => $paymentAmount,
|
||||||
|
'paymentMethod' => $data['method'],
|
||||||
|
'merchantOrderId' => $merchantOrderId,
|
||||||
|
'productDetails' => $productDetails,
|
||||||
|
'additionalParam' => $additionalParam,
|
||||||
|
'merchantUserInfo' => $merchantUserInfo,
|
||||||
|
'customerVaName' => $customerVaName,
|
||||||
|
'email' => $email,
|
||||||
|
'phoneNumber' => $phoneNumber,
|
||||||
|
// 'accountLink' => $accountLink,
|
||||||
|
'itemDetails' => $itemDetails,
|
||||||
|
'customerDetail' => $customerDetail,
|
||||||
|
'callbackUrl' => $callbackUrl,
|
||||||
|
'returnUrl' => $returnUrl,
|
||||||
|
'signature' => $signature,
|
||||||
|
'expiryPeriod' => $expiryPeriod
|
||||||
|
);
|
||||||
|
|
||||||
|
$params_string = json_encode($params);
|
||||||
|
|
||||||
|
if(app_info('duitku_sandbox') == 1) {
|
||||||
|
$url = 'https://sandbox.duitku.com/webapi/api/merchant/v2/inquiry'; // Sandbox
|
||||||
|
} else {
|
||||||
|
$url = 'https://passport.duitku.com/webapi/api/merchant/v2/inquiry'; // Production
|
||||||
|
}
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $params_string);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Content-Length: ' . strlen($params_string))
|
||||||
|
);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||||
|
|
||||||
|
//execute post
|
||||||
|
$request = curl_exec($ch);
|
||||||
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if($httpCode == 200) {
|
||||||
|
$result = json_decode($request, true);
|
||||||
|
return [
|
||||||
|
'url' => $result['paymentUrl'],
|
||||||
|
'status' => 'success'
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$result = json_decode($request, true);
|
||||||
|
return [
|
||||||
|
'msg' => 'Terjadi kesalahan tidak terduga.',
|
||||||
|
'status' => 'error',
|
||||||
|
'error' => $result
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('isUrlSecure')) {
|
||||||
|
function isUrlSecure($url)
|
||||||
|
{
|
||||||
|
return strpos($url, 'https://') !== false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('filterExists')) {
|
||||||
|
function filterExists()
|
||||||
|
{
|
||||||
|
if(!empty(\Illuminate\Support\Facades\Request::input('filterType'))
|
||||||
|
|| !empty(\Illuminate\Support\Facades\Request::input('categoryFilter'))
|
||||||
|
|| !empty(\Illuminate\Support\Facades\Request::input('minimumPrice'))
|
||||||
|
|| !empty(\Illuminate\Support\Facades\Request::input('maximumPrice'))
|
||||||
|
|| !empty(\Illuminate\Support\Facades\Request::input('searchFilter'))) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('date_formatting')) {
|
||||||
|
function date_formatting($date, $format)
|
||||||
|
{
|
||||||
|
switch($format)
|
||||||
|
{
|
||||||
|
case 'd-m-Y':
|
||||||
|
return date('d-m-Y', strtotime($date));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'indonesia':
|
||||||
|
$month = array (
|
||||||
|
1 => 'Januari',
|
||||||
|
'Februari',
|
||||||
|
'Maret',
|
||||||
|
'April',
|
||||||
|
'Mei',
|
||||||
|
'Juni',
|
||||||
|
'Juli',
|
||||||
|
'Agustus',
|
||||||
|
'September',
|
||||||
|
'Oktober',
|
||||||
|
'November',
|
||||||
|
'Desember'
|
||||||
|
);
|
||||||
|
$reformat = explode('-', $date);
|
||||||
|
return $reformat[2] . ' ' . $month[ (int)$reformat[1] ] . ' ' . $reformat[0];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'timeago':
|
||||||
|
$time_difference = time() - strtotime($date);
|
||||||
|
if( $time_difference < 1 ) { return '1 detik yang lalu'; }
|
||||||
|
$condition = array( 12 * 30 * 24 * 60 * 60 => 'year',
|
||||||
|
30 * 24 * 60 * 60 => 'bulan',
|
||||||
|
24 * 60 * 60 => 'hari',
|
||||||
|
60 * 60 => 'jam',
|
||||||
|
60 => 'menit',
|
||||||
|
1 => 'detik'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach( $condition as $secs => $str )
|
||||||
|
{
|
||||||
|
$d = $time_difference / $secs;
|
||||||
|
if( $d >= 1 )
|
||||||
|
{
|
||||||
|
$t = round( $d );
|
||||||
|
return $t . ' ' . $str . ( $t > 1 ? '' : '' ) . ' yang lalu';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('findUser')) {
|
||||||
|
function findUser($id)
|
||||||
|
{
|
||||||
|
return \App\Models\User::find($id)->first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('switch_page')) {
|
||||||
|
function switch_page()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('isSeller')) {
|
||||||
|
function isSeller()
|
||||||
|
{
|
||||||
|
$checkUserModel = \App\Models\Seller::where('user_id', \Illuminate\Support\Facades\Auth::user()->id)->count();
|
||||||
|
if($checkUserModel > 0){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('active_page')) {
|
||||||
|
function active_page($activePage)
|
||||||
|
{
|
||||||
|
$currentRoute = \Illuminate\Support\Facades\Route::currentRouteName();
|
||||||
|
if ($currentRoute) {
|
||||||
|
$routeUri = htmlspecialchars($currentRoute);
|
||||||
|
if($routeUri === $activePage) { return 'active'; }
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('routesAll')) {
|
||||||
|
function routesAll()
|
||||||
|
{
|
||||||
|
$routesInAppPrefix = [];
|
||||||
|
foreach (\Illuminate\Support\Facades\Route::getRoutes() as $route) {
|
||||||
|
$uri = $route->uri();
|
||||||
|
|
||||||
|
// Check if the route URI starts with the desired prefix
|
||||||
|
if (strpos($uri, 'app/') === 0) {
|
||||||
|
$routesInAppPrefix[] = $route->action['as'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$convertIntoJson = json_encode($routesInAppPrefix, true);
|
||||||
|
return json_decode($convertIntoJson, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the currently authenticated user.
|
||||||
|
*
|
||||||
|
* @return User The currently authenticated user.
|
||||||
|
*/
|
||||||
|
if (!function_exists('user')) {
|
||||||
|
function user()
|
||||||
|
{
|
||||||
|
return \Illuminate\Support\Facades\Auth::user();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('segment')) {
|
||||||
|
/**
|
||||||
|
* Retrieves a segment from the current request.
|
||||||
|
*
|
||||||
|
* @param int $key The key of the segment to retrieve.
|
||||||
|
* @return mixed The value of the segment.
|
||||||
|
*/
|
||||||
|
function segment($key)
|
||||||
|
{
|
||||||
|
return request()->segment($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('enum')) {
|
||||||
|
/**
|
||||||
|
* Retrieves the value of a constant from the GlobalEnum class.
|
||||||
|
*
|
||||||
|
* @param string $args The name of the constant to retrieve.
|
||||||
|
* @return mixed The value of the constant.
|
||||||
|
*/
|
||||||
|
function enum($args)
|
||||||
|
{
|
||||||
|
return constant("\App\Enums\GlobalEnum::$args");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a Gravatar URL for a given email.
|
||||||
|
*
|
||||||
|
* @param string $email The email address to generate the Gravatar URL for.
|
||||||
|
* @throws None
|
||||||
|
* @return string The Gravatar URL.
|
||||||
|
*/
|
||||||
|
if (!function_exists('gravatar_team')) {
|
||||||
|
function gravatar_team($email)
|
||||||
|
{
|
||||||
|
$username = md5($email);
|
||||||
|
return "https://www.gravatar.com/avatar/$username?s=70&d=retro&r=y";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a number into Indonesian Rupiah format.
|
||||||
|
*
|
||||||
|
* @param int $nominal The number to be converted.
|
||||||
|
* @return string The converted number in Indonesian Rupiah format.
|
||||||
|
*/
|
||||||
|
if (!function_exists('rupiah')) {
|
||||||
|
function rupiah($nominal)
|
||||||
|
{
|
||||||
|
return 'Rp. ' . number_format($nominal,0,',','.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function that changes the given nominal value into a different format.
|
||||||
|
*
|
||||||
|
* @param string $nominal The nominal value to be changed.
|
||||||
|
* @return string The changed nominal value.
|
||||||
|
*/
|
||||||
|
if (!function_exists('rupiah_changer')) {
|
||||||
|
function rupiah_changer($nominal)
|
||||||
|
{
|
||||||
|
if(strlen($nominal) == 4) {
|
||||||
|
return substr($nominal, 0, 1) . 'RB';
|
||||||
|
} elseif(strlen($nominal) == 5) {
|
||||||
|
return substr($nominal, 0, 2) . 'RB';
|
||||||
|
} elseif(strlen($nominal) == 6) {
|
||||||
|
return substr($nominal, 0, 3) . 'RB';
|
||||||
|
} elseif(strlen($nominal) == 7) {
|
||||||
|
return substr($nominal, 0, 1) . 'JT';
|
||||||
|
} elseif(strlen($nominal) == 8) {
|
||||||
|
return substr($nominal, 0, 2) . 'JT';
|
||||||
|
} elseif(strlen($nominal) == 9) {
|
||||||
|
return substr($nominal, 0, 3) . 'JT';
|
||||||
|
} elseif(strlen($nominal) == 10) {
|
||||||
|
return substr($nominal, 0, 1) . 'M';
|
||||||
|
} elseif(strlen($nominal) == 11) {
|
||||||
|
return substr($nominal, 0, 2) . 'M';
|
||||||
|
} elseif(strlen($nominal) == 12) {
|
||||||
|
return substr($nominal, 0, 3) . 'M';
|
||||||
|
} elseif(strlen($nominal) == 13) {
|
||||||
|
return substr($nominal, 0, 1) . 'T';
|
||||||
|
} elseif(strlen($nominal) == 14) {
|
||||||
|
return substr($nominal, 0, 2) . 'T';
|
||||||
|
} elseif(strlen($nominal) == 15) {
|
||||||
|
return substr($nominal, 0, 3) . 'T';
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Formats a phone number.
|
||||||
|
*
|
||||||
|
* @param string $value The phone number to be formatted.
|
||||||
|
* @return string The formatted phone number.
|
||||||
|
*/
|
||||||
|
if (!function_exists('phone_formatter')) {
|
||||||
|
function phone_formatter($value) {
|
||||||
|
// kadang ada penulisan no hp 0811 239 345
|
||||||
|
$nohp = str_replace(" ","",$value);
|
||||||
|
// kadang ada penulisan no hp (0274) 778787
|
||||||
|
$nohp = str_replace("(","",$value);
|
||||||
|
// kadang ada penulisan no hp (0274) 778787
|
||||||
|
$nohp = str_replace(")","",$value);
|
||||||
|
// kadang ada penulisan no hp 0811.239.345
|
||||||
|
$nohp = str_replace(".","",$value);
|
||||||
|
|
||||||
|
// cek apakah no hp mengandung karakter + dan 0-9
|
||||||
|
if(!preg_match('/[^+0-9]/',trim($nohp))){
|
||||||
|
// cek apakah no hp karakter 1-3 adalah +62
|
||||||
|
if(substr(trim($nohp), 0, 3)=='+62'){
|
||||||
|
$hp = trim($nohp);
|
||||||
|
}
|
||||||
|
// cek apakah no hp karakter 1 adalah 0
|
||||||
|
elseif(substr(trim($nohp), 0, 1)=='0'){
|
||||||
|
$hp = '+62'.substr(trim($nohp), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $hp;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the value of the specified website name from the database.
|
||||||
|
*
|
||||||
|
* @param string $name The name of the website.
|
||||||
|
* @throws Exception If the website does not exist.
|
||||||
|
* @return mixed The value of the website.
|
||||||
|
*/
|
||||||
|
if (!function_exists('frontend_db')) {
|
||||||
|
function frontend_db($name)
|
||||||
|
{
|
||||||
|
return \App\Models\Website::where('name', $name)->first()->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('app_url')) {
|
||||||
|
function app_url($name)
|
||||||
|
{
|
||||||
|
return url('app' . $name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('assets_url')) {
|
||||||
|
function assets_url($name)
|
||||||
|
{
|
||||||
|
$image = str_replace('public/', '', $name);
|
||||||
|
return asset('storage/' . $image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('frontend')) {
|
||||||
|
function frontend($var)
|
||||||
|
{
|
||||||
|
return asset('frontend/' . $var);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('pages')) {
|
||||||
|
function pages($var)
|
||||||
|
{
|
||||||
|
return asset('landing/' . $var);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a SweetAlert popup based on the given type and message.
|
||||||
|
*
|
||||||
|
* @param string $type The type of the alert (e.g., 'danger', 'success').
|
||||||
|
* @param string $msg The message to be displayed in the alert.
|
||||||
|
* @return string The generated JavaScript code for the SweetAlert popup.
|
||||||
|
*/
|
||||||
|
if (!function_exists('swal_alert')) {
|
||||||
|
function swal_alert($type, $msg)
|
||||||
|
{
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'error':
|
||||||
|
return "
|
||||||
|
<script>
|
||||||
|
Swal.fire(
|
||||||
|
'Woops..',
|
||||||
|
'$msg',
|
||||||
|
'error'
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'success':
|
||||||
|
return "
|
||||||
|
<script>
|
||||||
|
Swal.fire(
|
||||||
|
'Success',
|
||||||
|
'$msg',
|
||||||
|
'success'
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the "swal" session value.
|
||||||
|
*
|
||||||
|
* @return mixed The value of the "swal" session.
|
||||||
|
*/
|
||||||
|
if (!function_exists('swal_response')) {
|
||||||
|
function swal_response()
|
||||||
|
{
|
||||||
|
if(session()->has('swal')) {
|
||||||
|
return session('swal');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
|
class MailerHelper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Sends an email to the specified email address.
|
||||||
|
*
|
||||||
|
* @param string $email The email address to send the email to.
|
||||||
|
* @param bool $plain Whether to send the email as plain text or not.
|
||||||
|
* @param string|null $view The view to use for the email content.
|
||||||
|
* @param array $data Additional data to pass to the email view.
|
||||||
|
* @throws \Exception If an error occurs while sending the email.
|
||||||
|
* @return bool Whether the email was sent successfully or not.
|
||||||
|
*/
|
||||||
|
public static function to($recipientEmail, $plain = false, $view = null, $data = [])
|
||||||
|
{
|
||||||
|
$message = $data['message'];
|
||||||
|
$subject = $data['subject'];
|
||||||
|
switch($plain)
|
||||||
|
{
|
||||||
|
case true:
|
||||||
|
try {
|
||||||
|
Mail::raw($message, function ($message) use ($recipientEmail, $subject) {
|
||||||
|
$message->to($recipientEmail)->subject($subject);
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case false;
|
||||||
|
try {
|
||||||
|
Mail::send($view, ['data' => $data], function ($message) use ($recipientEmail, $subject) {
|
||||||
|
$message->to($recipientEmail)
|
||||||
|
->subject($subject);
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use App\Enums\GlobalEnum;
|
||||||
|
use DataTables;
|
||||||
|
|
||||||
|
class AdminController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function activity()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
|
class Controller extends BaseController
|
||||||
|
{
|
||||||
|
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use DataTables;
|
||||||
|
|
||||||
|
use App\Enums\GlobalEnum as Status;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\LogActivites;
|
||||||
|
|
||||||
|
use App\Models\Gejala;
|
||||||
|
use App\Models\Penyakit;
|
||||||
|
use App\Models\Rule;
|
||||||
|
|
||||||
|
class DashboardController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Halaman Utama',
|
||||||
|
];
|
||||||
|
|
||||||
|
$rule = Rule::count();
|
||||||
|
$penyakit = Penyakit::count();
|
||||||
|
$gejala = Gejala::count();
|
||||||
|
|
||||||
|
return view('admin.app.dashboard.index', compact('data', 'rule', 'penyakit', 'gejala'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function profile()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Akun anda',
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('admin.app.users.setting', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$id = user()->id;
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'name' => 'required',
|
||||||
|
'email' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->with('error', $validator->errors()->first())->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$input = $request->all();
|
||||||
|
$findUser = User::find($id);
|
||||||
|
|
||||||
|
if($findUser) {
|
||||||
|
// update data
|
||||||
|
$findUser->name = $input['name'];
|
||||||
|
$findUser->email = $input['email'];
|
||||||
|
if(!empty($input['password'])) {
|
||||||
|
$findUser->password = bcrypt($input['password']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// save data
|
||||||
|
$findUser->save();
|
||||||
|
return redirect()->back()->with('success', 'Successfully update data');
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('error', 'Unexpected error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,167 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use DataTables;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
use App\Models\Gejala;
|
||||||
|
|
||||||
|
class GejalaController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$data = Gejala::select('*');
|
||||||
|
// Convert the Eloquent Collection to a regular PHP array
|
||||||
|
$data->each(function ($item, $key) {
|
||||||
|
$item->rowIndex = $key + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
return Datatables::of($data)
|
||||||
|
->addIndexColumn()
|
||||||
|
->addColumn('title-post', function($row){
|
||||||
|
$text = '
|
||||||
|
<p class="mb-0">' . $row->gejala . '</p>
|
||||||
|
';
|
||||||
|
return $text;
|
||||||
|
})
|
||||||
|
->rawColumns(['title-post'])
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Gejala',
|
||||||
|
'button' => true,
|
||||||
|
'module' => [
|
||||||
|
'url' => route('gejala.create'),
|
||||||
|
'name' => 'Tambah Baru'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('admin.app.content.gejala.index', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Tambah baru',
|
||||||
|
];
|
||||||
|
return view('admin.app.content.gejala.add', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'gejala' => 'required',
|
||||||
|
'kode_gejala' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||||
|
}
|
||||||
|
|
||||||
|
$input = $request->all();
|
||||||
|
|
||||||
|
$post = new Gejala([
|
||||||
|
'gejala' => $input['gejala'], // Membersihkan input judul menggunakan Purifier
|
||||||
|
'kode_gejala' => $input['kode_gejala'], // Membersihkan input deskripsi menggunakan Purifier
|
||||||
|
]);
|
||||||
|
|
||||||
|
$check = Gejala::where('gejala', $input['gejala'])->count();
|
||||||
|
if ($check == 0) {
|
||||||
|
if ($post->save()) {
|
||||||
|
return redirect()->route('gejala')->with('success', 'You have successfully added data');
|
||||||
|
} else {
|
||||||
|
return redirect()->route('gejala')->with('error', 'An error occurred in the query');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return redirect()->route('gejala')->with('error', 'Title already exists');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Edit: ' . Gejala::where('id_gejala', $id)->first()->title,
|
||||||
|
];
|
||||||
|
$gejala = Gejala::FindOrFail($id);
|
||||||
|
|
||||||
|
return view('admin.app.content.gejala.edit', compact('data','gejala', 'id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
// Validasi input sebelum memperbarui data
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'gejala' => 'required',
|
||||||
|
'kode_gejala' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cari data berdasarkan ID
|
||||||
|
$gejala = Gejala::find($id);
|
||||||
|
|
||||||
|
// Jika data ditemukan
|
||||||
|
if ($gejala) {
|
||||||
|
|
||||||
|
// Update data dengan data baru dari form yang telah dibersihkan
|
||||||
|
$gejala->gejala = $request->input('gejala');
|
||||||
|
$gejala->kode_gejala = $request->input('kode_gejala');
|
||||||
|
// Simpan perubahan pada database
|
||||||
|
$gejala->save();
|
||||||
|
return redirect()->route('gejala')->with('success', 'You are successfully added new records');
|
||||||
|
} else {
|
||||||
|
return redirect()->route('gejala')->with('error', 'Unexpected error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
// Cari data berdasarkan ID
|
||||||
|
$post = Gejala::find($id);
|
||||||
|
// Jika data ditemukan
|
||||||
|
if ($post) {
|
||||||
|
// Hapus data dari database
|
||||||
|
$post->delete();
|
||||||
|
return redirect()->route('gejala')->with('success', 'You are successfully deleted records');
|
||||||
|
} else {
|
||||||
|
return redirect()->route('gejala')->with('error', 'Data not found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,146 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
// other module binding
|
||||||
|
use App\Enums\GlobalEnum as Status;
|
||||||
|
|
||||||
|
// model binding
|
||||||
|
use Modules\User\Entities\OrderModel as Order;
|
||||||
|
use Modules\User\Entities\ReviewModel as Reviews;
|
||||||
|
use Modules\Seller\Entities\SitesModel as Sites;
|
||||||
|
use Modules\Seller\Entities\AccountModel as Account;
|
||||||
|
use App\Models\Content;
|
||||||
|
use App\Models\Pages;
|
||||||
|
|
||||||
|
class HomeController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Platform Jual-Beli Backlink dan Content Writer'
|
||||||
|
];
|
||||||
|
|
||||||
|
// additional binding items
|
||||||
|
$getAllReview = Order::where('is_status', Status::isOrderCompleted)->select('id', 'buy_id', 'sell_id', 'last_buyer_message')->get();
|
||||||
|
$getAllPost = Content::where('is_status', Status::isPostPublished)->select('*')->get();
|
||||||
|
|
||||||
|
return view('landing.index', compact('data', 'getAllReview', 'getAllPost'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function closeGuide()
|
||||||
|
{
|
||||||
|
if(user()->is_close_guide != null)
|
||||||
|
{
|
||||||
|
$account = new Account();
|
||||||
|
$account->is_close_guide = 1;
|
||||||
|
$account->save();
|
||||||
|
echo 'sudah update';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function howToSell()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Jual Backlink dan Layanan Konten'
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('landing.market.sell', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function market()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Beli Backlink maupun Situs'
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('landing.market.listing', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function productDetail($uuid)
|
||||||
|
{
|
||||||
|
$sites = Sites::find($uuid);
|
||||||
|
|
||||||
|
if($sites) {
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Tentang Situs ' . removeUrlPrefix($sites->url)
|
||||||
|
];
|
||||||
|
|
||||||
|
$getAllReviews = Reviews::where('website_id', $sites->id)->where('review', '!=', 'Auto rated by system')->orderBy('created_at', 'desc')->limit(5)->get();
|
||||||
|
|
||||||
|
return view('landing.market.detail', compact('data', 'sites', 'getAllReviews'));
|
||||||
|
} else {
|
||||||
|
return redirect()->route('marketplace')->with('swal', swal_alert('error', 'Tidak ditemukan data produk...'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function userDetail($uuid)
|
||||||
|
{
|
||||||
|
$users = Sites::find($uuid);
|
||||||
|
|
||||||
|
if($users) {
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Tentang ' . $users->name
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('landing.market.detailUser', compact('data', 'users'));
|
||||||
|
} else {
|
||||||
|
return redirect()->route('marketplace')->with('swal', swal_alert('error', 'Tidak ditemukan data produk...'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pages($slug)
|
||||||
|
{
|
||||||
|
$pages = Pages::where('slug', $slug)->first();
|
||||||
|
|
||||||
|
if($pages) {
|
||||||
|
$data = [
|
||||||
|
'subtitle' => $pages->title
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('landing.pages.detail', compact('data', 'pages'));
|
||||||
|
} else {
|
||||||
|
return redirect()->route('landing')->with('swal', swal_alert('error', 'Tidak ditemukan laman...'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function about()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Tentang Kami'
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('landing.about', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function blog()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Informasi'
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('landing.blog.index', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function blogDetail($slug)
|
||||||
|
{
|
||||||
|
$blog = Content::where('slug', $slug)->first();
|
||||||
|
|
||||||
|
if($blog) {
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Detil Informasi'
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('landing.blog.detail', compact('data', 'blog'));
|
||||||
|
} else {
|
||||||
|
return redirect()->route('landing')->with('swal', swal_alert('error', 'Tidak ditemukan laman...'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,257 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
// additional modules
|
||||||
|
use App\Helpers\MailerHelper as Mailers;
|
||||||
|
use App\Enums\GlobalEnum;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\UserManager;
|
||||||
|
use App\Models\LogActivites;
|
||||||
|
|
||||||
|
use Ramsey\Uuid\Uuid;
|
||||||
|
|
||||||
|
class LoginController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'title' => 'CMSQ',
|
||||||
|
'subtitle' => 'Login',
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('auth/login', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function proses_login(Request $request)
|
||||||
|
{
|
||||||
|
$credentials = $request->validate([
|
||||||
|
'email' => ['required','email'],
|
||||||
|
'password' => ['required'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (Auth::attempt($credentials)) {
|
||||||
|
$user = Auth::user();
|
||||||
|
switch($user->level) {
|
||||||
|
case 1:
|
||||||
|
LogActivites::default([
|
||||||
|
'causedBy' => $user->id,
|
||||||
|
'logType' => GlobalEnum::LogOfLogin,
|
||||||
|
'withContent' => [
|
||||||
|
'status' => 'add',
|
||||||
|
'text' => 'Login as ' . $user->name,
|
||||||
|
'ip_address' => $request->ip(),
|
||||||
|
'user_agent' => $request->userAgent(),
|
||||||
|
'time' => date('Y-m-d H:i:s')
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
return redirect()->intended('app/dashboard');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
LogActivites::default([
|
||||||
|
'causedBy' => $user->id,
|
||||||
|
'logType' => GlobalEnum::LogOfLogin,
|
||||||
|
'withContent' => [
|
||||||
|
'status' => 'add',
|
||||||
|
'text' => 'Login as ' . $user->name,
|
||||||
|
'ip_address' => $request->ip(),
|
||||||
|
'user_agent' => $request->userAgent(),
|
||||||
|
'time' => date('Y-m-d H:i:s')
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
return redirect()->intended('user');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->withInput()->with('error', 'Email atau Password salah!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout(Request $request)
|
||||||
|
{
|
||||||
|
$request->session()->flush();
|
||||||
|
Auth::logout();
|
||||||
|
return redirect('/');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Register',
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('auth/register', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeRegister(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'name' => 'required',
|
||||||
|
'email' => 'required|string|email|max:255',
|
||||||
|
'password' => 'required|min:6',
|
||||||
|
'level' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$input = $request->all();
|
||||||
|
$user = new User([
|
||||||
|
'name' => $input['name'],
|
||||||
|
'username' => Str::before($input['email'], '@') . rand(100, 999),
|
||||||
|
'email' => $input['email'],
|
||||||
|
'level' => $input['level'],
|
||||||
|
'password' => bcrypt($input['password']),
|
||||||
|
'phone' => NULL,
|
||||||
|
'status' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
$check = User::where('email', $input['email'])->count();
|
||||||
|
if($check == 0) {
|
||||||
|
if($user->save()) {
|
||||||
|
return redirect()->route('login')->with('success', 'Pendaftaran berhasil, Silahkan login menggunakan akun anda');
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('error', 'Register gagal!')->withInput();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('error', 'Email sudah terdaftar!')->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verify($token)
|
||||||
|
{
|
||||||
|
$userAccount = User::where('email_verified_token', $token)->first();
|
||||||
|
if($token == null) {
|
||||||
|
return redirect()->route('login')->with('swal', swal_alert('error', 'Token tidak ditemukan!'));
|
||||||
|
} elseif(empty($userAccount) || is_null($userAccount)) {
|
||||||
|
return redirect()->route('login')->with('swal', swal_alert('error', 'Token sudah digunakan!'));
|
||||||
|
} elseif($userAccount->status == 1 || $userAccount->email_verified_at != null) {
|
||||||
|
return redirect()->route('login')->with('swal', swal_alert('error', 'Akun sudah terverifikasi!'));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// check before update
|
||||||
|
$user = User::find($userAccount->id);
|
||||||
|
$user->email_verified_token = null;
|
||||||
|
$user->email_verified_at = now();
|
||||||
|
$user->status = 1;
|
||||||
|
|
||||||
|
// update
|
||||||
|
$user->save();
|
||||||
|
return redirect()->route('login')->with('swal', swal_alert('success', 'Email telah berhasil diverifikasi, anda dapat menggunakan layanan'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function forgot()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Lupa Kata Sandi',
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('auth/forgot_password', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function forgotPassword(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'email' => 'required|string|email|max:255',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$input = $request->all();
|
||||||
|
$userEmailToken = md5(Str::random(25));
|
||||||
|
$user = new UserManager([
|
||||||
|
'uuid' => Uuid::uuid4(),
|
||||||
|
'email' => $input['email'],
|
||||||
|
'token' => $userEmailToken,
|
||||||
|
'isUsed' => 0,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$check = User::where('email', $input['email'])->count();
|
||||||
|
$userName = User::where('email', $input['email'])->first()->name;
|
||||||
|
if($check == 1) {
|
||||||
|
$sendEmail = Mailers::to($input['email'], false, 'email.auth.forgot_password', [
|
||||||
|
'message' => 'You have been successfully requested! Please check your email to reset your password',
|
||||||
|
'subject' => 'Forgot Password',
|
||||||
|
'name' => $userName,
|
||||||
|
'token' => $userEmailToken
|
||||||
|
]);
|
||||||
|
if($sendEmail) {
|
||||||
|
$user->save();
|
||||||
|
return redirect()->route('login')->with('swal', swal_alert('success', 'Kamu berhasil mengirim permintaan reset password! Silahkan cek email untuk verifikasi akun anda'));
|
||||||
|
} else {
|
||||||
|
return back()->withErrors([
|
||||||
|
'email' => 'Something went wrong!',
|
||||||
|
])->withInput();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return back()->withErrors([
|
||||||
|
'email' => 'Found valid email exists!',
|
||||||
|
])->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reset($token)
|
||||||
|
{
|
||||||
|
|
||||||
|
$findTokenByUsed = UserManager::where('token', $token)->first();
|
||||||
|
if($findTokenByUsed->isUsed == 1) {
|
||||||
|
return redirect()->route('login')->with('swal', swal_alert('error', 'Token sudah digunakan!'));
|
||||||
|
} elseif(hasExpired($findTokenByUsed->created_at)) {
|
||||||
|
return redirect()->route('login')->with('swal', swal_alert('error', 'Token expired!'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Reset Password',
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('auth/reset_password', compact('data','token'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resetPassword(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'password' => 'required|string|min:8',
|
||||||
|
'retype_password' => 'required|string|min:8',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($request->password != $request->retype_password) {
|
||||||
|
return redirect()->back()->with('swal', swal_alert('error', 'Password tidak sama!'))->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$input = $request->all();
|
||||||
|
$userEmailbyToken = UserManager::where('token', $input['token'])->first();
|
||||||
|
$findUserByEmail = User::where('email', $userEmailbyToken->email)->first();
|
||||||
|
|
||||||
|
// check expired token 60 minutes
|
||||||
|
if(hasExpired($findUserByEmail->created_at)) {
|
||||||
|
return redirect()->route('login')->with('swal', swal_alert('error', 'Token sudah kadaluarsa!'));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// update password
|
||||||
|
$findUserByEmail->password = bcrypt($input['password']);
|
||||||
|
$findUserByEmail->save();
|
||||||
|
|
||||||
|
// update token
|
||||||
|
$userEmailbyToken->isUsed = 1;
|
||||||
|
$userEmailbyToken->save();
|
||||||
|
|
||||||
|
return redirect()->route('login')->with('swal', swal_alert('success', 'Password telah berhasil diubah'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,179 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use DataTables;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
use App\Models\Penyakit;
|
||||||
|
use App\Models\Gejala;
|
||||||
|
|
||||||
|
class PenyakitController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$data = Penyakit::select('*');
|
||||||
|
// Convert the Eloquent Collection to a regular PHP array
|
||||||
|
$data->each(function ($item, $key) {
|
||||||
|
$item->rowIndex = $key + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
return Datatables::of($data)
|
||||||
|
->addIndexColumn()
|
||||||
|
->addColumn('title-post', function($row){
|
||||||
|
$text = '
|
||||||
|
<p class="mb-0">' . $row->gejala . '</p>
|
||||||
|
';
|
||||||
|
return $text;
|
||||||
|
})
|
||||||
|
->rawColumns(['title-post'])
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Penyakit',
|
||||||
|
'button' => true,
|
||||||
|
'module' => [
|
||||||
|
'url' => route('penyakit.create'),
|
||||||
|
'name' => 'Tambah Baru'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('admin.app.content.penyakit.index', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Tambah baru',
|
||||||
|
];
|
||||||
|
|
||||||
|
$gejala = Gejala::all();
|
||||||
|
return view('admin.app.content.penyakit.add', compact('data', 'gejala'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'kode_penyakit' => 'required',
|
||||||
|
'penyakit' => 'required',
|
||||||
|
'penanganan' => 'required',
|
||||||
|
'penjelasan' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||||
|
}
|
||||||
|
|
||||||
|
$input = $request->all();
|
||||||
|
|
||||||
|
$post = new Penyakit([
|
||||||
|
'nama_penyakit' => $input['penyakit'], // Membersihkan input deskripsi menggunakan Purifier
|
||||||
|
'penanganan' => $input['penanganan'], // Membersihkan input deskripsi menggunakan Purifier
|
||||||
|
'penjelasan' => $input['penjelasan'], // Membersihkan input deskripsi menggunakan Purifier
|
||||||
|
'kode_penyakit' => $input['kode_penyakit'], // Membersihkan input deskripsi menggunakan Purifier
|
||||||
|
]);
|
||||||
|
|
||||||
|
$check = Penyakit::where('nama_penyakit', $input['penyakit'])->count();
|
||||||
|
if ($check == 0) {
|
||||||
|
if ($post->save()) {
|
||||||
|
return redirect()->route('penyakit')->with('success', 'You have successfully added data');
|
||||||
|
} else {
|
||||||
|
return redirect()->route('penyakit')->with('error', 'An error occurred in the query');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return redirect()->route('penyakit')->with('error', 'Title already exists');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Edit: ' . Penyakit::where('id_penyakit', $id)->first()->title,
|
||||||
|
];
|
||||||
|
$penyakit = Penyakit::FindOrFail($id);
|
||||||
|
$gejala = Gejala::all();
|
||||||
|
|
||||||
|
return view('admin.app.content.penyakit.edit', compact('data','gejala', 'id', 'penyakit'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
// Validasi input sebelum memperbarui data
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'kode_penyakit' => 'required',
|
||||||
|
'nama_penyakit' => 'required',
|
||||||
|
'penanganan' => 'required',
|
||||||
|
'penjelasan' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cari data berdasarkan ID
|
||||||
|
$gejala = Penyakit::find($id);
|
||||||
|
|
||||||
|
// Jika data ditemukan
|
||||||
|
if ($gejala) {
|
||||||
|
|
||||||
|
// Update data dengan data baru dari form yang telah dibersihkan
|
||||||
|
$gejala->nama_penyakit = $request->input('nama_penyakit');
|
||||||
|
$gejala->penjelasan = $request->input('penjelasan');
|
||||||
|
$gejala->penanganan = $request->input('penanganan');
|
||||||
|
$gejala->kode_penyakit = $request->input('kode_penyakit');
|
||||||
|
// Simpan perubahan pada database
|
||||||
|
$gejala->save();
|
||||||
|
return redirect()->route('penyakit')->with('success', 'You are successfully added new records');
|
||||||
|
} else {
|
||||||
|
return redirect()->route('penyakit')->with('error', 'Unexpected error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
// Cari data berdasarkan ID
|
||||||
|
$post = Penyakit::find($id);
|
||||||
|
// Jika data ditemukan
|
||||||
|
if ($post) {
|
||||||
|
// Hapus data dari database
|
||||||
|
$post->delete();
|
||||||
|
return redirect()->route('penyakit')->with('success', 'You are successfully deleted records');
|
||||||
|
} else {
|
||||||
|
return redirect()->route('penyakit')->with('error', 'Data not found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,144 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Support\Renderable;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use DataTables;
|
||||||
|
use Modules\Seller\Entities\TicketModel;
|
||||||
|
use Modules\Seller\Entities\TicketResponseModel;
|
||||||
|
use Modules\Seller\Events\TicketCreated;
|
||||||
|
use App\Enums\GlobalEnum;
|
||||||
|
|
||||||
|
use App\Models\Siswa;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Konselor;
|
||||||
|
use App\Models\LogActivites;
|
||||||
|
|
||||||
|
class ReportController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$data = TicketModel::select('*');
|
||||||
|
// Convert the Eloquent Collection to a regular PHP array
|
||||||
|
$data->each(function ($item, $key) {
|
||||||
|
$item->rowIndex = $key + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
return DataTables::of($data)
|
||||||
|
->addIndexColumn()
|
||||||
|
->addColumn('title-post', function($row){
|
||||||
|
$text = '
|
||||||
|
<p class="mb-0">' . $row->subject . '</p>
|
||||||
|
<p class="mb-0 small">Terakhir diperbarui pada ' . date_formatting($row->updated_at, 'timeago') . '</p>
|
||||||
|
';
|
||||||
|
return $text;
|
||||||
|
})
|
||||||
|
->addColumn('siswa', function($row){
|
||||||
|
return User::where('id', $row->user_id)->first()->name;
|
||||||
|
})
|
||||||
|
->addColumn('action', function($row){
|
||||||
|
$view = route('ticket.view', ['id' => $row->id]);
|
||||||
|
$delete = route('ticket.delete', ['id' => $row->id]);
|
||||||
|
$btn = '
|
||||||
|
<a href="' . $view . '" class="btn btn-light btn-sm px-4"><i class="ki-outline ki-eye"></i></a>
|
||||||
|
<a data-url="' . $delete . '" href="#" class="btn btn-light btn-sm deleteContent px-4"><i class="ki-outline ki-trash"></i></a>
|
||||||
|
';
|
||||||
|
return $btn;
|
||||||
|
})
|
||||||
|
->addColumn('status', function($row){
|
||||||
|
if ($row->is_status == 1) {
|
||||||
|
return '<span class="mb-1 badge font-medium bg-light-dark text-dark">Pending</span>';
|
||||||
|
} elseif($row->is_status == 2) {
|
||||||
|
return '<span class="mb-1 badge font-medium bg-light-primary text-primary">Admin Membalas</span>';
|
||||||
|
} elseif($row->is_status == 3) {
|
||||||
|
return '<span class="mb-1 badge font-medium bg-light-info text-info">User Membalas</span>';
|
||||||
|
} elseif($row->is_status == 4) {
|
||||||
|
return '<span class="mb-1 badge font-medium bg-light-danger text-danger">Ditutup</span>';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->addColumn('priority', function($row){
|
||||||
|
if ($row->is_priority == GlobalEnum::isTicketPriorityNormal) {
|
||||||
|
return '<span class="mb-1 badge font-medium bg-light-info text-info">Normal</span>';
|
||||||
|
} elseif($row->is_priority == GlobalEnum::isTicketPriorityMedium) {
|
||||||
|
return '<span class="mb-1 badge font-medium bg-light-primary text-primary">Sedang</span>';
|
||||||
|
} elseif($row->is_priority == GlobalEnum::isTicketPriorityHigh) {
|
||||||
|
return '<span class="mb-1 badge font-medium bg-light-danger text-danger">Parah</span>';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->rawColumns(['title-post','action','status','priority','siswa'])
|
||||||
|
->filter(function ($query) use ($request) {
|
||||||
|
if ($request->has('search')) {
|
||||||
|
$search = $request->get('search')['value'];
|
||||||
|
|
||||||
|
$filterCategory = explode('|', $search);
|
||||||
|
if($filterCategory[0] === 'status') {
|
||||||
|
if(!empty($filterCategory[1])) {
|
||||||
|
$query->where('is_status', '=', $filterCategory[1]);
|
||||||
|
} else {
|
||||||
|
$query->get();
|
||||||
|
}
|
||||||
|
} elseif($filterCategory[0] === 'user') {
|
||||||
|
if(!empty($filterCategory[1])) {
|
||||||
|
$query->where('name', 'LIKE', "%$filterCategory[1]%");
|
||||||
|
} else {
|
||||||
|
$query->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Riwayat Bimbingan & Konseling',
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('admin.app.ticket.index', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Bimbingan & Konseling #' . explode('-', $id)[0],
|
||||||
|
];
|
||||||
|
|
||||||
|
$detail = TicketModel::where('id', $id)->first();
|
||||||
|
$siswa = User::where('id', $detail->user_id)->first()->name;
|
||||||
|
$nis = Siswa::where('user_id', $detail->user_id)->first()->nis;
|
||||||
|
$ticketResponse = TicketModel::find($id)->responses;
|
||||||
|
return view('admin.app.ticket.detail', compact('data', 'nis', 'ticketResponse', 'detail', 'siswa'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id)
|
||||||
|
{
|
||||||
|
$ticket = TicketModel::find($id);
|
||||||
|
if($ticket) {
|
||||||
|
$detailReply = TicketResponseModel::where('id_ticket', $ticket->id)->get();
|
||||||
|
|
||||||
|
if($ticket->delete() && $detailReply->delete()) {
|
||||||
|
return redirect()->back()->with('swal', swal_alert('success', 'Anda berhasil menghapus tiket.'));
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('swal', swal_alert('error', 'Terjadi kesalahan saat menghapus tiket.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function closed($id)
|
||||||
|
{
|
||||||
|
$ticket = TicketModel::find($id);
|
||||||
|
if($ticket) {
|
||||||
|
$ticket->is_status = 4;
|
||||||
|
if($ticket->save()) {
|
||||||
|
return redirect()->back()->with('swal', swal_alert('success', 'Anda berhasil menghapus tiket.'));
|
||||||
|
} else {
|
||||||
|
return redirect()->back()->with('swal', swal_alert('error', 'Terjadi kesalahan saat menghapus tiket.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use DataTables;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
use App\Models\Riwayat;
|
||||||
|
|
||||||
|
class RiwayatController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$data = Riwayat::select('*');
|
||||||
|
// Convert the Eloquent Collection to a regular PHP array
|
||||||
|
$data->each(function ($item, $key) {
|
||||||
|
$item->rowIndex = $key + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
return Datatables::of($data)
|
||||||
|
->addIndexColumn()
|
||||||
|
->addColumn('title-post', function($row){
|
||||||
|
$text = '
|
||||||
|
<p class="mb-0">' . $row->gejala . '</p>
|
||||||
|
';
|
||||||
|
return $text;
|
||||||
|
})
|
||||||
|
->addColumn('jenis_gejala', function($row){
|
||||||
|
return $row->gejala;
|
||||||
|
})
|
||||||
|
->rawColumns(['title-post', 'jenis_gejala'])
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Riwayat'
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('admin.app.content.riwayat.index', compact('data'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,187 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use DataTables;
|
||||||
|
use GuzzleHttp\Client;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
use App\Models\Penyakit;
|
||||||
|
use App\Models\Gejala;
|
||||||
|
use App\Models\Rule;
|
||||||
|
|
||||||
|
class RuleController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$data = Rule::select('*');
|
||||||
|
// Convert the Eloquent Collection to a regular PHP array
|
||||||
|
$data->each(function ($item, $key) {
|
||||||
|
$item->rowIndex = $key + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
return Datatables::of($data)
|
||||||
|
->addIndexColumn()
|
||||||
|
->addColumn('title-post', function($row){
|
||||||
|
$text = '
|
||||||
|
<p class="mb-0">' . $row->kode_rule . '</p>
|
||||||
|
';
|
||||||
|
return $text;
|
||||||
|
})
|
||||||
|
->addColumn('nama_penyakit', function($row){
|
||||||
|
return $row->penyakit->nama_penyakit;
|
||||||
|
})
|
||||||
|
->addColumn('nama_gejala', function($row){
|
||||||
|
return $row->gejala->gejala;
|
||||||
|
})
|
||||||
|
->rawColumns(['title-post', 'nama_penyakit', 'nama_gejala'])
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Basis Pengetahuan',
|
||||||
|
'button' => true,
|
||||||
|
'module' => [
|
||||||
|
'url' => route('rule.create'),
|
||||||
|
'name' => 'Tambah Baru'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('admin.app.content.rule.index', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Tambah baru',
|
||||||
|
];
|
||||||
|
|
||||||
|
$penyakit = Penyakit::all();
|
||||||
|
$gejala = Gejala::all();
|
||||||
|
return view('admin.app.content.rule.add', compact('data', 'penyakit', 'gejala'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'kode_gejala' => 'required',
|
||||||
|
'kode_rule' => 'required',
|
||||||
|
'kode_penyakit' => 'required',
|
||||||
|
'md' => 'required',
|
||||||
|
'mb' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||||
|
}
|
||||||
|
|
||||||
|
$input = $request->all();
|
||||||
|
|
||||||
|
$post = new Rule([
|
||||||
|
'kode_gejala' => $input['kode_gejala'], // Membersihkan input judul menggunakan Purifier
|
||||||
|
'kode_rule' => $input['kode_rule'], // Membersihkan input deskripsi menggunakan Purifier
|
||||||
|
'kode_penyakit' => $input['kode_penyakit'], // Membersihkan input deskripsi menggunakan Purifier
|
||||||
|
'mb' => $input['mb'],
|
||||||
|
'md' => $input['md'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($post->save()) {
|
||||||
|
return redirect()->route('rule')->with('success', 'You have successfully added data');
|
||||||
|
} else {
|
||||||
|
return redirect()->route('rule')->with('error', 'An error occurred in the query');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Edit: ' . Rule::where('id_rule', $id)->first()->title,
|
||||||
|
];
|
||||||
|
$penyakit = Penyakit::all();
|
||||||
|
$rule = Rule::find($id);
|
||||||
|
$gejala = Gejala::all();
|
||||||
|
|
||||||
|
return view('admin.app.content.rule.edit', compact('data', 'id', 'penyakit', 'rule', 'gejala'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
// Validasi input sebelum memperbarui data
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'kode_gejala' => 'required',
|
||||||
|
'kode_rule' => 'required',
|
||||||
|
'kode_penyakit' => 'required',
|
||||||
|
'mb' => 'required',
|
||||||
|
'md' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withInput()->with('error', 'Unexpected error, please try again. code: ' . $validator->errors()->first());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cari data berdasarkan ID
|
||||||
|
$gejala = Rule::find($id);
|
||||||
|
|
||||||
|
// Jika data ditemukan
|
||||||
|
if ($gejala) {
|
||||||
|
|
||||||
|
// Update data dengan data baru dari form yang telah dibersihkan
|
||||||
|
$gejala->kode_gejala = $request->input('kode_gejala');
|
||||||
|
$gejala->kode_rule = $request->input('kode_rule');
|
||||||
|
$gejala->kode_penyakit = $request->input('kode_penyakit');
|
||||||
|
$gejala->mb = $request->input('mb');
|
||||||
|
$gejala->md = $request->input('md');
|
||||||
|
// Simpan perubahan pada database
|
||||||
|
$gejala->save();
|
||||||
|
return redirect()->route('rule')->with('success', 'You are successfully added new records');
|
||||||
|
} else {
|
||||||
|
return redirect()->route('rule')->with('error', 'Unexpected error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
// Cari data berdasarkan ID
|
||||||
|
$post = Rule::find($id);
|
||||||
|
// Jika data ditemukan
|
||||||
|
if ($post) {
|
||||||
|
// Hapus data dari database
|
||||||
|
$post->delete();
|
||||||
|
return redirect()->route('rule')->with('success', 'You are successfully deleted records');
|
||||||
|
} else {
|
||||||
|
return redirect()->route('rule')->with('error', 'Data not found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,249 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Roles;
|
||||||
|
|
||||||
|
use Modules\Seller\Entities\AccountModel;
|
||||||
|
use App\Enums\GlobalEnum;
|
||||||
|
use App\Models\LogActivites;
|
||||||
|
use App\Models\Seller;
|
||||||
|
|
||||||
|
use DataTables;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class UsersController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$data = User::select('*')->whereIn('level', [1,2])->orderBy('created_at', 'desc');
|
||||||
|
// Convert the Eloquent Collection to a regular PHP array
|
||||||
|
$data->each(function ($item, $key) {
|
||||||
|
$item->rowIndex = $key + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
return Datatables::eloquent($data)
|
||||||
|
->addIndexColumn()
|
||||||
|
->addColumn('title-post', function($row) {
|
||||||
|
return '
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="symbol symbol-25px symbol-circle">
|
||||||
|
<div class="symbol-label" style="background-image:url(' . gravatar_team($row->email) . ')"></div>
|
||||||
|
</div>
|
||||||
|
<div class="ms-3"><span>' . $row->name . '</span></div>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
})
|
||||||
|
->addColumn('action', function($row){
|
||||||
|
$view = route('users.show', ['id' => $row->id]);
|
||||||
|
$edit = route('users.edit', ['id' => $row->id]);
|
||||||
|
$delete = route('users.delete', ['id' => $row->id]);
|
||||||
|
$btn = '
|
||||||
|
<a href="' . $view . '" class="btn btn-light btn-sm px-4"><i class="ki-outline ki-eye"></i></a>
|
||||||
|
<a href="' . $edit . '" class="btn btn-light btn-sm px-4"><i class="ki-outline ki-pencil"></i></a>
|
||||||
|
<a data-url="' . $delete . '" href="#" class="btn btn-light btn-sm deleteContent px-4"><i class="ki-outline ki-trash"></i></a>
|
||||||
|
';
|
||||||
|
return $btn;
|
||||||
|
})
|
||||||
|
->addColumn('status', function($row){
|
||||||
|
if ($row->status == GlobalEnum::isActive) {
|
||||||
|
return '<span class="mb-1 badge bg-success py-2 px-3 text-white">Active</span>';
|
||||||
|
} elseif($row->status == GlobalEnum::isInactive) {
|
||||||
|
return '<span class="mb-1 badge bg-primary py-2 px-3 text-white">Non Active</span>';
|
||||||
|
} elseif($row->status == GlobalEnum::isDeactive) {
|
||||||
|
return '<span class="mb-1 badge bg-danger py-2 px-3 text-white">Deactivated</span>';
|
||||||
|
} else {
|
||||||
|
return '<span class="mb-1 badge bg-warning py-2 px-3 text-white">Not Verified</span>';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->rawColumns(['title-post','action','status'])
|
||||||
|
->filter(function ($query) use ($request) {
|
||||||
|
if ($request->has('search') && !empty($request->get('search')['value'])) {
|
||||||
|
$search = $request->get('search')['value'];
|
||||||
|
|
||||||
|
$filterCategory = explode('|', $search);
|
||||||
|
if (count($filterCategory) == 2) {
|
||||||
|
if ($filterCategory[0] === 'status') {
|
||||||
|
if (!empty($filterCategory[1])) {
|
||||||
|
$query->where('status', '=', $filterCategory[1]);
|
||||||
|
}
|
||||||
|
} elseif ($filterCategory[0] === 'user') {
|
||||||
|
if (!empty($filterCategory[1])) {
|
||||||
|
$query->where('name', 'LIKE', "%{$filterCategory[1]}%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Fallback search by name if the format is not as expected
|
||||||
|
$query->where('name', 'LIKE', "%{$search}%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Users',
|
||||||
|
'button' => true,
|
||||||
|
'module' => [
|
||||||
|
'url' => route('users.create'),
|
||||||
|
'name' => 'Tambah Baru'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('admin.app.users.index', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => 'Create New'
|
||||||
|
];
|
||||||
|
|
||||||
|
$roles = Roles::whereIn('id', [1,2])->get();
|
||||||
|
return view('admin.app.users.add', compact('data', 'roles'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'name' => 'required',
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => 'required',
|
||||||
|
'status' => 'required',
|
||||||
|
'level' => 'required',
|
||||||
|
'image' => 'image|mimes:jpg,jpeg,png,svg|max:7048',
|
||||||
|
], [
|
||||||
|
'image.mimes' => 'Tipe file yang diunggah harus jpg, jpeg, png, atau svg.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$input = $request->all();
|
||||||
|
$foto_namaBaru = null;
|
||||||
|
|
||||||
|
if ($request->hasFile('image') && $request->file('image')->isValid()) {
|
||||||
|
$foto_namaBaru = $request->file('image')->store('public/images');
|
||||||
|
}
|
||||||
|
|
||||||
|
$post = new User([
|
||||||
|
'name' => $input['name'],
|
||||||
|
'username' => Str::before($input['email'], '@') . rand(100, 999),
|
||||||
|
'email' => $input['email'],
|
||||||
|
'password' => bcrypt($input['password']),
|
||||||
|
'status' => $input['status'],
|
||||||
|
'level' => $input['level'],
|
||||||
|
'thumbnail' => empty($foto_namaBaru) ? '' : $foto_namaBaru,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$check = User::where('email', $input['email'])->count();
|
||||||
|
if ($check == 0) {
|
||||||
|
if ($post->save()) {
|
||||||
|
return redirect()->route('users')->with('swal', swal_alert('success', 'You have successfully added data'));
|
||||||
|
} else {
|
||||||
|
return redirect()->route('users')->with('swal', swal_alert('error', 'An error occurred in the query'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return redirect()->route('users')->with('swal', swal_alert('error', 'Email already exists'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => User::where('id', $id)->first()->email,
|
||||||
|
'records' => User::where('id', $id)->first(),
|
||||||
|
'logs' => User::where('id', $id)->first()
|
||||||
|
];
|
||||||
|
return view('admin.app.users.detail', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'subtitle' => User::where('id', $id)->first()->email,
|
||||||
|
'records' => User::where('id', $id)->first()
|
||||||
|
];
|
||||||
|
|
||||||
|
$roles = Roles::whereIn('id', [1,2])->get();
|
||||||
|
return view('admin.app.users.edit', compact('data', 'id', 'roles'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'name' => 'required',
|
||||||
|
'email' => 'required|email',
|
||||||
|
'level' => 'required',
|
||||||
|
'status' => 'required',
|
||||||
|
'image' => 'image|mimes:jpg,jpeg,png,svg|max:7048',
|
||||||
|
], [
|
||||||
|
'image.mimes' => 'Tipe file yang diunggah harus jpg, jpeg, png, atau svg.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->back()->withErrors($validator)->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cari data berdasarkan ID
|
||||||
|
$user = User::find($id);
|
||||||
|
|
||||||
|
// Jika data ditemukan
|
||||||
|
if ($user) {
|
||||||
|
// Jika ada file baru yang diunggah, hapus file thumbnail yang lama
|
||||||
|
if ($request->hasFile('image') && $request->file('image')->isValid()) {
|
||||||
|
if ($user->thumbnail) {
|
||||||
|
Storage::delete($user->thumbnail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update data dengan data baru dari form yang telah dibersihkan
|
||||||
|
$user->name = $request->input('name');
|
||||||
|
$user->email = $request->input('email');
|
||||||
|
!empty($request->input('password')) ? $user->password = bcrypt($request->input('password')) : $user->password;
|
||||||
|
$user->level = $request->input('level');
|
||||||
|
$user->status = $request->input('status');
|
||||||
|
$user->username = Str::before($user->email, '@') . rand(100, 999);
|
||||||
|
|
||||||
|
// Jika ada file baru yang diunggah, simpan file baru di storage
|
||||||
|
if ($request->hasFile('image') && $request->file('image')->isValid()) {
|
||||||
|
$foto_namaBaru = $request->file('image')->store('public/images');
|
||||||
|
$user->thumbnail = $foto_namaBaru;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simpan perubahan pada database
|
||||||
|
$user->save();
|
||||||
|
return redirect()->route('users')->with('swal', swal_alert('success', 'You are successfully modify data'));
|
||||||
|
} else {
|
||||||
|
return redirect()->route('users')->with('swal', swal_alert('error', 'Unexpected error'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$user = User::find($id);
|
||||||
|
// Jika data ditemukan
|
||||||
|
if ($user) {
|
||||||
|
// Cek apakah ada file di kolom "is_thumbnail"
|
||||||
|
if ($user->thumbnail) {
|
||||||
|
// Hapus file thumbnail dari storage
|
||||||
|
Storage::delete($user->is_thumbnail);
|
||||||
|
}
|
||||||
|
// Hapus data dari database
|
||||||
|
$user->delete();
|
||||||
|
return redirect()->route('users')->with('swal', swal_alert('success', 'You are successfully deleted records'));
|
||||||
|
} else {
|
||||||
|
return redirect()->route('users')->with('swal', swal_alert('error', 'Data not found'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||||
|
|
||||||
|
class Kernel extends HttpKernel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The application's global HTTP middleware stack.
|
||||||
|
*
|
||||||
|
* These middleware are run during every request to your application.
|
||||||
|
*
|
||||||
|
* @var array<int, class-string|string>
|
||||||
|
*/
|
||||||
|
protected $middleware = [
|
||||||
|
// \App\Http\Middleware\TrustHosts::class,
|
||||||
|
\App\Http\Middleware\TrustProxies::class,
|
||||||
|
\Fruitcake\Cors\HandleCors::class,
|
||||||
|
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||||
|
\App\Http\Middleware\TrimStrings::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's route middleware groups.
|
||||||
|
*
|
||||||
|
* @var array<string, array<int, class-string|string>>
|
||||||
|
*/
|
||||||
|
protected $middlewareGroups = [
|
||||||
|
'web' => [
|
||||||
|
\App\Http\Middleware\EncryptCookies::class,
|
||||||
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||||
|
\Illuminate\Session\Middleware\StartSession::class,
|
||||||
|
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||||
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'api' => [
|
||||||
|
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||||
|
'throttle:api',
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's route middleware.
|
||||||
|
*
|
||||||
|
* These middleware may be assigned to groups or used individually.
|
||||||
|
*
|
||||||
|
* @var array<string, class-string|string>
|
||||||
|
*/
|
||||||
|
protected $routeMiddleware = [
|
||||||
|
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||||
|
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||||
|
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||||
|
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||||
|
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||||
|
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||||
|
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||||
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
|
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||||
|
'check.status' => \App\Http\Middleware\CheckUserStatus::class,
|
||||||
|
'check.admin' => \App\Http\Middleware\CheckAuthenticatedisAdmin::class,
|
||||||
|
'check.seller' => \App\Http\Middleware\CheckSeller::class,
|
||||||
|
'XssSanitization' => \App\Http\Middleware\XssSanitization::class,
|
||||||
|
'check.auth' => \App\Http\Middleware\isAuth::class
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Modules\User;
|
||||||
|
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use App\Models\Content;
|
||||||
|
use App\Models\ContentCategories as Category;
|
||||||
|
use App\Enums\GlobalEnum;
|
||||||
|
use WithPagination;
|
||||||
|
|
||||||
|
class Blog extends Component
|
||||||
|
{
|
||||||
|
public $filterType;
|
||||||
|
public $categoryFilter;
|
||||||
|
public $searchFilter = '';
|
||||||
|
|
||||||
|
public $currentPage = 1;
|
||||||
|
public $perPage = 10;
|
||||||
|
|
||||||
|
public function render(Request $request)
|
||||||
|
{
|
||||||
|
$valueCategory = '';
|
||||||
|
|
||||||
|
if(!empty($request->input('categoryFilter')))
|
||||||
|
{
|
||||||
|
$this->categoryFilter = $request->categoryFilter;
|
||||||
|
|
||||||
|
$valueCategory = $request->categoryFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = Content::where('is_status', 1);
|
||||||
|
|
||||||
|
if (!empty($this->categoryFilter)) {
|
||||||
|
$query->where('is_category', 'like', '%' . $this->categoryFilter . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->searchFilter)) {
|
||||||
|
$query->where('title', 'like', '%' . $this->searchFilter . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
$sites = $query->paginate($this->perPage)->appends([
|
||||||
|
'categoryFilter' => $this->categoryFilter,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$elements = $sites->links()->elements;
|
||||||
|
$searchCount = $sites->total();
|
||||||
|
$getListCategory = Category::select('*');
|
||||||
|
|
||||||
|
return view('livewire.modules.user.blog',
|
||||||
|
compact('sites', 'elements', 'searchCount', 'getListCategory', 'valueCategory')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function previousPage()
|
||||||
|
{
|
||||||
|
if ($this->currentPage > 1) {
|
||||||
|
$this->currentPage--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nextPage()
|
||||||
|
{
|
||||||
|
$this->currentPage++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function goToPage($page)
|
||||||
|
{
|
||||||
|
$url = route('user.sites.view', ['id' => $page]);
|
||||||
|
return redirect()->to($url);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Modules\User;
|
||||||
|
|
||||||
|
use Livewire\Component;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use Modules\Seller\Entities\DomainModel as Domains;
|
||||||
|
use Modules\User\Entities\CartModel as Carts;
|
||||||
|
|
||||||
|
use App\Enums\GlobalEnum;
|
||||||
|
use WithPagination;
|
||||||
|
|
||||||
|
class Domain extends Component
|
||||||
|
{
|
||||||
|
public $searchFilter = '';
|
||||||
|
public $minimumPrice;
|
||||||
|
public $maximumPrice;
|
||||||
|
|
||||||
|
public $currentPage = 1;
|
||||||
|
public $perPage = 10;
|
||||||
|
|
||||||
|
public function render(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$valueMinimumPrice = '';
|
||||||
|
$valueMaximumPrice = '';
|
||||||
|
|
||||||
|
if(!empty($request->input('minimumPrice')) || !empty($request->input('maximumPrice')))
|
||||||
|
{
|
||||||
|
$this->minimumPrice = $request->minimumPrice;
|
||||||
|
$this->maximumPrice = $request->maximumPrice;
|
||||||
|
|
||||||
|
$valueMinimumPrice = $request->minimumPrice;
|
||||||
|
$valueMaximumPrice = $request->maximumPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = Domains::where('is_status', GlobalEnum::isSiteActive);
|
||||||
|
|
||||||
|
if (!empty($this->minimumPrice) || !empty($this->maximumPrice)) {
|
||||||
|
$query->whereBetween('is_post_price', [$this->minimumPrice, $this->maximumPrice]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->searchFilter)) {
|
||||||
|
$check_query = $query->where('url', 'like', '%' . $this->searchFilter . '%')->count();
|
||||||
|
if($check_query == 0) {
|
||||||
|
$query->where('is_url_from_website', 'like', '%' . $this->searchFilter . '%');
|
||||||
|
} else {
|
||||||
|
$query->where('url', 'like', '%' . $this->searchFilter . '%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sites = $query->paginate($this->perPage)->appends([
|
||||||
|
'minimumPrice' => $this->minimumPrice,
|
||||||
|
'maximumPrice' => $this->maximumPrice,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$elements = $sites->links()->elements;
|
||||||
|
$searchCount = $sites->total();
|
||||||
|
|
||||||
|
return view('livewire.modules.user.domain',
|
||||||
|
compact('sites', 'elements', 'searchCount', 'valueMinimumPrice', 'valueMaximumPrice')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function previousPage()
|
||||||
|
{
|
||||||
|
if ($this->currentPage > 1) {
|
||||||
|
$this->currentPage--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nextPage()
|
||||||
|
{
|
||||||
|
$this->currentPage++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function goToPage($page)
|
||||||
|
{
|
||||||
|
$url = route('user.domain.view', ['id' => $page]);
|
||||||
|
return redirect()->to($url);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Modules\User;
|
||||||
|
|
||||||
|
use Livewire\Component;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use Modules\Seller\Entities\DomainModel as Domains;
|
||||||
|
use Modules\User\Entities\CartModel as Carts;
|
||||||
|
|
||||||
|
use App\Enums\GlobalEnum;
|
||||||
|
use WithPagination;
|
||||||
|
|
||||||
|
class DomainPremium extends Component
|
||||||
|
{
|
||||||
|
public $searchFilter = '';
|
||||||
|
public $minimumPrice;
|
||||||
|
public $maximumPrice;
|
||||||
|
|
||||||
|
public $currentPage = 1;
|
||||||
|
public $perPage = 10;
|
||||||
|
|
||||||
|
public function render(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$valueMinimumPrice = '';
|
||||||
|
$valueMaximumPrice = '';
|
||||||
|
|
||||||
|
if(!empty($request->input('minimumPrice')) || !empty($request->input('maximumPrice')))
|
||||||
|
{
|
||||||
|
$this->minimumPrice = $request->minimumPrice;
|
||||||
|
$this->maximumPrice = $request->maximumPrice;
|
||||||
|
|
||||||
|
$valueMinimumPrice = $request->minimumPrice;
|
||||||
|
$valueMaximumPrice = $request->maximumPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = Domains::where('is_status', GlobalEnum::isSiteActive)->where('is_premium', 1);
|
||||||
|
|
||||||
|
if (!empty($this->minimumPrice) || !empty($this->maximumPrice)) {
|
||||||
|
$query->whereBetween('is_post_price', [$this->minimumPrice, $this->maximumPrice]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->searchFilter)) {
|
||||||
|
$check_query = $query->where('url', 'like', '%' . $this->searchFilter . '%')->count();
|
||||||
|
if($check_query == 0) {
|
||||||
|
$query->where('is_url_from_website', 'like', '%' . $this->searchFilter . '%');
|
||||||
|
} else {
|
||||||
|
$query->where('url', 'like', '%' . $this->searchFilter . '%');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sites = $query->paginate($this->perPage)->appends([
|
||||||
|
'minimumPrice' => $this->minimumPrice,
|
||||||
|
'maximumPrice' => $this->maximumPrice,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$elements = $sites->links()->elements;
|
||||||
|
$searchCount = $sites->total();
|
||||||
|
|
||||||
|
return view('livewire.modules.user.domain-premium',
|
||||||
|
compact('sites', 'elements', 'searchCount', 'valueMinimumPrice', 'valueMaximumPrice')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function previousPage()
|
||||||
|
{
|
||||||
|
if ($this->currentPage > 1) {
|
||||||
|
$this->currentPage--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nextPage()
|
||||||
|
{
|
||||||
|
$this->currentPage++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function goToPage($page)
|
||||||
|
{
|
||||||
|
$url = route('user.domain.view', ['id' => $page]);
|
||||||
|
return redirect()->to($url);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Modules\User;
|
||||||
|
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use Modules\Seller\Entities\SitesModel as Sites;
|
||||||
|
use Modules\Seller\Entities\SitesCategoryModel as SitesCategory;
|
||||||
|
use Modules\User\Entities\CartModel as Carts;
|
||||||
|
use App\Enums\GlobalEnum;
|
||||||
|
use WithPagination;
|
||||||
|
|
||||||
|
class Listing extends Component
|
||||||
|
{
|
||||||
|
public $filterType;
|
||||||
|
public $categoryFilter;
|
||||||
|
public $searchFilter = '';
|
||||||
|
public $minimumPrice;
|
||||||
|
public $maximumPrice;
|
||||||
|
|
||||||
|
public $currentPage = 1;
|
||||||
|
public $perPage = 12;
|
||||||
|
|
||||||
|
public function render(Request $request)
|
||||||
|
{
|
||||||
|
$valueType = '';
|
||||||
|
$valueCategory = '';
|
||||||
|
$valueMinimumPrice = '';
|
||||||
|
$valueMaximumPrice = '';
|
||||||
|
|
||||||
|
if(!empty($request->input('filterType')) || !empty($request->input('categoryFilter')) || !empty($request->input('minimumPrice')) || !empty($request->input('maximumPrice')))
|
||||||
|
{
|
||||||
|
$this->filterType = $request->filterType;
|
||||||
|
$this->categoryFilter = $request->categoryFilter;
|
||||||
|
$this->minimumPrice = $request->minimumPrice;
|
||||||
|
$this->maximumPrice = $request->maximumPrice;
|
||||||
|
|
||||||
|
$valueType = $request->filterType;
|
||||||
|
$valueCategory = $request->categoryFilter;
|
||||||
|
$valueMinimumPrice = $request->minimumPrice;
|
||||||
|
$valueMaximumPrice = $request->maximumPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = Sites::where('is_status', GlobalEnum::isSiteActive);
|
||||||
|
|
||||||
|
if (!empty($this->filterType)) {
|
||||||
|
$query->where('is_type', $this->filterType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->categoryFilter)) {
|
||||||
|
$query->where('is_url_category', 'like', '%' . $this->categoryFilter . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->minimumPrice) || !empty($this->maximumPrice)) {
|
||||||
|
$query->whereBetween('is_post_price', [$this->minimumPrice, $this->maximumPrice]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->searchFilter)) {
|
||||||
|
$query->where('url', 'like', '%' . $this->searchFilter . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
$sites = $query->paginate($this->perPage)->appends([
|
||||||
|
'filterType' => $this->filterType,
|
||||||
|
'categoryFilter' => $this->categoryFilter,
|
||||||
|
'minimumPrice' => $this->minimumPrice,
|
||||||
|
'maximumPrice' => $this->maximumPrice,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$elements = $sites->links()->elements;
|
||||||
|
$searchCount = $sites->total();
|
||||||
|
$getListCategory = SitesCategory::where('is_status', GlobalEnum::isActive)->get();
|
||||||
|
|
||||||
|
return view('livewire.modules.user.product',
|
||||||
|
compact('sites', 'elements', 'searchCount', 'getListCategory', 'valueType', 'valueCategory', 'valueMinimumPrice', 'valueMaximumPrice')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function previousPage()
|
||||||
|
{
|
||||||
|
if ($this->currentPage > 1) {
|
||||||
|
$this->currentPage--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nextPage()
|
||||||
|
{
|
||||||
|
$this->currentPage++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function goToPage($page)
|
||||||
|
{
|
||||||
|
$url = route('user.sites.view', ['id' => $page]);
|
||||||
|
return redirect()->to($url);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Modules\User;
|
||||||
|
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use Modules\Seller\Entities\SitesModel as Sites;
|
||||||
|
use Modules\Seller\Entities\SitesCategoryModel as SitesCategory;
|
||||||
|
use Modules\User\Entities\CartModel as Carts;
|
||||||
|
use App\Enums\GlobalEnum;
|
||||||
|
use WithPagination;
|
||||||
|
|
||||||
|
class Site extends Component
|
||||||
|
{
|
||||||
|
public $filterType;
|
||||||
|
public $categoryFilter;
|
||||||
|
public $searchFilter = '';
|
||||||
|
public $minimumPrice;
|
||||||
|
public $maximumPrice;
|
||||||
|
|
||||||
|
public $currentPage = 1;
|
||||||
|
public $perPage = 10;
|
||||||
|
|
||||||
|
public function render(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$valueType = '';
|
||||||
|
$valueCategory = '';
|
||||||
|
$valueMinimumPrice = '';
|
||||||
|
$valueMaximumPrice = '';
|
||||||
|
|
||||||
|
if(!empty($request->input('filterType')) || !empty($request->input('categoryFilter')) || !empty($request->input('minimumPrice')) || !empty($request->input('maximumPrice')))
|
||||||
|
{
|
||||||
|
$this->filterType = $request->filterType;
|
||||||
|
$this->categoryFilter = $request->categoryFilter;
|
||||||
|
$this->minimumPrice = $request->minimumPrice;
|
||||||
|
$this->maximumPrice = $request->maximumPrice;
|
||||||
|
|
||||||
|
$valueType = $request->filterType;
|
||||||
|
$valueCategory = $request->categoryFilter;
|
||||||
|
$valueMinimumPrice = $request->minimumPrice;
|
||||||
|
$valueMaximumPrice = $request->maximumPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = Sites::where('is_status', GlobalEnum::isSiteActive);
|
||||||
|
|
||||||
|
if (!empty($this->filterType)) {
|
||||||
|
$query->where('is_type', $this->filterType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->categoryFilter)) {
|
||||||
|
$query->where('is_url_category', 'like', '%' . $this->categoryFilter . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->minimumPrice) || !empty($this->maximumPrice)) {
|
||||||
|
$query->whereBetween('is_post_price', [$this->minimumPrice, $this->maximumPrice]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->searchFilter)) {
|
||||||
|
$query->where('url', 'like', '%' . $this->searchFilter . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
$sites = $query->paginate($this->perPage)->appends([
|
||||||
|
'filterType' => $this->filterType,
|
||||||
|
'categoryFilter' => $this->categoryFilter,
|
||||||
|
'minimumPrice' => $this->minimumPrice,
|
||||||
|
'maximumPrice' => $this->maximumPrice,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$elements = $sites->links()->elements;
|
||||||
|
$searchCount = $sites->total();
|
||||||
|
$getListCategory = SitesCategory::where('is_status', GlobalEnum::isActive)->get();
|
||||||
|
|
||||||
|
return view('livewire.modules.user.site',
|
||||||
|
compact('sites', 'elements', 'searchCount', 'getListCategory', 'valueType', 'valueCategory', 'valueMinimumPrice', 'valueMaximumPrice')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function previousPage()
|
||||||
|
{
|
||||||
|
if ($this->currentPage > 1) {
|
||||||
|
$this->currentPage--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nextPage()
|
||||||
|
{
|
||||||
|
$this->currentPage++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function goToPage($page)
|
||||||
|
{
|
||||||
|
$url = route('user.sites.view', ['id' => $page]);
|
||||||
|
return redirect()->to($url);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Modules\User;
|
||||||
|
|
||||||
|
use Livewire\Component;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use Modules\Seller\Entities\SitesModel as Sites;
|
||||||
|
use Modules\Seller\Entities\SitesCategoryModel as SitesCategory;
|
||||||
|
use Modules\User\Entities\CartModel as Carts;
|
||||||
|
|
||||||
|
use App\Enums\GlobalEnum;
|
||||||
|
use WithPagination;
|
||||||
|
|
||||||
|
class SitePremium extends Component
|
||||||
|
{
|
||||||
|
public $filterType;
|
||||||
|
public $categoryFilter;
|
||||||
|
public $searchFilter = '';
|
||||||
|
public $minimumPrice;
|
||||||
|
public $maximumPrice;
|
||||||
|
|
||||||
|
public $currentPage = 1;
|
||||||
|
public $perPage = 10;
|
||||||
|
|
||||||
|
public function render(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$valueType = '';
|
||||||
|
$valueCategory = '';
|
||||||
|
$valueMinimumPrice = '';
|
||||||
|
$valueMaximumPrice = '';
|
||||||
|
|
||||||
|
if(!empty($request->input('filterType')) || !empty($request->input('categoryFilter')) || !empty($request->input('minimumPrice')) || !empty($request->input('maximumPrice')))
|
||||||
|
{
|
||||||
|
$this->filterType = $request->filterType;
|
||||||
|
$this->categoryFilter = $request->categoryFilter;
|
||||||
|
$this->minimumPrice = $request->minimumPrice;
|
||||||
|
$this->maximumPrice = $request->maximumPrice;
|
||||||
|
|
||||||
|
$valueType = $request->filterType;
|
||||||
|
$valueCategory = $request->categoryFilter;
|
||||||
|
$valueMinimumPrice = $request->minimumPrice;
|
||||||
|
$valueMaximumPrice = $request->maximumPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = Sites::where('is_status', GlobalEnum::isSiteActive)->where('is_premium', 1);
|
||||||
|
|
||||||
|
if (!empty($this->filterType)) {
|
||||||
|
$query->where('is_type', $this->filterType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->categoryFilter)) {
|
||||||
|
$query->where('is_url_category', 'like', '%' . $this->categoryFilter . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->minimumPrice) || !empty($this->maximumPrice)) {
|
||||||
|
$query->whereBetween('is_post_price', [$this->minimumPrice, $this->maximumPrice]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->searchFilter)) {
|
||||||
|
$query->where('url', 'like', '%' . $this->searchFilter . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
$sites = $query->paginate($this->perPage)->appends([
|
||||||
|
'filterType' => $this->filterType,
|
||||||
|
'categoryFilter' => $this->categoryFilter,
|
||||||
|
'minimumPrice' => $this->minimumPrice,
|
||||||
|
'maximumPrice' => $this->maximumPrice,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$elements = $sites->links()->elements;
|
||||||
|
$searchCount = $sites->total();
|
||||||
|
$getListCategory = SitesCategory::where('is_status', GlobalEnum::isActive)->get();
|
||||||
|
|
||||||
|
return view('livewire.modules.user.site-premium',
|
||||||
|
compact('sites', 'elements', 'searchCount', 'getListCategory', 'valueType', 'valueCategory', 'valueMinimumPrice', 'valueMaximumPrice')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function previousPage()
|
||||||
|
{
|
||||||
|
if ($this->currentPage > 1) {
|
||||||
|
$this->currentPage--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nextPage()
|
||||||
|
{
|
||||||
|
$this->currentPage++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function goToPage($page)
|
||||||
|
{
|
||||||
|
$url = route('user.sites.view', ['id' => $page]);
|
||||||
|
return redirect()->to($url);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||||
|
|
||||||
|
class Authenticate extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the path the user should be redirected to when they are not authenticated.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
protected function redirectTo($request)
|
||||||
|
{
|
||||||
|
if (! $request->expectsJson()) {
|
||||||
|
return route('login');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
class CheckAuthenticatedisAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||||
|
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next)
|
||||||
|
{
|
||||||
|
if (Auth::check()) {
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
// Check the user's status
|
||||||
|
if ($user->level != 1) {
|
||||||
|
return redirect()->intended('user');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class checkUserStatus
|
||||||
|
{
|
||||||
|
public function handle($request, Closure $next)
|
||||||
|
{
|
||||||
|
// Check if the user is authenticated
|
||||||
|
if (Auth::check()) {
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
// Check the user's status
|
||||||
|
if ($user->status !== 3) {
|
||||||
|
return back()
|
||||||
|
->with('swal', swal_alert('error', 'Akun anda dinonaktifkan, Mohon Kontak administrator'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||||
|
|
||||||
|
class EncryptCookies extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the cookies that should not be encrypted.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||||
|
|
||||||
|
class PreventRequestsDuringMaintenance extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The URIs that should be reachable while maintenance mode is enabled.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class RedirectIfAuthenticated
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||||
|
* @param string|null ...$guards
|
||||||
|
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next, ...$guards)
|
||||||
|
{
|
||||||
|
$guards = empty($guards) ? [null] : $guards;
|
||||||
|
|
||||||
|
foreach ($guards as $guard) {
|
||||||
|
if (Auth::guard($guard)->check()) {
|
||||||
|
return redirect(RouteServiceProvider::HOME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||||
|
|
||||||
|
class TrimStrings extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the attributes that should not be trimmed.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
'current_password',
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||||
|
|
||||||
|
class TrustHosts extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the host patterns that should be trusted.
|
||||||
|
*
|
||||||
|
* @return array<int, string|null>
|
||||||
|
*/
|
||||||
|
public function hosts()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->allSubdomainsOfApplicationUrl(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TrustProxies extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The trusted proxies for this application.
|
||||||
|
*
|
||||||
|
* @var array<int, string>|string|null
|
||||||
|
*/
|
||||||
|
protected $proxies;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The headers that should be used to detect proxies.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $headers =
|
||||||
|
Request::HEADER_X_FORWARDED_FOR |
|
||||||
|
Request::HEADER_X_FORWARDED_HOST |
|
||||||
|
Request::HEADER_X_FORWARDED_PORT |
|
||||||
|
Request::HEADER_X_FORWARDED_PROTO |
|
||||||
|
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||||
|
|
||||||
|
class VerifyCsrfToken extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The URIs that should be excluded from CSRF verification.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class XssSanitization
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handles the request by modifying the input data and passing it to the next middleware or route handler.
|
||||||
|
*
|
||||||
|
* @param Request $request The request object containing the input data.
|
||||||
|
* @param Closure $next The next middleware or route handler.
|
||||||
|
* @throws Some_Exception_Class [Optional] Description of any exception that may be thrown.
|
||||||
|
* @return mixed The result of the next middleware or route handler.
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next)
|
||||||
|
{
|
||||||
|
$input = $request->all();
|
||||||
|
array_walk_recursive($input, function(&$input) {
|
||||||
|
$input = strip_tags($input);
|
||||||
|
});
|
||||||
|
|
||||||
|
$request->merge($input);
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class isAuth
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||||
|
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next)
|
||||||
|
{
|
||||||
|
$auth = Auth::check();
|
||||||
|
if($auth) {
|
||||||
|
$user = Auth::user();
|
||||||
|
switch($user->level == 1) {
|
||||||
|
case 1:
|
||||||
|
return redirect()->intended('app/dashboard');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return redirect()->intended('user');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Gejala extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = 'tbl_gejala';
|
||||||
|
protected $primaryKey = 'id_gejala';
|
||||||
|
protected $fillable = [
|
||||||
|
'id_gejala',
|
||||||
|
'gejala',
|
||||||
|
'kode_gejala',
|
||||||
|
'nilai_cf'
|
||||||
|
];
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class Kondisi extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = 'tbl_kondisi';
|
||||||
|
protected $fillable = ['id','name', 'nilai'];
|
||||||
|
public $timestamps = false;
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Ramsey\Uuid\Uuid;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class LogActivites extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = 'tbl_log_activity';
|
||||||
|
protected $fillable = ['uid','logType','causedBy','performedOn','withContent','created_at'];
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
public static function default($args = [])
|
||||||
|
{
|
||||||
|
self::create([
|
||||||
|
'uid' => Uuid::uuid4()->toString(),
|
||||||
|
'logType' => $args['logType'],
|
||||||
|
'causedBy' => $args['causedBy'],
|
||||||
|
'performedOn' => Carbon::now(),
|
||||||
|
'withContent' => json_encode($args['withContent'], true),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->hasMany(User::class, 'id', 'causedBy');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Penyakit extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = 'tbl_penyakit';
|
||||||
|
protected $primaryKey = 'id_penyakit';
|
||||||
|
protected $fillable = [
|
||||||
|
'id_penyakit',
|
||||||
|
'kode_penyakit',
|
||||||
|
'nama_penyakit',
|
||||||
|
'penjelasan',
|
||||||
|
'penanganan',
|
||||||
|
];
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Riwayat extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = 'riwayat_jawaban';
|
||||||
|
protected $primaryKey = 'id_jawaban';
|
||||||
|
protected $fillable = [
|
||||||
|
'id_jawaban',
|
||||||
|
'waktu',
|
||||||
|
'jawaban',
|
||||||
|
'persen',
|
||||||
|
'penyakit',
|
||||||
|
'id_user'
|
||||||
|
];
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
public function solusi()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Penyakit::class, 'nama_penyakit', 'penyakit');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class Roles extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = 'tbl_role';
|
||||||
|
protected $fillable = ['id','name'];
|
||||||
|
public $timestamps = false;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Rule extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = 'tbl_rule';
|
||||||
|
protected $primaryKey = 'id_rule';
|
||||||
|
protected $fillable = [
|
||||||
|
'id_rule',
|
||||||
|
'kode_rule',
|
||||||
|
'kode_gejala',
|
||||||
|
'kode_penyakit',
|
||||||
|
'md',
|
||||||
|
'mb'
|
||||||
|
];
|
||||||
|
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
public function penyakit()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Penyakit::class, 'kode_penyakit', 'kode_penyakit');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function gejala()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Gejala::class, 'kode_gejala', 'kode_gejala');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
|
use App\Models\Permission;
|
||||||
|
use App\Models\Roles;
|
||||||
|
|
||||||
|
class User extends Authenticatable
|
||||||
|
{
|
||||||
|
use HasApiTokens, HasFactory, Notifiable;
|
||||||
|
|
||||||
|
protected $table = 'tbl_users';
|
||||||
|
protected $fillable = ['password','username','name','email','email_verified_token','email_verified_at','phone','status','remember_token','thumbnail','level'];
|
||||||
|
protected $hidden = [
|
||||||
|
'password',
|
||||||
|
'remember_token',
|
||||||
|
];
|
||||||
|
protected $casts = [
|
||||||
|
'email_verified_at' => 'datetime',
|
||||||
|
];
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
public function permission()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Permission::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function roles()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Roles::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function konselor()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Konselor::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function siswa()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Siswa::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function wali()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Wali::class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class UserManager extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $table = 'password_resets';
|
||||||
|
protected $fillable = [
|
||||||
|
'uuid',
|
||||||
|
'email',
|
||||||
|
'token',
|
||||||
|
'created_at',
|
||||||
|
'isUsed'
|
||||||
|
];
|
||||||
|
protected $primaryKey = 'uuid';
|
||||||
|
protected $hidden = ['created_at'];
|
||||||
|
public $timestamps = false;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Blade;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register any application services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
|
class AuthServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The policy mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array<class-string, class-string>
|
||||||
|
*/
|
||||||
|
protected $policies = [
|
||||||
|
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any authentication / authorization services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->registerPolicies();
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class BroadcastServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
Broadcast::routes();
|
||||||
|
|
||||||
|
require base_path('routes/channels.php');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||||
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Event;
|
||||||
|
|
||||||
|
class EventServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The event listener mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array<class-string, array<int, class-string>>
|
||||||
|
*/
|
||||||
|
protected $listen = [
|
||||||
|
Registered::class => [
|
||||||
|
SendEmailVerificationNotification::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any events for your application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The path to the "home" route for your application.
|
||||||
|
*
|
||||||
|
* This is used by Laravel authentication to redirect users after login.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const HOME = '/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The controller namespace for the application.
|
||||||
|
*
|
||||||
|
* When present, controller route declarations will automatically be prefixed with this namespace.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
// protected $namespace = 'App\\Http\\Controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define your route model bindings, pattern filters, etc.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->configureRateLimiting();
|
||||||
|
|
||||||
|
$this->routes(function () {
|
||||||
|
Route::prefix('api')
|
||||||
|
->middleware('api')
|
||||||
|
->namespace($this->namespace)
|
||||||
|
->group(base_path('routes/api.php'));
|
||||||
|
|
||||||
|
Route::middleware('web')
|
||||||
|
->namespace($this->namespace)
|
||||||
|
->group(base_path('routes/web.php'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the rate limiters for the application.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function configureRateLimiting()
|
||||||
|
{
|
||||||
|
RateLimiter::for('api', function (Request $request) {
|
||||||
|
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components\theme\auth;
|
||||||
|
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
|
class Authentication__Footer extends Component
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create a new component instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represent the component.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||||
|
*/
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('components.theme.auth.authentication__-footer');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components\theme\auth;
|
||||||
|
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
|
class Authentication__Header extends Component
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create a new component instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public $data;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->data = $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represent the component.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||||
|
*/
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('components.theme.auth.authentication__-header');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Register The Auto Loader
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Composer provides a convenient, automatically generated class loader
|
||||||
|
| for our application. We just need to utilize it! We'll require it
|
||||||
|
| into the script here so that we do not have to worry about the
|
||||||
|
| loading of any of our classes manually. It's great to relax.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Run The Artisan Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When we run the console application, the current CLI command will be
|
||||||
|
| executed in this console and the response sent back to a terminal
|
||||||
|
| or another output device for the developers. Here goes nothing!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
|
|
||||||
|
$status = $kernel->handle(
|
||||||
|
$input = new Symfony\Component\Console\Input\ArgvInput,
|
||||||
|
new Symfony\Component\Console\Output\ConsoleOutput
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Shutdown The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Once Artisan has finished running, we will fire off the shutdown events
|
||||||
|
| so that any final work may be done by the application before we shut
|
||||||
|
| down the process. This is the last thing to happen to the request.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$kernel->terminate($input, $status);
|
||||||
|
|
||||||
|
exit($status);
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Create The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The first thing we will do is create a new Laravel application instance
|
||||||
|
| which serves as the "glue" for all the components of Laravel, and is
|
||||||
|
| the IoC container for the system binding all of the various parts.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app = new Illuminate\Foundation\Application(
|
||||||
|
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Bind Important Interfaces
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, we need to bind some important interfaces into the container so
|
||||||
|
| we will be able to resolve them when needed. The kernels serve the
|
||||||
|
| incoming requests to this application from both the web and CLI.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Http\Kernel::class,
|
||||||
|
App\Http\Kernel::class
|
||||||
|
);
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Console\Kernel::class,
|
||||||
|
App\Console\Kernel::class
|
||||||
|
);
|
||||||
|
|
||||||
|
$app->singleton(
|
||||||
|
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||||
|
App\Exceptions\Handler::class
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Return The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This script returns the application instance. The instance is given to
|
||||||
|
| the calling script so we can separate the building of the instances
|
||||||
|
| from the actual running of the application and sending responses.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
return $app;
|
|
@ -0,0 +1,158 @@
|
||||||
|
<?php return array (
|
||||||
|
'darryldecode/cart' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Darryldecode\\Cart\\CartServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Cart' => 'Darryldecode\\Cart\\Facades\\CartFacade',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'facade/ignition' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Facade\\Ignition\\IgnitionServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Flare' => 'Facade\\Ignition\\Facades\\Flare',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'fruitcake/laravel-cors' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Fruitcake\\Cors\\CorsServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/sail' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/sanctum' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Sanctum\\SanctumServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravel/tinker' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'laravelcollective/html' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Collective\\Html\\HtmlServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Form' => 'Collective\\Html\\FormFacade',
|
||||||
|
'Html' => 'Collective\\Html\\HtmlFacade',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'livewire/livewire' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Livewire\\LivewireServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Livewire' => 'Livewire\\Livewire',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'maatwebsite/excel' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Excel' => 'Maatwebsite\\Excel\\Facades\\Excel',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'mad-web/laravel-enum' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'MadWeb\\Enum\\EnumServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'mews/purifier' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Mews\\Purifier\\PurifierServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Purifier' => 'Mews\\Purifier\\Facades\\Purifier',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'nesbot/carbon' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'nunomaduro/collision' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'nwidart/laravel-modules' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Nwidart\\Modules\\LaravelModulesServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Module' => 'Nwidart\\Modules\\Facades\\Module',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'realrashid/sweet-alert' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'RealRashid\\SweetAlert\\SweetAlertServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'Alert' => 'RealRashid\\SweetAlert\\Facades\\Alert',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'theanik/laravel-more-command' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Theanik\\LaravelMoreCommand\\LaravelMoreCommandProvider',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'yajra/laravel-datatables-oracle' =>
|
||||||
|
array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Yajra\\DataTables\\DataTablesServiceProvider',
|
||||||
|
),
|
||||||
|
'aliases' =>
|
||||||
|
array (
|
||||||
|
'DataTables' => 'Yajra\\DataTables\\Facades\\DataTables',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
|
@ -0,0 +1,264 @@
|
||||||
|
<?php return array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Illuminate\\Auth\\AuthServiceProvider',
|
||||||
|
1 => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
2 => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
3 => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
4 => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
5 => 'Illuminate\\Cookie\\CookieServiceProvider',
|
||||||
|
6 => 'Illuminate\\Database\\DatabaseServiceProvider',
|
||||||
|
7 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
|
||||||
|
8 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
|
||||||
|
9 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
|
||||||
|
10 => 'Illuminate\\Hashing\\HashServiceProvider',
|
||||||
|
11 => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
12 => 'Illuminate\\Notifications\\NotificationServiceProvider',
|
||||||
|
13 => 'Illuminate\\Pagination\\PaginationServiceProvider',
|
||||||
|
14 => 'Illuminate\\Pipeline\\PipelineServiceProvider',
|
||||||
|
15 => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
16 => 'Illuminate\\Redis\\RedisServiceProvider',
|
||||||
|
17 => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
|
||||||
|
18 => 'Illuminate\\Session\\SessionServiceProvider',
|
||||||
|
19 => 'Illuminate\\Translation\\TranslationServiceProvider',
|
||||||
|
20 => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
21 => 'Illuminate\\View\\ViewServiceProvider',
|
||||||
|
22 => 'Darryldecode\\Cart\\CartServiceProvider',
|
||||||
|
23 => 'Facade\\Ignition\\IgnitionServiceProvider',
|
||||||
|
24 => 'Fruitcake\\Cors\\CorsServiceProvider',
|
||||||
|
25 => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
26 => 'Laravel\\Sanctum\\SanctumServiceProvider',
|
||||||
|
27 => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
28 => 'Collective\\Html\\HtmlServiceProvider',
|
||||||
|
29 => 'Livewire\\LivewireServiceProvider',
|
||||||
|
30 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
|
||||||
|
31 => 'MadWeb\\Enum\\EnumServiceProvider',
|
||||||
|
32 => 'Mews\\Purifier\\PurifierServiceProvider',
|
||||||
|
33 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
34 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||||
|
35 => 'Nwidart\\Modules\\LaravelModulesServiceProvider',
|
||||||
|
36 => 'RealRashid\\SweetAlert\\SweetAlertServiceProvider',
|
||||||
|
37 => 'Theanik\\LaravelMoreCommand\\LaravelMoreCommandProvider',
|
||||||
|
38 => 'Yajra\\DataTables\\DataTablesServiceProvider',
|
||||||
|
39 => 'App\\Providers\\AppServiceProvider',
|
||||||
|
40 => 'App\\Providers\\AuthServiceProvider',
|
||||||
|
41 => 'App\\Providers\\EventServiceProvider',
|
||||||
|
42 => 'App\\Providers\\RouteServiceProvider',
|
||||||
|
43 => 'Collective\\Html\\HtmlServiceProvider',
|
||||||
|
44 => 'Yajra\\DataTables\\DataTablesServiceProvider',
|
||||||
|
45 => 'Mews\\Purifier\\PurifierServiceProvider',
|
||||||
|
46 => 'Darryldecode\\Cart\\CartServiceProvider',
|
||||||
|
),
|
||||||
|
'eager' =>
|
||||||
|
array (
|
||||||
|
0 => 'Illuminate\\Auth\\AuthServiceProvider',
|
||||||
|
1 => 'Illuminate\\Cookie\\CookieServiceProvider',
|
||||||
|
2 => 'Illuminate\\Database\\DatabaseServiceProvider',
|
||||||
|
3 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
|
||||||
|
4 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
|
||||||
|
5 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
|
||||||
|
6 => 'Illuminate\\Notifications\\NotificationServiceProvider',
|
||||||
|
7 => 'Illuminate\\Pagination\\PaginationServiceProvider',
|
||||||
|
8 => 'Illuminate\\Session\\SessionServiceProvider',
|
||||||
|
9 => 'Illuminate\\View\\ViewServiceProvider',
|
||||||
|
10 => 'Darryldecode\\Cart\\CartServiceProvider',
|
||||||
|
11 => 'Facade\\Ignition\\IgnitionServiceProvider',
|
||||||
|
12 => 'Fruitcake\\Cors\\CorsServiceProvider',
|
||||||
|
13 => 'Laravel\\Sanctum\\SanctumServiceProvider',
|
||||||
|
14 => 'Livewire\\LivewireServiceProvider',
|
||||||
|
15 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
|
||||||
|
16 => 'MadWeb\\Enum\\EnumServiceProvider',
|
||||||
|
17 => 'Mews\\Purifier\\PurifierServiceProvider',
|
||||||
|
18 => 'Carbon\\Laravel\\ServiceProvider',
|
||||||
|
19 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||||
|
20 => 'Nwidart\\Modules\\LaravelModulesServiceProvider',
|
||||||
|
21 => 'RealRashid\\SweetAlert\\SweetAlertServiceProvider',
|
||||||
|
22 => 'Theanik\\LaravelMoreCommand\\LaravelMoreCommandProvider',
|
||||||
|
23 => 'Yajra\\DataTables\\DataTablesServiceProvider',
|
||||||
|
24 => 'App\\Providers\\AppServiceProvider',
|
||||||
|
25 => 'App\\Providers\\AuthServiceProvider',
|
||||||
|
26 => 'App\\Providers\\EventServiceProvider',
|
||||||
|
27 => 'App\\Providers\\RouteServiceProvider',
|
||||||
|
28 => 'Yajra\\DataTables\\DataTablesServiceProvider',
|
||||||
|
29 => 'Mews\\Purifier\\PurifierServiceProvider',
|
||||||
|
30 => 'Darryldecode\\Cart\\CartServiceProvider',
|
||||||
|
),
|
||||||
|
'deferred' =>
|
||||||
|
array (
|
||||||
|
'Illuminate\\Broadcasting\\BroadcastManager' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Broadcasting\\Factory' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Broadcasting\\Broadcaster' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
|
||||||
|
'Illuminate\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Bus\\QueueingDispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'Illuminate\\Bus\\BatchRepository' => 'Illuminate\\Bus\\BusServiceProvider',
|
||||||
|
'cache' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'cache.store' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'cache.psr6' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'memcached.connector' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'Illuminate\\Cache\\RateLimiter' => 'Illuminate\\Cache\\CacheServiceProvider',
|
||||||
|
'command.cache.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.cache.forget' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.clear-compiled' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.auth.resets.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.config.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.config.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Database\\Console\\DbCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.db.prune' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.db.wipe' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.down' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.environment' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.event.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.event.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.event.list' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.key.generate' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.optimize' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.optimize.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.package.discover' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.failed' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.flush' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.forget' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.listen' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.monitor' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.prune-batches' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.prune-failed-jobs' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.restart' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.retry' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.retry-batch' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.work' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.route.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.route.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.route.list' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.schema.dump' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.seed' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleFinishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleRunCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleClearCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleTestCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'Illuminate\\Console\\Scheduling\\ScheduleWorkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.storage.link' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.up' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.view.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.view.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.cache.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.cast.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.channel.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.component.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.console.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.controller.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.event.generate' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.event.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.exception.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.factory.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.job.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.listener.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.mail.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.middleware.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.model.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.notification.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.notification.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.observer.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.policy.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.provider.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.failed-table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.queue.batches-table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.request.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.resource.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.rule.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.seeder.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.session.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.serve' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.stub.publish' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.test.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.vendor.publish' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'migrator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'migration.repository' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'migration.creator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.migrate' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.migrate.fresh' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.migrate.install' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.migrate.refresh' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.migrate.reset' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.migrate.rollback' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.migrate.status' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'command.migrate.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'composer' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
|
||||||
|
'hash' => 'Illuminate\\Hashing\\HashServiceProvider',
|
||||||
|
'hash.driver' => 'Illuminate\\Hashing\\HashServiceProvider',
|
||||||
|
'mail.manager' => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
'mailer' => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
'Illuminate\\Mail\\Markdown' => 'Illuminate\\Mail\\MailServiceProvider',
|
||||||
|
'Illuminate\\Contracts\\Pipeline\\Hub' => 'Illuminate\\Pipeline\\PipelineServiceProvider',
|
||||||
|
'queue' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.connection' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.failer' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.listener' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'queue.worker' => 'Illuminate\\Queue\\QueueServiceProvider',
|
||||||
|
'redis' => 'Illuminate\\Redis\\RedisServiceProvider',
|
||||||
|
'redis.connection' => 'Illuminate\\Redis\\RedisServiceProvider',
|
||||||
|
'auth.password' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
|
||||||
|
'auth.password.broker' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
|
||||||
|
'translator' => 'Illuminate\\Translation\\TranslationServiceProvider',
|
||||||
|
'translation.loader' => 'Illuminate\\Translation\\TranslationServiceProvider',
|
||||||
|
'validator' => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
'validation.presence' => 'Illuminate\\Validation\\ValidationServiceProvider',
|
||||||
|
'Laravel\\Sail\\Console\\InstallCommand' => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
'Laravel\\Sail\\Console\\PublishCommand' => 'Laravel\\Sail\\SailServiceProvider',
|
||||||
|
'command.tinker' => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||||
|
'html' => 'Collective\\Html\\HtmlServiceProvider',
|
||||||
|
'form' => 'Collective\\Html\\HtmlServiceProvider',
|
||||||
|
'Collective\\Html\\HtmlBuilder' => 'Collective\\Html\\HtmlServiceProvider',
|
||||||
|
'Collective\\Html\\FormBuilder' => 'Collective\\Html\\HtmlServiceProvider',
|
||||||
|
),
|
||||||
|
'when' =>
|
||||||
|
array (
|
||||||
|
'Illuminate\\Broadcasting\\BroadcastServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Bus\\BusServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Cache\\CacheServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Hashing\\HashServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Mail\\MailServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Pipeline\\PipelineServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Queue\\QueueServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Redis\\RedisServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Translation\\TranslationServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Illuminate\\Validation\\ValidationServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Laravel\\Sail\\SailServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Laravel\\Tinker\\TinkerServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
'Collective\\Html\\HtmlServiceProvider' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php return array (
|
||||||
|
'providers' =>
|
||||||
|
array (
|
||||||
|
0 => 'Modules\\User\\Providers\\UserServiceProvider',
|
||||||
|
),
|
||||||
|
'eager' =>
|
||||||
|
array (
|
||||||
|
0 => 'Modules\\User\\Providers\\UserServiceProvider',
|
||||||
|
),
|
||||||
|
'deferred' =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
);
|
|
@ -0,0 +1,82 @@
|
||||||
|
{
|
||||||
|
"name": "laravel/laravel",
|
||||||
|
"type": "project",
|
||||||
|
"description": "The Laravel Framework.",
|
||||||
|
"keywords": ["framework", "laravel"],
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {
|
||||||
|
"php": "^7.3|^8.0",
|
||||||
|
"aws/aws-sdk-php": "^3.276",
|
||||||
|
"darryldecode/cart": "^4.2",
|
||||||
|
"fruitcake/laravel-cors": "^2.0",
|
||||||
|
"guzzlehttp/guzzle": "^7.7",
|
||||||
|
"laravel/framework": "^8.75",
|
||||||
|
"laravel/sanctum": "^2.11",
|
||||||
|
"laravel/tinker": "^2.5",
|
||||||
|
"laravelcollective/html": "^6.3",
|
||||||
|
"league/flysystem-aws-s3-v3": "^1.0",
|
||||||
|
"livewire/livewire": "^2.0",
|
||||||
|
"maatwebsite/excel": "^3.1",
|
||||||
|
"mad-web/laravel-enum": "^2.2",
|
||||||
|
"mews/purifier": "^3.4",
|
||||||
|
"nwidart/laravel-modules": "^8.3",
|
||||||
|
"realrashid/sweet-alert": "^7.0",
|
||||||
|
"spatie/db-dumper": "^3.4",
|
||||||
|
"spatie/regex": "^1.4",
|
||||||
|
"swiftmailer/swiftmailer": "^6.3",
|
||||||
|
"yajra/laravel-datatables-oracle": "^9.21"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"facade/ignition": "^2.5",
|
||||||
|
"fakerphp/faker": "^1.9.1",
|
||||||
|
"laravel/sail": "^1.0.1",
|
||||||
|
"mockery/mockery": "^1.4.4",
|
||||||
|
"nunomaduro/collision": "^5.10",
|
||||||
|
"phpunit/phpunit": "^9.5.10",
|
||||||
|
"theanik/laravel-more-command": "^1.3"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/",
|
||||||
|
"Modules\\": "Modules/",
|
||||||
|
"Database\\Factories\\": "database/factories/",
|
||||||
|
"Database\\Seeders\\": "database/seeders/"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"app/Helpers/BackendHelper.php",
|
||||||
|
"app/Helpers/FrontendHelper.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi"
|
||||||
|
],
|
||||||
|
"post-update-cmd": [
|
||||||
|
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||||
|
],
|
||||||
|
"post-root-package-install": [
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
|
],
|
||||||
|
"post-create-project-cmd": [
|
||||||
|
"@php artisan key:generate --ansi"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"dont-discover": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true
|
||||||
|
},
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"prefer-stable": true
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue