init
This commit is contained in:
commit
603e31b0f4
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@ -0,0 +1,15 @@
|
||||
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
|
46
.env.example
Normal file
46
.env.example
Normal file
@ -0,0 +1,46 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
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
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=smtp.mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
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=
|
||||
|
||||
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}"
|
5
.gitattributes
vendored
Normal file
5
.gitattributes
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
* text=auto
|
||||
*.css linguist-vendored
|
||||
*.scss linguist-vendored
|
||||
*.js linguist-vendored
|
||||
CHANGELOG.md export-ignore
|
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
/public/gallery
|
||||
.env
|
||||
.env.backup
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/config/database.php
|
38
.htaccess
Normal file
38
.htaccess
Normal file
@ -0,0 +1,38 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)/$ /$1 [L,R=301]
|
||||
|
||||
# Handle Front Controller...
|
||||
RewriteCond %{REQUEST_URI} !(\.json|\.css|\.js|\.png|\.jpg|\.gif|robots\.txt|\.ttf|\.woff|\.woff2|\.mp4|\.webm|\.ico|\.svg)$ [NC]
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
|
||||
#RewriteRule ^(.*)$ public/$1 [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_URI} !^/public/
|
||||
RewriteRule ^(css|js|images|fonts|assets|vendors|uploadimg|img|fonts|extras|lan_id|assets_admin|template_excel)/(.*)$ public/$1/$2 [L,NC]
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
<Files .htaccess>
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
</Files>
|
||||
<Directory /var/www/html/pmo_css/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>
|
||||
</IfModule>
|
||||
|
||||
|
||||
|
||||
# Disable server signature
|
||||
ServerSignature Off
|
13
.styleci.yml
Normal file
13
.styleci.yml
Normal file
@ -0,0 +1,13 @@
|
||||
php:
|
||||
preset: laravel
|
||||
disabled:
|
||||
- unused_use
|
||||
finder:
|
||||
not-name:
|
||||
- index.php
|
||||
- server.php
|
||||
js:
|
||||
finder:
|
||||
not-name:
|
||||
- webpack.mix.js
|
||||
css: true
|
10
.vscode/sftp.json
vendored
Normal file
10
.vscode/sftp.json
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "PMO CSS PROD",
|
||||
"host": "159.65.14.252",
|
||||
"protocol": "sftp",
|
||||
"port": 22,
|
||||
"username": "root",
|
||||
"password": "WsU9iWRWZ4mP1M3M",
|
||||
"remotePath": "/var/www/html/pmo_css",
|
||||
"uploadOnSave": false
|
||||
}
|
42
Dockerfile
Normal file
42
Dockerfile
Normal file
@ -0,0 +1,42 @@
|
||||
FROM webdevops/php-nginx:7.4-alpine
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www/html
|
||||
|
||||
ENV WEB_DOCUMENT_ROOT /var/www/html/public
|
||||
ENV APP_ENV production
|
||||
ENV WEB_ALIAS_DOMAIN chess.basys.co.id/
|
||||
|
||||
# Copy project ke dalam container
|
||||
COPY . /var/www/html
|
||||
|
||||
RUN apk add oniguruma-dev git nano postgresql-dev libxml2-dev
|
||||
RUN docker-php-ext-install \
|
||||
bcmath \
|
||||
ctype \
|
||||
fileinfo \
|
||||
json \
|
||||
mbstring \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
tokenizer \
|
||||
xml
|
||||
|
||||
# Install composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Copy directory project permission ke container
|
||||
COPY --chown=www-data:www-data . /var/www/html
|
||||
|
||||
RUN chown -R www-data:www-data /var/www/html
|
||||
|
||||
# Install dependency
|
||||
RUN composer install --no-interaction --optimize-autoloader --no-dev
|
||||
|
||||
# Optimizing Configuration loading
|
||||
RUN php artisan optimize:clear
|
||||
|
||||
# Ganti user ke www-data
|
||||
USER www-data
|
||||
|
||||
Expose 8200
|
78
README.md
Normal file
78
README.md
Normal file
@ -0,0 +1,78 @@
|
||||
<p align="center"><img src="https://res.cloudinary.com/dtfbvvkyp/image/upload/v1566331377/laravel-logolockup-cmyk-red.svg" width="400"></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[British Software Development](https://www.britishsoftware.co)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- [UserInsights](https://userinsights.com)
|
||||
- [Fragrantica](https://www.fragrantica.com)
|
||||
- [SOFTonSOFA](https://softonsofa.com/)
|
||||
- [User10](https://user10.com)
|
||||
- [Soumettre.fr](https://soumettre.fr/)
|
||||
- [CodeBrisk](https://codebrisk.com)
|
||||
- [1Forge](https://1forge.com)
|
||||
- [TECPRESSO](https://tecpresso.co.jp/)
|
||||
- [Runtime Converter](http://runtimeconverter.com/)
|
||||
- [WebL'Agence](https://weblagence.com/)
|
||||
- [Invoice Ninja](https://www.invoiceninja.com)
|
||||
- [iMi digital](https://www.imi-digital.de/)
|
||||
- [Earthlink](https://www.earthlink.ro/)
|
||||
- [Steadfast Collective](https://steadfastcollective.com/)
|
||||
- [We Are The Robots Inc.](https://watr.mx/)
|
||||
- [Understand.io](https://www.understand.io/)
|
||||
- [Abdel Elrafa](https://abdelelrafa.com)
|
||||
- [Hyper Host](https://hyper.host)
|
||||
- [Appoly](https://www.appoly.co.uk)
|
||||
- [OP.GG](https://op.gg)
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
41
app/Console/Kernel.php
Normal file
41
app/Console/Kernel.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
68
app/Exceptions/Handler.php
Normal file
68
app/Exceptions/Handler.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
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
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param \Throwable $exception
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
parent::report($exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Throwable $exception
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
if ($exception instanceof \Illuminate\Session\TokenMismatchException) {
|
||||
return redirect()->route('login');
|
||||
}
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
||||
protected function unauthenticated($request, AuthenticationException $exception)
|
||||
{
|
||||
if ($request->expectsJson()) {
|
||||
return response()->json(['error' => 'Unauthenticated.'], 401);
|
||||
}
|
||||
|
||||
return redirect()->guest(route('login'));
|
||||
}
|
||||
}
|
14
app/Exports/LaporanProject.php
Normal file
14
app/Exports/LaporanProject.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
|
||||
class LaporanProjectExport implements FromView
|
||||
{
|
||||
public function view(): View
|
||||
{
|
||||
return view('content.others.laporan_project');
|
||||
}
|
||||
}
|
82
app/Exports/LaporanProjectExport.php
Normal file
82
app/Exports/LaporanProjectExport.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
|
||||
class LaporanProjectExport implements FromView
|
||||
{
|
||||
|
||||
protected $param;
|
||||
|
||||
public function __construct($param)
|
||||
{
|
||||
|
||||
$this->param = $param;
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$param = $this->param;
|
||||
$path = $param['path'];
|
||||
|
||||
if ($path == 'new') {
|
||||
$data = DB::select("select mpt.*, rs.definition as status, rcl.definition as lvlurgent, mp.project_name, mu.full_name as implementor
|
||||
from master_project_task mpt
|
||||
join master_project mp on mp.id = mpt.project_id
|
||||
left join master_user mu on mu.id = mpt.user_imp_id
|
||||
left join ref_status rs on rs.id = mpt.status_id
|
||||
left join ref_critical_level rcl on rcl.id = mpt.critical_level_id
|
||||
where mpt.status_id = 7
|
||||
order by created_at desc");
|
||||
} else if($path == 'op') {
|
||||
$data = DB::select("select mpt.*, rs.definition as status, rcl.definition as lvlurgent, mp.project_name, mu.full_name as implementor
|
||||
from master_project_task mpt
|
||||
join master_project mp on mp.id = mpt.project_id
|
||||
left join master_user mu on mu.id = mpt.user_imp_id
|
||||
left join ref_status rs on rs.id = mpt.status_id
|
||||
left join ref_critical_level rcl on rcl.id = mpt.critical_level_id
|
||||
where mpt.status_id in (1,2,3,4)
|
||||
order by created_at desc");
|
||||
} else if($path == 'cancel') {
|
||||
$data = DB::select("select mpt.*, rs.definition as status, rcl.definition as lvlurgent, mp.project_name, mu.full_name as implementor
|
||||
from master_project_task mpt
|
||||
join master_project mp on mp.id = mpt.project_id
|
||||
left join master_user mu on mu.id = mpt.user_imp_id
|
||||
left join ref_status rs on rs.id = mpt.status_id
|
||||
left join ref_critical_level rcl on rcl.id = mpt.critical_level_id
|
||||
where mpt.status_id in (6, 8)
|
||||
order by created_at desc");
|
||||
} else if($path == 'overdue') {
|
||||
$data = DB::select("select mpt.*, rs.definition as status, rcl.definition as lvlurgent, mp.project_name, mu.full_name as implementor
|
||||
from master_project_task mpt
|
||||
join master_project mp on mp.id = mpt.project_id
|
||||
left join master_user mu on mu.id = mpt.user_imp_id
|
||||
left join ref_status rs on rs.id = mpt.status_id
|
||||
left join ref_critical_level rcl on rcl.id = mpt.critical_level_id
|
||||
where mpt.status_id not in (5,6,7,8) and (DATE_PART('day', mpt.date_deadline::timestamp - CURRENT_DATE::timestamp)) >=0
|
||||
order by created_at desc");
|
||||
} else if($path == 'done') {
|
||||
$data = DB::select("select mpt.*, rs.definition as status, rcl.definition as lvlurgent, mp.project_name, mu.full_name as implementor
|
||||
from master_project_task mpt
|
||||
join master_project mp on mp.id = mpt.project_id
|
||||
left join master_user mu on mu.id = mpt.user_imp_id
|
||||
left join ref_status rs on rs.id = mpt.status_id
|
||||
left join ref_critical_level rcl on rcl.id = mpt.critical_level_id
|
||||
where mpt.status_id = 5 and mpt.status_approve = true
|
||||
order by created_at desc");
|
||||
} else {
|
||||
$data = DB::select("select mpt.*, rs.definition as status, rcl.definition as lvlurgent, mp.project_name, mu.full_name as implementor
|
||||
from master_project_task mpt
|
||||
join master_project mp on mp.id = mpt.project_id
|
||||
left join master_user mu on mu.id = mpt.user_imp_id
|
||||
left join ref_status rs on rs.id = mpt.status_id
|
||||
left join ref_critical_level rcl on rcl.id = mpt.critical_level_id
|
||||
order by created_at desc");
|
||||
}
|
||||
|
||||
return view('content.others.laporan_project', ['data' => $data, 'path' => $path]);
|
||||
}
|
||||
}
|
14
app/Exports/LaporanProjectExports.php
Normal file
14
app/Exports/LaporanProjectExports.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
|
||||
class LaporanProjectExport implements FromView
|
||||
{
|
||||
public function view(): View
|
||||
{
|
||||
return view('content.others.laporan_project');
|
||||
}
|
||||
}
|
40
app/Http/Controllers/Auth/ConfirmPasswordController.php
Normal file
40
app/Http/Controllers/Auth/ConfirmPasswordController.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
||||
|
||||
class ConfirmPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Confirm Password Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password confirmations and
|
||||
| uses a simple trait to include the behavior. You're free to explore
|
||||
| this trait and override any functions that require customization.
|
||||
|
|
||||
*/
|
||||
|
||||
use ConfirmsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users when the intended url fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
}
|
22
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
22
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
}
|
40
app/Http/Controllers/Auth/LoginController.php
Normal file
40
app/Http/Controllers/Auth/LoginController.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
}
|
73
app/Http/Controllers/Auth/RegisterController.php
Normal file
73
app/Http/Controllers/Auth/RegisterController.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
]);
|
||||
}
|
||||
}
|
30
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
30
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
}
|
42
app/Http/Controllers/Auth/VerificationController.php
Normal file
42
app/Http/Controllers/Auth/VerificationController.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||
|
||||
class VerificationController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email Verification Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling email verification for any
|
||||
| user that recently registered with the application. Emails may also
|
||||
| be re-sent if the user didn't receive the original email message.
|
||||
|
|
||||
*/
|
||||
|
||||
use VerifiesEmails;
|
||||
|
||||
/**
|
||||
* Where to redirect users after verification.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('signed')->only('verify');
|
||||
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||
}
|
||||
}
|
89
app/Http/Controllers/Controller.php
Normal file
89
app/Http/Controllers/Controller.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Nullix\CryptoJsAes\CryptoJsAes;
|
||||
use Illuminate\Support\Facades\Request as Req;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
|
||||
public function login(Request $request) {
|
||||
$username = $request->username;
|
||||
$password = $request->password;
|
||||
$passDecrypt = "pmo123456";
|
||||
$passwordDecrypted = CryptoJsAes::decrypt($password, $passDecrypt);
|
||||
$data = DB::table('master_user')->where('user_code',$username)->first();
|
||||
if(!is_null($data)) {
|
||||
if (!Hash::check($passwordDecrypted, $data->password)){
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'rm' => 'Password salah'
|
||||
]);
|
||||
}
|
||||
|
||||
if(!$data->is_active) {
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'rm' => 'User tidak aktif, Tolong Lapor ke administrator jika ingin mengaktifkan user kembali'
|
||||
]);
|
||||
}
|
||||
|
||||
Session::put('id', $data->id);
|
||||
Session::put('roleId', $data->role_id);
|
||||
Auth::loginUsingId($data->id);
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'rm' => 'User teridentifikasi',
|
||||
'role' => $data->role_id,
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'rm' => 'Username Tidak Ditemukan'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function bsGetView($view,$param)
|
||||
{
|
||||
|
||||
// $isAllow = false;
|
||||
// $urlCheck = substr(\Request::getRequestUri(),1);
|
||||
|
||||
// $check = \DB::select("SELECT m.* from menu m
|
||||
// join menu_privilege mp on mp.menu_uid = m.menu_uid
|
||||
// where mp.group_id = ?",[Auth::user()->role]);
|
||||
|
||||
// foreach ($check as $key => $v) {
|
||||
// if($v->url == '/'.$urlCheck){
|
||||
// $isAllow = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if ($urlCheck == '') {
|
||||
$isAllow = true;
|
||||
// }
|
||||
|
||||
if ($isAllow) {
|
||||
if (Req::ajax()) {
|
||||
return view('onlyContent')->nest('child', $view,$param);
|
||||
}else {
|
||||
return view('home')->nest('child', $view,$param);
|
||||
}
|
||||
}else{
|
||||
return view('errors.404');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
2977
app/Http/Controllers/HomeController.php
Normal file
2977
app/Http/Controllers/HomeController.php
Normal file
File diff suppressed because it is too large
Load Diff
165
app/Http/Controllers/MenuController.php
Normal file
165
app/Http/Controllers/MenuController.php
Normal file
@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\MenuModel;
|
||||
use Response;
|
||||
use Session;
|
||||
use Yajra\DataTables\DataTables;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Request as Req;
|
||||
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MenuController extends Controller
|
||||
{
|
||||
|
||||
public function admin_index($id)
|
||||
{
|
||||
|
||||
$datas['title'] = 'Hak Akses Menu';
|
||||
$datas['getMenu'] = DB::select("SELECT * from menu order by seq");
|
||||
|
||||
|
||||
$datas['table'] = route('data.menu',$id);
|
||||
$datas['admin_menu_get'] = route('menu.menu_get',$id);
|
||||
$datas['admin_menu_store'] = route('menu.store',$id);
|
||||
$datas['urlCheck'] = '/menu/admin/index';
|
||||
|
||||
|
||||
// return view('home')->nest('child','content.menu_admin.index',$datas);
|
||||
return $this->bsGetView('content.menu_admin.index', $datas);
|
||||
}
|
||||
|
||||
public function admin_data($id)
|
||||
{
|
||||
if ($id == 'admin') {
|
||||
if(Auth::user()->role_id==7) {
|
||||
$data = DB::select("SELECT *,id as list_menu FROM ref_role order by id desc");
|
||||
} else {
|
||||
$data = DB::select("SELECT *,id as list_menu FROM ref_role WHERE id not in (7) order by id desc");
|
||||
}
|
||||
}else{
|
||||
$data = DB::select("SELECT user_type_name as description,user_type_uid as list_menu FROM reff_user_type order by user_type_uid desc");
|
||||
}
|
||||
|
||||
return DataTables::of($data)
|
||||
->addColumn('action', function ($data) {
|
||||
|
||||
return '
|
||||
<div class="dropdown dropdown-inline">
|
||||
<a href="javascript:;" class="btn btn-sm btn-clean btn-icon mr-2" data-toggle="dropdown">
|
||||
<span class="svg-icon svg-icon-md">
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
|
||||
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<rect x="0" y="0" width="24" height="24"/>
|
||||
<path d="M5,8.6862915 L5,5 L8.6862915,5 L11.5857864,2.10050506 L14.4852814,5 L19,5 L19,9.51471863 L21.4852814,12 L19,14.4852814 L19,19 L14.4852814,19 L11.5857864,21.8994949 L8.6862915,19 L5,19 L5,15.3137085 L1.6862915,12 L5,8.6862915 Z M12,15 C13.6568542,15 15,13.6568542 15,12 C15,10.3431458 13.6568542,9 12,9 C10.3431458,9 9,10.3431458 9,12 C9,13.6568542 10.3431458,15 12,15 Z" fill="#000000"/>
|
||||
</g>
|
||||
</svg>
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-sm dropdown-right">
|
||||
<ul class="navi flex-column navi-hover py-2">
|
||||
<li class="navi-header font-weight-bolder text-uppercase font-size-xs text-primary pb-2">
|
||||
Choose an action:
|
||||
</li>
|
||||
<li class="navi-item">
|
||||
<a onclick="modalMenu('.$data->list_menu.',`'.$data->definition.'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-list-ul"></i></span>
|
||||
<span class="navi-text">Akses Menu</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
})
|
||||
->editColumn('list_menu',function($data) use($id) {
|
||||
|
||||
if ($id == 'admin') {
|
||||
$getMenu = DB::select("SELECT * from menu_privilege rrm
|
||||
join menu rm on rm.menu_uid = rrm.menu_uid
|
||||
where group_id = ? and has_children is true order by rm.menu_uid",[$data->list_menu]);
|
||||
|
||||
$menu_list = '';
|
||||
foreach ($getMenu as $key => $v) {
|
||||
$menu_list .= '<span class="label label-lg label-success label-inline mr-2 mb-2">'.$v->menu.'</span>';
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$getMenu = DB::select("SELECT * from privilege rrm
|
||||
join menu_cms rm on rm.menu_cms_uid = rrm.menu_cms_uid
|
||||
where user_type_uid = ? and has_children is true order by rm.menu_cms_uid",[$data->list_menu]);
|
||||
|
||||
$menu_list = '';
|
||||
foreach ($getMenu as $key => $v) {
|
||||
$menu_list .= '<span class="label label-lg label-success label-inline mr-2 mb-2">'.$v->menu_cms.'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
return $menu_list;
|
||||
|
||||
})
|
||||
|
||||
->rawColumns(['list_menu','action'])
|
||||
->make(true);
|
||||
|
||||
}
|
||||
|
||||
public function admin_menu_get(Request $request,$id)
|
||||
{
|
||||
if ($id == 'admin') {
|
||||
$data = DB::select("SELECT * FROM menu_privilege where group_id = ".$request->post('id'));
|
||||
}else{
|
||||
$data = DB::select("SELECT *,menu_cms_uid as menu_uid FROM privilege where user_type_uid = ".$request->post('id'));
|
||||
}
|
||||
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
public function admin_store(Request $request,$id)
|
||||
{
|
||||
|
||||
if ($id == 'admin') {
|
||||
DB::table('menu_privilege')->where('group_id', $request->post('get_id'))->delete();
|
||||
$menu_id = $request->post('menu_id');
|
||||
if ($menu_id) {
|
||||
foreach ($menu_id as $key => $v) {
|
||||
// $seq = DB::table('menu_privilege')->max('id');
|
||||
|
||||
DB::table('menu_privilege')->insert([
|
||||
// 'id' => $seq+1,
|
||||
'group_id' => $request->post('get_id'),
|
||||
'menu_uid' => $v,
|
||||
'p_menu' => true
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
DB::table('privilege')->where('user_type_uid', $request->post('get_id'))->delete();
|
||||
$menu_id = $request->post('menu_id');
|
||||
if ($menu_id) {
|
||||
foreach ($menu_id as $key => $v) {
|
||||
// $seq = DB::table('menu_privilege')->max('id');
|
||||
|
||||
DB::table('privilege')->insert([
|
||||
// 'id' => $seq+1,
|
||||
'user_type_uid' => $request->post('get_id'),
|
||||
'menu_cms_uid' => $v
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'rm' => "Berhasil"
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
815
app/Http/Controllers/OthersController.php
Normal file
815
app/Http/Controllers/OthersController.php
Normal file
@ -0,0 +1,815 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\BudgetTypeModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\CompanyModel;
|
||||
use App\Models\CriticalLevelModel;
|
||||
use App\Models\JenisTaskModel;
|
||||
use App\Models\StatusModel;
|
||||
use App\Models\TeamRoleModel;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Yajra\DataTables\DataTables;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\QueryException;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class OthersController extends Controller
|
||||
{
|
||||
//
|
||||
public function mngTeam(Request $request) {
|
||||
// $param['table'] = route('others.dataTable')."?type=mngTeam";
|
||||
$param['urlData'] = route('others.data')."?type=mngTeam";
|
||||
// return view('home')->nest('child', 'content.others.team.index', $param);
|
||||
return $this->bsGetView('content.others.team.index', $param);
|
||||
}
|
||||
|
||||
public function company(Request $request) {
|
||||
$param['table'] = route('others.dataTable')."?type=company";
|
||||
// return view('home')->nest('child', 'content.others.company.index', $param);
|
||||
return $this->bsGetView('content.others.company.index', $param);
|
||||
}
|
||||
|
||||
public function company_store(Request $request) {
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
if($request->get_id) {
|
||||
$company = CompanyModel::find($request->get_id);
|
||||
$company->user_upd_id = Auth::user()->id;
|
||||
$company->company_name = $request->company_name;
|
||||
$company->company_code = $request->company_code;
|
||||
$company->address = $request->address;
|
||||
$company->phone_no = $request->phone_no;
|
||||
$company->email = $request->email;
|
||||
$company->pic_name = $request->pic_name;
|
||||
|
||||
if($request->hasFile('logo_url')){
|
||||
$destination_path = public_path('gallery');
|
||||
$image_path = public_path($company->logo_url);
|
||||
if(File::exists($image_path)) {
|
||||
File::delete($image_path);
|
||||
}
|
||||
$files = $request->file('logo_url');
|
||||
$filename = 'User_'.date('Ymd')."_".date('His').'.'.$files->getClientOriginalExtension();
|
||||
$upload_success = $files->move($destination_path, $filename);
|
||||
$company->logo_url = '/gallery/'.$filename;
|
||||
}
|
||||
$company->save();
|
||||
} else {
|
||||
$company = new CompanyModel();
|
||||
// $get_max = DB::table('master_company')->max('id');
|
||||
// $company->id = $get_max+1;
|
||||
$company->user_crt_id = Auth::user()->id;
|
||||
$company->company_name = $request->company_name;
|
||||
$company->company_code = $request->company_code;
|
||||
$company->address = $request->address;
|
||||
$company->phone_no = $request->phone_no;
|
||||
$company->email = $request->email;
|
||||
$company->pic_name = $request->pic_name;
|
||||
|
||||
if($request->hasFile('logo_url')){
|
||||
$destination_path = public_path('gallery');
|
||||
$files = $request->file('logo_url');
|
||||
$filename = 'LogoC_'.date('Ymd')."_".date('His').'.'.$files->getClientOriginalExtension();
|
||||
$upload_success = $files->move($destination_path, $filename);
|
||||
$company->logo_url = '/gallery/'.$filename;
|
||||
}
|
||||
// $company->save();
|
||||
if($company->save()) {
|
||||
$nameStatus = array('Assigned', 'On Progress', 'Done', 'Inactive');
|
||||
$noI = 1;
|
||||
$data = [];
|
||||
for($i=0; $i<sizeOf($nameStatus); $i++) {
|
||||
$data[$i] = [
|
||||
'id' => $noI++,
|
||||
'definition' => $nameStatus[$i],
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id,
|
||||
];
|
||||
}
|
||||
$status = StatusModel::insert($data);
|
||||
|
||||
$nameCritical = array('Low', 'Medium', 'High', 'Critical', 'Very Critical');
|
||||
$bobotCritical = array('0.25', '0.5', '1', '1.25', '1.5');
|
||||
$noJ = 1;
|
||||
$dataJ = [];
|
||||
for($j=0; $j<sizeOf($nameCritical); $j++) {
|
||||
$dataJ[$j] = [
|
||||
'id' => $noJ++,
|
||||
'definition' => $nameCritical[$j],
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id,
|
||||
'bobot' => $bobotCritical[$j],
|
||||
];
|
||||
}
|
||||
|
||||
$critical = CriticalLevelModel::insert($dataJ);
|
||||
|
||||
$arrayBudget = array(
|
||||
[
|
||||
'id' => 1,
|
||||
'definition' => 'BudgetAwal',
|
||||
'is_shown' => false,
|
||||
'tx_type' => 'Kr',
|
||||
'operator' => '+',
|
||||
'rev_operator' => '-',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id
|
||||
], [
|
||||
'id' => 2,
|
||||
'definition' => 'Transportasi',
|
||||
'is_shown' => true,
|
||||
'tx_type' => 'Db',
|
||||
'operator' => '-',
|
||||
'rev_operator' => '+',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id
|
||||
], [
|
||||
'id' => 3,
|
||||
'definition' => 'Akomodasi',
|
||||
'is_shown' => true,
|
||||
'tx_type' => 'Db',
|
||||
'operator' => '-',
|
||||
'rev_operator' => '+',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id
|
||||
], [
|
||||
'id' => 4,
|
||||
'definition' => 'Konsumsi',
|
||||
'is_shown' => true,
|
||||
'tx_type' => 'Db',
|
||||
'operator' => '-',
|
||||
'rev_operator' => '+',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id
|
||||
], [
|
||||
'id' => 5,
|
||||
'definition' => 'Insentif Perjalanan Dinas',
|
||||
'is_shown' => true,
|
||||
'tx_type' => 'Db',
|
||||
'operator' => '-',
|
||||
'rev_operator' => '+',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id
|
||||
], [
|
||||
'id' => 6,
|
||||
'definition' => 'Pembelian Inventaris',
|
||||
'is_shown' => true,
|
||||
'tx_type' => 'Db',
|
||||
'operator' => '-',
|
||||
'rev_operator' => '+',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id
|
||||
], [
|
||||
'id' => 7,
|
||||
'definition' => 'Pembelian Software',
|
||||
'is_shown' => true,
|
||||
'tx_type' => 'Db',
|
||||
'operator' => '-',
|
||||
'rev_operator' => '+',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id
|
||||
], [
|
||||
'id' => 8,
|
||||
'definition' => 'Penyesuaian Budget',
|
||||
'is_shown' => true,
|
||||
'tx_type' => 'Kr',
|
||||
'operator' => '+',
|
||||
'rev_operator' => '-',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id
|
||||
], [
|
||||
'id' => 9,
|
||||
'definition' => 'Pengurangan Budget',
|
||||
'is_shown' => true,
|
||||
'tx_type' => 'Db',
|
||||
'operator' => '-',
|
||||
'rev_operator' => '+',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id
|
||||
], [
|
||||
'id' => 10,
|
||||
'definition' => 'Lainnya',
|
||||
'is_shown' => true,
|
||||
'tx_type' => 'Db',
|
||||
'operator' => '-',
|
||||
'rev_operator' => '+',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id
|
||||
]
|
||||
);
|
||||
|
||||
$budget = BudgetTypeModel::insert($arrayBudget);
|
||||
|
||||
$nameTeamRole = array('PM', 'Deputi PM', 'Member');
|
||||
$noK = 1;
|
||||
$dataK = [];
|
||||
for($k=0; $k<sizeOf($nameTeamRole); $k++) {
|
||||
$dataK[$k] = [
|
||||
'id' => $noK++,
|
||||
'definition' => $nameTeamRole[$k],
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id,
|
||||
];
|
||||
}
|
||||
|
||||
$team_role = TeamRoleModel::insert($dataK);
|
||||
|
||||
|
||||
// $lastIdTaskType = DB::table('ref_task_type')->max('id');
|
||||
$arrayTaskType = array(
|
||||
[
|
||||
// 'id' => $lastIdTaskType+1,
|
||||
'definition' => 'Teknologi Informasi',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id,
|
||||
],
|
||||
[
|
||||
// 'id' => $lastIdTaskType+2,
|
||||
'definition' => 'Bisnis',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id,
|
||||
],
|
||||
[
|
||||
// 'id' => $lastIdTaskType+3,
|
||||
'definition' => 'Operation',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id,
|
||||
],
|
||||
[
|
||||
// 'id' => $lastIdTaskType+4,
|
||||
'definition' => 'Satuan Pengendalian Intern',
|
||||
'is_active' => true,
|
||||
'company_id' => $company->id,
|
||||
],
|
||||
);
|
||||
|
||||
JenisTaskModel::insert($arrayTaskType);
|
||||
|
||||
$user = new User();
|
||||
$get_max = DB::table('master_user')->max('id');
|
||||
// $user->id = $get_max+1;
|
||||
$codeGenerate = str_pad($get_max+1, 5, 0, STR_PAD_LEFT);
|
||||
$userCode = 'adm_7'.$company->id.$codeGenerate;
|
||||
$user->user_crt_id = Auth::user()->id;
|
||||
$user->password = bcrypt('welcome1');
|
||||
$user->full_name = 'Administrator '. $company->company_name;
|
||||
$user->user_code = $userCode;
|
||||
$user->unit_id = 1;
|
||||
$user->is_active = true;
|
||||
$user->is_onholiday = false;
|
||||
$user->role_id = 6;
|
||||
$user->company_id = $company->id;
|
||||
$user->save();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//code...
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'rm' => 'sukses'
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
//throw $th;
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function company_get($id) {
|
||||
$data['data'] = DB::table('master_company')->where('id', $id)->first();
|
||||
$data['list_user'] = DB::table('master_user')->where('company_id', $id)->get();
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function client(Request $request) {
|
||||
$param['table'] = route('others.dataTable')."?type=client";
|
||||
// return view('home')->nest('child', 'content.others.client.index', $param);
|
||||
return $this->bsGetView('content.others.client.index', $param);
|
||||
}
|
||||
|
||||
public function client_store(Request $request) {
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
if($request->get_id) {
|
||||
$client = ClientModel::find($request->get_id);
|
||||
} else {
|
||||
$client = new ClientModel();
|
||||
}
|
||||
|
||||
if($request->hasFile('logo_url')){
|
||||
// $destination_path = public_path('gallery');
|
||||
// $image_path = public_path($client->logo_url);
|
||||
// if(File::exists($image_path)) {
|
||||
// File::delete($image_path);
|
||||
// }
|
||||
|
||||
$files = $request->file('logo_url');
|
||||
SpaceController::deleteFile($client->logo_url);
|
||||
$urlDoc = SpaceController::uploadFile($files, 'client', []);
|
||||
$client->logo_url = $urlDoc;
|
||||
|
||||
// $filename = 'Client_'.date('Ymd')."_".date('His').'.'.$files->getClientOriginalExtension();
|
||||
// $upload_success = $files->move($destination_path, $filename);
|
||||
}
|
||||
|
||||
$client->client_name = $request->client_name;
|
||||
$client->address = $request->address;
|
||||
$client->is_active = $request->is_active;
|
||||
$client->save();
|
||||
//code...
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'rm' => 'sukses'
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
//throw $th;
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function client_get($id) {
|
||||
$data['data'] = DB::table('master_client')->where('id', $id)->first();
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function user(Request $request) {
|
||||
$param['table'] = route('others.dataTable')."?type=user";
|
||||
// return view('home')->nest('child', 'content.others.user.index', $param);
|
||||
return $this->bsGetView('content.others.user.index', $param);
|
||||
}
|
||||
|
||||
public function user_store(Request $request) {
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
if($request->get_id) {
|
||||
$user = User::find($request->get_id);
|
||||
$user->user_upd_id = Auth::user()->id;
|
||||
} else {
|
||||
$user = new User();
|
||||
// $get_max = DB::table('master_user')->max('id');
|
||||
// $user->id = $get_max+1;
|
||||
$user->user_crt_id = Auth::user()->id;
|
||||
$user->password = bcrypt('welcome1');
|
||||
}
|
||||
|
||||
$user->email = $request->email;
|
||||
$user->full_name = $request->full_name;
|
||||
$user->user_code = $request->user_code;
|
||||
// $user->unit_id = $request->unit_id;
|
||||
$user->is_active = $request->is_active;
|
||||
// $user->is_onholiday = false;
|
||||
$user->role_id = $request->role_id;
|
||||
$user->division_id = $request->division_id;
|
||||
// $user->phone_number = $request->phone_number;
|
||||
// $user->company_id = Auth::user()->company_id;
|
||||
if($request->is_external) {
|
||||
$user->client_id = $request->client_id;
|
||||
}
|
||||
|
||||
if($request->hasFile('foto_profil')){
|
||||
// $destination_path = public_path('gallery');
|
||||
// $image_path = public_path($user->image_url);
|
||||
// if(File::exists($image_path)) {
|
||||
// File::delete($image_path);
|
||||
// }
|
||||
|
||||
SpaceController::deleteFile($user->image_url);
|
||||
$files = $request->file('foto_profil');
|
||||
$urlDoc = SpaceController::uploadFile($files, 'profile', []);
|
||||
|
||||
// $filename = 'User_'.date('Ymd')."_".date('His').'.'.$files->getClientOriginalExtension();
|
||||
// $upload_success = $files->move($destination_path, $filename);
|
||||
// $user->image_url = '/gallery/'.$filename;
|
||||
|
||||
$user->image_url = $urlDoc;
|
||||
}
|
||||
|
||||
$user->save();
|
||||
//code...
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'rm' => 'sukses'
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
//throw $th;
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function user_get($id) {
|
||||
$data = DB::table('master_user')->where('id', $id)->first();
|
||||
$data->image_url = SpaceController::getFile($data->image_url);
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function user_delete(Request $request) {
|
||||
$get_id = $request->input('id');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
//code...
|
||||
$user = User::find($get_id);
|
||||
SpaceController::deleteFile($user->image_url);
|
||||
|
||||
User::find($get_id)->delete();
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'data' => 'Data Berhasil Dihapus'
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function user_reset(Request $request) {
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
//code...
|
||||
$user = User::find(Auth::user()->id);
|
||||
$user->password = Hash::make('welcome1');
|
||||
$user->save();
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'data' => 'Data Berhasil Dihapus'
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function user_change(Request $request) {
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
//code...
|
||||
$user = User::find(Auth::user()->id);
|
||||
if(Hash::check($request->password, $user->password)) {
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'data' => 'Password tidak boleh sama dengan password existing'
|
||||
]);
|
||||
} else {
|
||||
$user->password = Hash::make($request->password);
|
||||
$user->save();
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'data' => 'Data Berhasil Dihapus'
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function user_change_pp(Request $request) {
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
//code...
|
||||
$user = User::find(Auth::user()->id);
|
||||
if($request->hasFile('foto_profil_change_pp')){
|
||||
SpaceController::deleteFile($user->image_url);
|
||||
|
||||
// $destination_path = public_path('gallery');
|
||||
// $image_path = public_path($user->image_url);
|
||||
// if(File::exists($image_path)) {
|
||||
// File::delete($image_path);
|
||||
// }
|
||||
|
||||
$files = $request->file('foto_profil_change_pp');
|
||||
$urlDoc = SpaceController::uploadFile($files, 'user', []);
|
||||
$user->image_url = $urlDoc;
|
||||
|
||||
// $filename = 'User_'.date('Ymd')."_".date('His').'.'.$files->getClientOriginalExtension();
|
||||
// $upload_success = $files->move($destination_path, $filename);
|
||||
// $user->image_url = '/gallery/'.$filename;
|
||||
}
|
||||
$user->full_name = $request->full_name_change;
|
||||
$user->user_code = $request->user_code_change;
|
||||
$user->phone_number = $request->phone_number_change;
|
||||
$user->save();
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'data' => 'Data Berhasil Dihapus'
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function data(Request $request) {
|
||||
$type = $request->get('type');
|
||||
$keyword = $request->get('keyword');
|
||||
switch ($type) {
|
||||
case 'mngTeam':
|
||||
# code...
|
||||
$dataTeam = DB::table('master_project as mp')
|
||||
->leftJoin('master_unit as mu','mu.id','=','mp.unit_owner_id')
|
||||
->leftJoin('master_company as mc','mc.id','=','mp.company_id')
|
||||
->leftJoin('master_team as mt','mt.team_code','=','mp.team_code')
|
||||
->leftJoin('master_user as muser','muser.id','=','mt.member_id')
|
||||
->leftJoin('ref_team_role as rtr', function($join) {
|
||||
$join->on('rtr.id','=','mt.team_role_id');
|
||||
$join->on('rtr.company_id','=','mt.company_id');
|
||||
})
|
||||
->select("mp.project_name","mp.project_code",DB::raw("(case when (mp.logo_url is not null) then mp.logo_url
|
||||
else mc.logo_url end) as logo_url"), "mu.unit_name", DB::raw("json_agg(json_build_object('team_role_id', rtr.id, 'nama', muser.full_name,'profil_pict', muser.image_url,'team_role', rtr.definition)) as list_team"),"mt.team_code")
|
||||
->where('mp.company_id', Auth::user()->company_id)
|
||||
->when ( !is_null($keyword), function ($query) use($keyword) {
|
||||
return $query->whereRaw("(LOWER(mp.project_name) LIKE '%" . strtolower($keyword) . "%' OR LOWER(mp.team_code) LIKE '%" . strtolower($keyword) . "%')");
|
||||
})
|
||||
->groupByRaw('mp.project_name, mp.project_code, mu.unit_name, mp.logo_url, mc.logo_url, mt.team_code, mp.id')
|
||||
->orderBy('mp.id', 'desc')
|
||||
->paginate(3);
|
||||
$param['team'] = $dataTeam;
|
||||
$param['paginateLinks'] = (string) $dataTeam->links();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'rc' => 200,
|
||||
'data' => $param
|
||||
]);
|
||||
}
|
||||
|
||||
public function dataTable(Request $request) {
|
||||
$type = $request->get('type');
|
||||
switch ($type) {
|
||||
case 'mngTeam':
|
||||
$data = DB::select("select mu.full_name, mu.image_url, mt.team_code, rtr.definition, mp.project_name, mt.is_active
|
||||
from master_team mt
|
||||
join master_project mp on mp.team_code = mt.team_code
|
||||
join master_user mu on mu.id = mt.member_id
|
||||
join ref_team_role rtr on rtr.id = mt.team_role_id and rtr.company_id = mp.company_id
|
||||
order by mt.team_code, mt.member_id");
|
||||
# code...
|
||||
break;
|
||||
case 'company':
|
||||
if(Auth::user()->role_id == 7) {
|
||||
$data = DB::select("select mc.*,
|
||||
(select user_code from master_user where company_id = mc.id and role_id = 6 order by id limit 1) as user_code
|
||||
from master_company mc");
|
||||
} else {
|
||||
$data = DB::select("select mc.*,
|
||||
(select user_code from master_user where company_id = mc.id and role_id = 6 order by id limit 1) as user_code
|
||||
from master_company mc where mc.id = ?",[Auth::user()->company_id]);
|
||||
}
|
||||
break;
|
||||
case 'user':
|
||||
if(Auth::user()->role_id==5) {
|
||||
$data = DB::select("select mu.*, rr.definition as role_name, mc.client_name, rd.definition as division_name
|
||||
from master_user mu
|
||||
join ref_role rr on rr.id = mu.role_id
|
||||
left join master_client mc on mc.id = mu.client_id
|
||||
left join ref_division rd on rd.id = mu.division_id
|
||||
where rr.is_external = true
|
||||
order by mu.id desc");
|
||||
} else {
|
||||
$data = DB::select("select mu.*, rr.definition as role_name, mc.client_name, rd.definition as division_name
|
||||
from master_user mu
|
||||
join ref_role rr on rr.id = mu.role_id
|
||||
left join master_client mc on mc.id = mu.client_id
|
||||
left join ref_division rd on rd.id = mu.division_id
|
||||
where rr.is_external = false
|
||||
order by mu.id desc");
|
||||
}
|
||||
break;
|
||||
case 'client':
|
||||
$data = DB::select("select * from master_client");
|
||||
break;
|
||||
}
|
||||
return DataTables::of($data)
|
||||
// ->addIndexColumn()
|
||||
->addColumn('member_name',function($data) use ($type) {
|
||||
if($type=='mngTeam') {
|
||||
$image_url = asset('assets/media/logos/no_img.png');
|
||||
if($data->image_url) {
|
||||
// $image_url = $data->image_url;
|
||||
$image_url = SpaceController::getFile($data->image_url);
|
||||
}
|
||||
return '
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="symbol symbol-50 flex-shrink-0 mr-4">
|
||||
<div class="symbol-label" style="background-image: url(\''.$image_url.'\'); background-size: cover; background-repeat: no-repeat;"></div>
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" class="text-dark-75 font-weight-bolder text-hover-primary mb-1 font-size-lg">'.$data->full_name.'</a>
|
||||
<span class="text-muted font-weight-bold d-block">'.$data->definition.'</span>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
} else if($type == 'company') {
|
||||
$logo_url = asset('assets/media/logos/no_img.png');
|
||||
if($data->logo_url) {
|
||||
// $logo_url = $data->logo_url;
|
||||
$image_url = SpaceController::getFile($data->logo_url);
|
||||
}
|
||||
return '
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="symbol symbol-50 flex-shrink-0 mr-4">
|
||||
<div class="symbol-label" style="background-image: url(\''.$logo_url.'\'); background-size: cover; background-repeat: no-repeat;"></div>
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" onclick="detail('.$data->id.')" class="text-dark-75 font-weight-bolder text-hover-primary mb-1 font-size-lg">'.$data->company_name.'</a>
|
||||
<span class="text-muted font-weight-bold d-block">'.$data->company_code.'</span>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
} else if($type == 'user') {
|
||||
$image_url = asset('assets/media/logos/no_img.png');
|
||||
if($data->image_url) {
|
||||
// $image_url = $data->image_url;
|
||||
$image_url = SpaceController::getFile($data->image_url);
|
||||
}
|
||||
return '
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="symbol symbol-50 flex-shrink-0 mr-4">
|
||||
<div class="symbol-label" style="background-image: url(\''.$image_url.'\'); background-size: cover; background-repeat: no-repeat;"></div>
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" class="text-dark-75 font-weight-bolder text-hover-primary mb-1 font-size-lg">'.$data->user_code.'</a>
|
||||
<span class="text-muted font-weight-bold d-block">'.$data->full_name.'</span>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
} else if($type == 'client') {
|
||||
$logo_url = asset('assets/media/logos/no_img.png');
|
||||
if($data->logo_url) {
|
||||
// $logo_url = $data->logo_url;
|
||||
$logo_url = SpaceController::getFile($data->logo_url);
|
||||
}
|
||||
return '
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="symbol symbol-50 flex-shrink-0 mr-4">
|
||||
<div class="symbol-label" style="background-image: url(\''.$logo_url.'\'); background-size: cover; background-repeat: no-repeat;"></div>
|
||||
</div>
|
||||
<div>
|
||||
<a href="#" onclick="detail('.$data->id.')" class="text-dark-75 font-weight-bolder text-hover-primary mb-1 font-size-lg">'.$data->client_name.'</a>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
})
|
||||
->editColumn('division_name', function($data) use($type) {
|
||||
if($type=='user') {
|
||||
return $data->division_name?$data->division_name:'-';
|
||||
}
|
||||
})
|
||||
->editColumn('is_active', function($data) use ($type) {
|
||||
if($type=='mngTeam' || $type=='user' || $type=='client') {
|
||||
return $data->is_active?'Aktif':'Non Aktif';
|
||||
}
|
||||
})
|
||||
->addColumn('action', function ($data) use ($type, $request) {
|
||||
$btn = '';
|
||||
if($type=='user') {
|
||||
$btn .= ' <li class="navi-item">
|
||||
<a onclick="edit(`'.$data->id.'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-edit"></i></span>
|
||||
<span class="navi-text">Edit</span>
|
||||
</a>
|
||||
</li>';
|
||||
$btn .= ' <li class="navi-item">
|
||||
<a onclick="hapus(`'.$data->id.'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-trash"></i></span>
|
||||
<span class="navi-text">Hapus</span>
|
||||
</a>
|
||||
</li>';
|
||||
} else if($type=='company') {
|
||||
$btn .= ' <li class="navi-item">
|
||||
<a onclick="edit(`'.$data->id.'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-edit"></i></span>
|
||||
<span class="navi-text">Edit</span>
|
||||
</a>
|
||||
</li>';
|
||||
$btn .= ' <li class="navi-item">
|
||||
<a onclick="detail(`'.$data->id.'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-layer-group"></i></span>
|
||||
<span class="navi-text">Detail</span>
|
||||
</a>
|
||||
</li>';
|
||||
} else if($type=='client') {
|
||||
$btn .= ' <li class="navi-item">
|
||||
<a onclick="edit(`'.$data->id.'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-edit"></i></span>
|
||||
<span class="navi-text">Edit</span>
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
/* $btn .= ' <li class="navi-item">
|
||||
<a onclick="kembalikan(`'.$data->id.'`,`'.$data->postal.'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-undo"></i></span>
|
||||
<span class="navi-text">Kembalikan Laporan (Undo)</span>
|
||||
</a>
|
||||
</li>'; */
|
||||
|
||||
return '
|
||||
<div class="dropdown dropdown-inline">
|
||||
<a href="javascript:;" class="btn btn-sm btn-clean btn-icon mr-2" data-toggle="dropdown">
|
||||
<span class="svg-icon svg-icon-md">
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
|
||||
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<rect x="0" y="0" width="24" height="24"/>
|
||||
<path d="M5,8.6862915 L5,5 L8.6862915,5 L11.5857864,2.10050506 L14.4852814,5 L19,5 L19,9.51471863 L21.4852814,12 L19,14.4852814 L19,19 L14.4852814,19 L11.5857864,21.8994949 L8.6862915,19 L5,19 L5,15.3137085 L1.6862915,12 L5,8.6862915 Z M12,15 C13.6568542,15 15,13.6568542 15,12 C15,10.3431458 13.6568542,9 12,9 C10.3431458,9 9,10.3431458 9,12 C9,13.6568542 10.3431458,15 12,15 Z" fill="#000000"/>
|
||||
</g>
|
||||
</svg>
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-sm dropdown-menu-right" style="z-index:9999;">
|
||||
<ul class="navi flex-column navi-hover py-2">
|
||||
<li class="navi-header font-weight-bolder text-uppercase font-size-xs text-primary pb-2">
|
||||
Choose an action:
|
||||
</li>
|
||||
'.$btn.'
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
})
|
||||
->rawColumns(['action','member_name'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
395
app/Http/Controllers/RefController.php
Normal file
395
app/Http/Controllers/RefController.php
Normal file
@ -0,0 +1,395 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\ModelingTaskModel;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RefController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
||||
public function getInit($request,$route)
|
||||
{
|
||||
$modelName = '\\App\Models\\'.$route.'Model';
|
||||
$model = new $modelName;
|
||||
$data = $model->initData($request,$route);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
//INIT
|
||||
$init = $this->getInit($request,$request->get('type'));
|
||||
$route = $init['route'];
|
||||
$param['title'] = $init['title'];
|
||||
$param['tableHead'] = $init['tableHead'];
|
||||
$param['head'] = $init['head'];
|
||||
$param['detail'] = empty($init['detail'])?false:true;
|
||||
if (isset($init['headAlias'])) {
|
||||
$param['headAlias'] = $init['headAlias'];
|
||||
}else{
|
||||
$param['headAlias'] = null;
|
||||
}
|
||||
$param['bisaAdd'] = $init['bisaAdd'];
|
||||
$param['adaDetail'] = $init['adaDetail'];
|
||||
|
||||
|
||||
$view = 'content.ref.index';
|
||||
//END INIT
|
||||
|
||||
$param['table'] = route('ref.data')."?type=".$route;
|
||||
$param['delete'] = route('ref.delete')."?type=".$route;
|
||||
$param['edit'] = route('ref.edit')."?type=".$route;
|
||||
$param['store'] = route('ref.store')."?type=".$route;
|
||||
$param['storeCustom'] = route('ref.storeCustom')."?type=".$route;
|
||||
// $param['setActive'] = route('ref.setActive')."?type=".$route;
|
||||
|
||||
$param['vForm'] = 'content.ref.'.$route.'.form';
|
||||
$param['vAction'] = 'content.ref.'.$route.'.action';
|
||||
$param['vFormDet'] = 'content.ref.'.$route.'.formDet';
|
||||
$param['init'] = $init;
|
||||
|
||||
// return view('home')->nest('child',$view, $param);
|
||||
return $this->bsGetView($view, $param);
|
||||
}
|
||||
|
||||
public function data(Request $request)
|
||||
{
|
||||
$init = $this->getInit($request,$request->get('type'));
|
||||
$data = $init['data_table'];
|
||||
|
||||
$modelName = '\\App\Models\\'.$init['route'].'Model';
|
||||
$model = new $modelName;
|
||||
$dt = $model->getDT($data,$init);
|
||||
|
||||
$dt->addColumn('action', function ($data) use($init) {
|
||||
if(is_array($init['db_key'])) {
|
||||
if(count($init['db_key'])>1) {
|
||||
$keyCustom = '';
|
||||
foreach($init['db_key'] as $i => $dbKey) {
|
||||
if(($i+1)==count($init['db_key'])) {
|
||||
$keyCustom.= $data->{$dbKey};
|
||||
} else {
|
||||
$keyCustom.= $data->{$dbKey}.'|';
|
||||
}
|
||||
}
|
||||
$param['id_key'] = $keyCustom;
|
||||
}
|
||||
} else {
|
||||
$param['id_key'] = $data->{$init['db_key']};
|
||||
}
|
||||
$param['data'] = $data;
|
||||
//SET BUTTON
|
||||
return $this->getButtonAction($init['actButton'],$param);
|
||||
});
|
||||
|
||||
$dt->rawColumns(['is_active','created_at','updated_at','action']);
|
||||
return $dt->make(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
//GET INIT
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
//code...
|
||||
$init = $this->getInit($request,$request->get('type'));
|
||||
$get_id = $request->input('get_id');
|
||||
$setField = $init['set_field'];
|
||||
$timestamps = $init['timestamps'];
|
||||
|
||||
//IF EDIT DATA
|
||||
if ($get_id) {
|
||||
if ($timestamps) {
|
||||
$setField['updated_at'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
if(is_array($init['db_key'])) {
|
||||
if(count($init['db_key'])>1) {
|
||||
$data = DB::table($init['db'])->where(function($query) use ($request, $init, $get_id) {
|
||||
$primaryKey = explode('|',$get_id);
|
||||
foreach($init['db_key'] as $k => $i) {
|
||||
$query->where($i, $primaryKey[$k]);
|
||||
}
|
||||
})->update($setField);
|
||||
}
|
||||
} else {
|
||||
DB::table($init['db'])->where($init['db_key'], $get_id)->update($setField);
|
||||
}
|
||||
//IF ADD DATA
|
||||
}else {
|
||||
if ($timestamps) {
|
||||
$setField['created_at'] = date('Y-m-d H:i:s');
|
||||
$setField['updated_at'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
if ($init['serial']===false) {
|
||||
$getId = DB::table($init['db'])->max('id');
|
||||
$setField['id'] = $getId+1;
|
||||
}
|
||||
|
||||
if ($init['seq']) {
|
||||
$seq = DB::Table($init['db'])->max('seq');
|
||||
$setField['seq'] = $seq+1;
|
||||
}
|
||||
DB::table($init['db'])->insert($setField);
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'rm' => "Berhasil"
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
//throw $th;
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function storeCustom(Request $request)
|
||||
{
|
||||
$init = $this->getInit($request,$request->get('type'));
|
||||
$modelName = '\\App\Models\\'.$init['route'].'Model';
|
||||
$model = new $modelName;
|
||||
return $model->storeCustom($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Request $request)
|
||||
{
|
||||
//
|
||||
$init = $this->getInit($request,$request->get('type'));
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'data' => $init['get_data_edit']
|
||||
]);
|
||||
}
|
||||
|
||||
public function delete(Request $request)
|
||||
{
|
||||
$init = $this->getInit($request,$request->get('type'));
|
||||
$get_id = $request->input('id');
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
//code...
|
||||
if(is_array($init['db_key'])) {
|
||||
if(count($init['db_key'])>1) {
|
||||
$data = DB::table($init['db'])->where(function($query) use ($request, $init, $get_id) {
|
||||
$primaryKey = explode('|',$get_id);
|
||||
foreach($init['db_key'] as $k => $i) {
|
||||
$query->where($i, $primaryKey[$k]);
|
||||
}
|
||||
})->delete();
|
||||
}
|
||||
} else {
|
||||
if($request->get('type')=='Model') {
|
||||
ModelingTaskModel::where('model_id', $get_id)->delete();
|
||||
}
|
||||
|
||||
DB::table($init['db'])->where($init['db_key'], $get_id)->delete();
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'rm' => 'Data Berhasil Dihapus'
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
DB::rollBack();
|
||||
if($e->getCode()=='23503') {
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'rm' => 'Data Tidak Dapat Dihapus Karena Memiliki Relasi Dengan Data Lain!'
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'rm' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
} catch (QueryException $e) {
|
||||
DB::rollBack();
|
||||
if($e->getCode()=='23503') {
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'rm' => 'Data Tidak Dapat Dihapus Karena Memiliki Relasi Dengan Data Lain!'
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'rm' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function getButtonAction($typeButton,$param)
|
||||
{
|
||||
$editBtn ="";
|
||||
$detailBtn ="";
|
||||
$ActiveBtn = "";
|
||||
$mapsBtn = "";
|
||||
$hapusBtn = "";
|
||||
|
||||
//MAP BUTTON
|
||||
if ( in_array("maps", $typeButton)) {
|
||||
$mapsBtn = ' <li class="navi-item">
|
||||
<a class="navi-link popup-gmaps" href="https://maps.google.com/maps?q='.$param['data']->latitude.','.$param['data']->longitude.'&hl=es&z=10&output=embed">
|
||||
<span class="navi-icon"><i class="fa fa-map-marker"></i></span>
|
||||
<span class="navi-text"> Lihat Lokasi</span>
|
||||
</a>
|
||||
</li>
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
// DETAIL BUTTON
|
||||
if ( in_array("detail", $typeButton)) {
|
||||
$detailBtn = '<li class="navi-item">
|
||||
<a onclick="detail(`'.$param['id_key'].'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-arrows-alt"></i></span>
|
||||
<span class="navi-text"> Detail</span>
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
|
||||
// EDIT BUTTON
|
||||
if (in_array("edit", $typeButton)) {
|
||||
$editBtn = ' <li class="navi-item">
|
||||
<a onclick="edit(`'.$param['id_key'].'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-edit"></i></span>
|
||||
<span class="navi-text"> Edit</span>
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
|
||||
// HAPUS BUTTON
|
||||
if (in_array("hapus", $typeButton)) {
|
||||
$hapusBtn = '<li class="navi-item">
|
||||
<a onclick="hapus(`'.$param['id_key'].'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-trash"></i></span>
|
||||
<span class="navi-text"> Hapus</span>
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
|
||||
// ACTIVE BUTTON
|
||||
if (in_array("active", $typeButton)) {
|
||||
if ($param['data']->is_active == 't') {
|
||||
$ActiveBtn = '
|
||||
<li class="navi-item">
|
||||
<a onclick="setActive(`'.$param['id_key'].'`,`'.$param['data']->is_active.'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-times-circle-o"></i> </span>
|
||||
<span class="navi-text">Deactived</span>
|
||||
</a>
|
||||
</li>';
|
||||
}else{
|
||||
$ActiveBtn = '
|
||||
<li class="navi-item">
|
||||
<a onclick="setActive(`'.$param['id_key'].'`,`'.$param['data']->is_active.'`)" href="#" class="navi-link">
|
||||
<span class="navi-icon"><i class="la la-check-circle-o"></i> </span>
|
||||
<span class="navi-text">Active</span>
|
||||
</a>
|
||||
</li>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$resultBtn = $editBtn.$ActiveBtn.$detailBtn.$mapsBtn.$hapusBtn;
|
||||
|
||||
return '
|
||||
<div class="dropdown dropdown-inline">
|
||||
<a href="javascript:;" class="btn btn-sm btn-clean btn-icon mr-2" data-toggle="dropdown">
|
||||
<span class="svg-icon svg-icon-md">
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
|
||||
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<rect x="0" y="0" width="24" height="24"/>
|
||||
<path d="M5,8.6862915 L5,5 L8.6862915,5 L11.5857864,2.10050506 L14.4852814,5 L19,5 L19,9.51471863 L21.4852814,12 L19,14.4852814 L19,19 L14.4852814,19 L11.5857864,21.8994949 L8.6862915,19 L5,19 L5,15.3137085 L1.6862915,12 L5,8.6862915 Z M12,15 C13.6568542,15 15,13.6568542 15,12 C15,10.3431458 13.6568542,9 12,9 C10.3431458,9 9,10.3431458 9,12 C9,13.6568542 10.3431458,15 12,15 Z" fill="#000000"/>
|
||||
</g>
|
||||
</svg>
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-sm dropdown-menu-right">
|
||||
<ul class="navi flex-column navi-hover py-2">
|
||||
<li class="navi-header font-weight-bolder text-uppercase font-size-xs text-primary pb-2">
|
||||
Choose an action:
|
||||
</li>
|
||||
'.$resultBtn.'
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
}
|
83
app/Http/Controllers/SpaceController.php
Normal file
83
app/Http/Controllers/SpaceController.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Storage;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SpaceController extends Controller
|
||||
{
|
||||
//
|
||||
public static function getEnv()
|
||||
{
|
||||
$env = env('APP_ENV', 'development');
|
||||
return ( $env == 'development' || $env == 'local' ) ? 'dev' : 'prod';
|
||||
}
|
||||
|
||||
public static function uploadFile($file, $processName, $data)
|
||||
{
|
||||
$ext = $file->getClientOriginalExtension();
|
||||
$typeFile = self::getEnv();
|
||||
|
||||
switch ( $processName ) {
|
||||
case 'dokumen' :
|
||||
$fileName = 'Dokumen_'.date('Ymd')."_".date('His').'.'.$ext;
|
||||
Storage::putFileAs($typeFile . '/dokumen', $file, $fileName);
|
||||
$disk = '/dokumen/' . $fileName;
|
||||
break;
|
||||
case 'meeting':
|
||||
$fileName = 'dok_'.date('Ymd')."_".date('His').'.'.$ext;
|
||||
Storage::putFileAs($typeFile . '/dokumen', $file, $fileName);
|
||||
$disk = '/dok_meeting/' . $fileName;
|
||||
break;
|
||||
case 'logo':
|
||||
$fileName = 'Logo_'.date('Ymd')."_".date('His').'.'.$ext;
|
||||
Storage::putFileAs($typeFile . '/gallery', $file, $fileName);
|
||||
$disk = '/gallery/' . $fileName;
|
||||
break;
|
||||
case 'profile':
|
||||
$fileName = 'User_'.date('Ymd')."_".date('His').'.'.$ext;
|
||||
Storage::putFileAs($typeFile . '/gallery', $file, $fileName);
|
||||
$disk = '/gallery/' . $fileName;
|
||||
break;
|
||||
case 'client':
|
||||
$fileName = 'Client_'.date('Ymd')."_".date('His').'.'.$ext;
|
||||
Storage::putFileAs($typeFile . '/gallery', $file, $fileName);
|
||||
$disk = '/gallery/' . $fileName;
|
||||
break;
|
||||
case 'user':
|
||||
$fileName = 'User_'.date('Ymd')."_".date('His').'.'.$ext;
|
||||
Storage::putFileAs($typeFile . '/gallery', $file, $fileName);
|
||||
$disk = '/gallery/' . $fileName;
|
||||
break;
|
||||
}
|
||||
return $disk;
|
||||
}
|
||||
|
||||
public static function checkFileIfExists($urlDoc)
|
||||
{
|
||||
$typeFile = self::getEnv();
|
||||
return Storage::exists($typeFile . $urlDoc);
|
||||
}
|
||||
|
||||
public static function deleteFile($urlDoc)
|
||||
{
|
||||
if (self::checkFileIfExists($urlDoc)) {
|
||||
$typeFile = self::getEnv();
|
||||
Storage::delete($typeFile . $urlDoc);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getFile($urlDoc, $expiredTime = null)
|
||||
{
|
||||
$typeFile = self::getEnv();
|
||||
$expiredTime = is_null($expiredTime) ? now()->addDay(1) : $expiredTime;
|
||||
return Storage::temporaryUrl($typeFile . $urlDoc, $expiredTime);
|
||||
}
|
||||
|
||||
public static function downloadFile($urlDoc)
|
||||
{
|
||||
$typeFile = self::getEnv();
|
||||
return Storage::download($typeFile . $urlDoc);
|
||||
}
|
||||
}
|
69
app/Http/Kernel.php
Normal file
69
app/Http/Kernel.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?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
|
||||
*/
|
||||
protected $middleware = [
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\CheckForMaintenanceMode::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
\App\Http\Middleware\RevalidateBackHistory::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
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,
|
||||
\App\Http\Middleware\SessionExpired::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'throttle:60,1',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::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,
|
||||
'revalidate' => \App\Http\Middleware\RevalidateBackHistory::class,
|
||||
];
|
||||
}
|
21
app/Http/Middleware/Authenticate.php
Normal file
21
app/Http/Middleware/Authenticate.php
Normal file
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
17
app/Http/Middleware/CheckForMaintenanceMode.php
Normal file
17
app/Http/Middleware/CheckForMaintenanceMode.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
|
||||
|
||||
class CheckForMaintenanceMode extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
17
app/Http/Middleware/EncryptCookies.php
Normal file
17
app/Http/Middleware/EncryptCookies.php
Normal file
@ -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
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
27
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
27
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
26
app/Http/Middleware/RevalidateBackHistory.php
Normal file
26
app/Http/Middleware/RevalidateBackHistory.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class RevalidateBackHistory
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$response = $next($request);
|
||||
|
||||
$response->headers->set('Access-Control-Allow-Origin' , '*');
|
||||
$response->headers->set('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT, DELETE');
|
||||
$response->headers->set('Access-Control-Allow-Headers', 'Content-Type, Accept, Authorization, X-Requested-With, Application');
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
42
app/Http/Middleware/SessionExpired.php
Normal file
42
app/Http/Middleware/SessionExpired.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Session\Store;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Session;
|
||||
|
||||
class SessionExpired
|
||||
{
|
||||
protected $session;
|
||||
protected $timeout = 1200;
|
||||
public function __construct(Store $session){
|
||||
$this->session = $session;
|
||||
}
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$isLoggedIn = $request->path() != 'login';
|
||||
if(! session('lastActivityTime'))
|
||||
$this->session->put('lastActivityTime', time());
|
||||
elseif(time() - $this->session->get('lastActivityTime') > $this->timeout){
|
||||
$this->session->forget('lastActivityTime');
|
||||
$cookie = cookie('intend', $isLoggedIn ? url()->current() : 'home');
|
||||
// auth()->logout();
|
||||
Auth::logout();
|
||||
return Redirect::route('login');
|
||||
}
|
||||
$isLoggedIn ? $this->session->put('lastActivityTime', time()) : $this->session->forget('lastActivityTime');
|
||||
return $next($request);
|
||||
}
|
||||
}
|
18
app/Http/Middleware/TrimStrings.php
Normal file
18
app/Http/Middleware/TrimStrings.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?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
|
||||
*/
|
||||
protected $except = [
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
23
app/Http/Middleware/TrustProxies.php
Normal file
23
app/Http/Middleware/TrustProxies.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array|string
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
}
|
18
app/Http/Middleware/VerifyCsrfToken.php
Normal file
18
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?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
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
'/logout'
|
||||
];
|
||||
}
|
37
app/Mail/ReportMail.php
Normal file
37
app/Mail/ReportMail.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ReportMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
//
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
// return $this->view('view.name');
|
||||
$param['data'] = $this->data;
|
||||
// dd($param);exit();
|
||||
return $this->subject('Laporan '.$this->data['ticket'])->view('content.email.balascomment', $param);
|
||||
}
|
||||
}
|
13
app/Models/BudgetRealModel.php
Normal file
13
app/Models/BudgetRealModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BudgetRealModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_budget_real';
|
||||
public $timestamps = false;
|
||||
}
|
83
app/Models/BudgetTypeModel.php
Normal file
83
app/Models/BudgetTypeModel.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class BudgetTypeModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = ['id', 'company_id'];
|
||||
protected $table = 'ref_budget_type';
|
||||
public $timestamps = false;
|
||||
|
||||
public function initData($request,$route)
|
||||
{
|
||||
// INIT DB
|
||||
$data['title'] = 'Referensi Budget Type';
|
||||
$data['actButton'] = ['edit','hapus'];
|
||||
$data['tableHead'] =
|
||||
array(
|
||||
["Nama Jenis Task","all","definition"],
|
||||
["Trans Type","all","tx_type"],
|
||||
["Nama Perusahaan","all","company_name"],
|
||||
["Act","all","action"]
|
||||
);
|
||||
|
||||
$data['db'] = $this->table;
|
||||
$data['db_key'] = $this->primaryKey;
|
||||
$data['route'] = $route;
|
||||
$data['timestamps'] = false;
|
||||
|
||||
$data['bisaAdd'] = false;
|
||||
$data['adaDetail'] = false;
|
||||
$data['idManual'] = true;
|
||||
$data['seq'] = false;
|
||||
$data['serial'] = false;
|
||||
|
||||
|
||||
$dtable = DB::select("SELECT {$this->table}.*, mc.company_name FROM {$this->table} JOIN master_company mc ON mc.id = {$this->table}.company_id
|
||||
WHERE {$this->table}.company_id = ?
|
||||
order by {$this->table}.id desc", [Auth::user()->company_id]);
|
||||
|
||||
|
||||
// LIST DATA TABLE
|
||||
$data['data_table'] = $dtable;
|
||||
|
||||
// FORM FIELD FOR STORE
|
||||
$data['set_field'] = [
|
||||
'definition' => $request->post('definition'),
|
||||
'is_shown' => $request->post('is_shown'),
|
||||
'tx_type' => $request->post('tx_type'),
|
||||
'operator' => $request->post('operator'),
|
||||
'rev_operator' => $request->post('rev_operator'),
|
||||
'is_active' => $request->post('is_active'),
|
||||
'company_id' => Auth::user()->company_id,
|
||||
];
|
||||
|
||||
// GET DATA FOR EDIT
|
||||
if ($request->post('id')) {
|
||||
$multPrim = explode('|', $request->post('id'));
|
||||
$data['get_data_edit'] = DB::selectOne("SELECT * FROM {$this->table} where id = ? and company_id = ?",[$multPrim[0], $multPrim[1]]);
|
||||
}
|
||||
|
||||
foreach($data['tableHead'] as $v){
|
||||
$arrHead[] = $v[2];
|
||||
}
|
||||
$data['head'] = implode(",",$arrHead);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDT($data,$init)
|
||||
{
|
||||
$dt = DataTables::of($data);
|
||||
$dt->editColumn('is_active', function($data) {
|
||||
return $data->is_active?'Aktif':'Non Aktif';
|
||||
});
|
||||
return $dt;
|
||||
}
|
||||
}
|
13
app/Models/ClientModel.php
Normal file
13
app/Models/ClientModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ClientModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_client';
|
||||
public $timestamps = false;
|
||||
}
|
13
app/Models/CompanyModel.php
Normal file
13
app/Models/CompanyModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CompanyModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_company';
|
||||
public $timestamps = true;
|
||||
}
|
79
app/Models/CriticalLevelModel.php
Normal file
79
app/Models/CriticalLevelModel.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class CriticalLevelModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = ['id', 'company_id'];
|
||||
protected $table = 'ref_critical_level';
|
||||
public $timestamps = false;
|
||||
|
||||
public function initData($request,$route)
|
||||
{
|
||||
// INIT DB
|
||||
$data['title'] = 'Referensi Critical Level';
|
||||
$data['actButton'] = ['edit','hapus'];
|
||||
$data['tableHead'] =
|
||||
array(
|
||||
["Critical Level","all","definition"],
|
||||
["Bobot","all","bobot"],
|
||||
["Status Aktif","all","is_active"],
|
||||
["Nama Perusahaan","all","company_name"],
|
||||
["Act","all","action"]
|
||||
);
|
||||
|
||||
$data['db'] = $this->table;
|
||||
$data['db_key'] = $this->primaryKey;
|
||||
$data['route'] = $route;
|
||||
$data['timestamps'] = false;
|
||||
$data['bisaAdd'] = false;
|
||||
$data['adaDetail'] = false;
|
||||
$data['idManual'] = true;
|
||||
$data['seq'] = false;
|
||||
$data['serial'] = false;
|
||||
|
||||
|
||||
$dtable = DB::select("SELECT {$this->table}.*, mc.company_name FROM {$this->table} JOIN master_company mc ON mc.id = {$this->table}.company_id
|
||||
where {$this->table}.company_id = ? order by {$this->table}.id desc", [Auth::user()->company_id]);
|
||||
|
||||
|
||||
// LIST DATA TABLE
|
||||
$data['data_table'] = $dtable;
|
||||
|
||||
// FORM FIELD FOR STORE
|
||||
$data['set_field'] = [
|
||||
'definition' => $request->post('definition'),
|
||||
'bobot' => $request->post('bobot'),
|
||||
'company_id' => Auth::user()->company_id,
|
||||
'is_active' => $request->post('is_active')
|
||||
];
|
||||
|
||||
// GET DATA FOR EDIT
|
||||
if ($request->post('id')) {
|
||||
$multPrim = explode('|', $request->post('id'));
|
||||
$data['get_data_edit'] = DB::selectOne("SELECT * FROM {$this->table} where id = ? and company_id = ?",[$multPrim[0], $multPrim[1]]);
|
||||
}
|
||||
|
||||
foreach($data['tableHead'] as $v){
|
||||
$arrHead[] = $v[2];
|
||||
}
|
||||
$data['head'] = implode(",",$arrHead);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDT($data,$init)
|
||||
{
|
||||
$dt = DataTables::of($data);
|
||||
$dt->editColumn('is_active', function($data) {
|
||||
return $data->is_active?'Aktif':'Non Aktif';
|
||||
});
|
||||
return $dt;
|
||||
}
|
||||
}
|
75
app/Models/JenisTaskModel.php
Normal file
75
app/Models/JenisTaskModel.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class JenisTaskModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'ref_task_type';
|
||||
public $timestamps = false;
|
||||
|
||||
public function initData($request,$route)
|
||||
{
|
||||
// INIT DB
|
||||
$data['title'] = 'Referensi Jenis Task';
|
||||
$data['actButton'] = ['edit','hapus'];
|
||||
$data['tableHead'] =
|
||||
array(
|
||||
["Nama Jenis Task","all","definition"],
|
||||
["Status Aktif","all","is_active"],
|
||||
["Nama Perusahaan","all","company_name"],
|
||||
["Act","all","action"]
|
||||
);
|
||||
|
||||
$data['db'] = $this->table;
|
||||
$data['db_key'] = $this->primaryKey;
|
||||
$data['route'] = $route;
|
||||
$data['timestamps'] = false;
|
||||
|
||||
$data['bisaAdd'] = true;
|
||||
$data['adaDetail'] = false;
|
||||
$data['idManual'] = true;
|
||||
$data['seq'] = false;
|
||||
$data['serial'] = true;
|
||||
|
||||
$dtable = DB::select("SELECT {$this->table}.*, mc.company_name FROM {$this->table} JOIN master_company mc ON mc.id = {$this->table}.company_id WHERE {$this->table}.company_id = ? order by {$this->table}.id desc",[Auth::user()->company_id]);
|
||||
|
||||
|
||||
// LIST DATA TABLE
|
||||
$data['data_table'] = $dtable;
|
||||
|
||||
// FORM FIELD FOR STORE
|
||||
$data['set_field'] = [
|
||||
'definition' => $request->post('definition'),
|
||||
'company_id' => Auth::user()->company_id,
|
||||
'is_active' => $request->post('is_active')
|
||||
];
|
||||
|
||||
// GET DATA FOR EDIT
|
||||
if ($request->post('id')) {
|
||||
$data['get_data_edit'] = DB::selectOne("SELECT * FROM {$this->table} where id = ?",[$request->post('id')]);
|
||||
}
|
||||
|
||||
foreach($data['tableHead'] as $v){
|
||||
$arrHead[] = $v[2];
|
||||
}
|
||||
$data['head'] = implode(",",$arrHead);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDT($data,$init)
|
||||
{
|
||||
$dt = DataTables::of($data);
|
||||
$dt->editColumn('is_active', function($data) {
|
||||
return $data->is_active?'Aktif':'Non Aktif';
|
||||
});
|
||||
return $dt;
|
||||
}
|
||||
}
|
13
app/Models/MeetingModel.php
Normal file
13
app/Models/MeetingModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MeetingModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_meeting';
|
||||
public $timestamps = true;
|
||||
}
|
13
app/Models/MeetingParticipantModel.php
Normal file
13
app/Models/MeetingParticipantModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MeetingParticipantModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_meeting_participant';
|
||||
public $timestamps = true;
|
||||
}
|
178
app/Models/ModelModel.php
Normal file
178
app/Models/ModelModel.php
Normal file
@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class ModelModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_model';
|
||||
public $timestamps = true;
|
||||
|
||||
public function initData($request,$route)
|
||||
{
|
||||
// INIT DB
|
||||
$data['title'] = 'Referensi Model';
|
||||
$data['actButton'] = ['edit','hapus'];
|
||||
$data['tableHead'] =
|
||||
array(
|
||||
["Nama Model","all","description"],
|
||||
["Status Aktif","all","is_active"],
|
||||
["Nama Perusahaan","all","company_name"],
|
||||
["Act","all","action"]
|
||||
);
|
||||
|
||||
$data['db'] = $this->table;
|
||||
$data['db_key'] = $this->primaryKey;
|
||||
$data['route'] = $route;
|
||||
$data['timestamps'] = true;
|
||||
|
||||
$data['bisaAdd'] = true;
|
||||
$data['adaDetail'] = false;
|
||||
$data['idManual'] = true;
|
||||
$data['seq'] = false;
|
||||
$data['serial'] = true;
|
||||
|
||||
|
||||
$dtable = DB::select("SELECT {$this->table}.*, mc.company_name FROM {$this->table}
|
||||
JOIN master_company mc ON mc.id = {$this->table}.company_id
|
||||
WHERE {$this->table}.company_id = ?
|
||||
order by {$this->table}.id desc",[Auth::user()->company_id]);
|
||||
|
||||
|
||||
// LIST DATA TABLE
|
||||
$data['data_table'] = $dtable;
|
||||
|
||||
// FORM FIELD FOR STORE
|
||||
if($request->post('get_id')) {
|
||||
$data['set_field'] = [
|
||||
'description' => $request->post('description'),
|
||||
'user_upd_id' => Auth::user()->id,
|
||||
'company_id' => Auth::user()->company_id,
|
||||
'is_active' => $request->post('is_active')
|
||||
];
|
||||
} else {
|
||||
$data['set_field'] = [
|
||||
'description' => $request->post('description'),
|
||||
'user_crt_id' => Auth::user()->id,
|
||||
'company_id' => Auth::user()->company_id,
|
||||
'is_active' => $request->post('is_active')
|
||||
];
|
||||
}
|
||||
|
||||
// GET DATA FOR EDIT
|
||||
if ($request->post('id')) {
|
||||
$data['get_data_edit']['head'] = DB::selectOne("SELECT * FROM {$this->table} where id = ?",[$request->post('id')]);
|
||||
$data['get_data_edit']['detail'] = ModelingTaskModel::where('model_id', $request->post('id'))->get();
|
||||
}
|
||||
|
||||
foreach($data['tableHead'] as $v){
|
||||
$arrHead[] = $v[2];
|
||||
}
|
||||
$data['head'] = implode(",",$arrHead);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDT($data,$init)
|
||||
{
|
||||
$dt = DataTables::of($data);
|
||||
$dt->editColumn('is_active', function($data) {
|
||||
return $data->is_active?'Aktif':'Non Aktif';
|
||||
});
|
||||
return $dt;
|
||||
}
|
||||
|
||||
public function storeCustom($request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$init = $this->initData($request,$request->get('type'));
|
||||
$get_id = $request->input('get_id');
|
||||
$setField = $init['set_field'];
|
||||
$timestamps = $init['timestamps'];
|
||||
|
||||
if ($get_id) {
|
||||
if ($timestamps) {
|
||||
$setField['updated_at'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
DB::table($init['db'])->where($init['db_key'], $get_id)->update($setField);
|
||||
ModelingTaskModel::where('model_id', $get_id)->delete();
|
||||
|
||||
if(count($request->modelingTask)>0) {
|
||||
$dataModelingTask = [];
|
||||
// $idMt = DB::table('rel_model_task')->max('id');
|
||||
// $noId = $idMt + 1;
|
||||
foreach($request->modelingTask as $k => $v) {
|
||||
$dataModelingTask[$k] = [
|
||||
// 'id' => $noId++,
|
||||
'model_id' => $get_id,
|
||||
'task_id' => $v,
|
||||
'company_id' => Auth::user()->company_id,
|
||||
];
|
||||
}
|
||||
|
||||
ModelingTaskModel::insert($dataModelingTask);
|
||||
}
|
||||
//IF ADD DATA
|
||||
}else {
|
||||
if ($timestamps) {
|
||||
$setField['created_at'] = date('Y-m-d H:i:s');
|
||||
$setField['updated_at'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
if ($init['idManual']) {
|
||||
$getId = DB::table($init['db'])->max('id');
|
||||
$setField['id'] = $getId+1;
|
||||
}
|
||||
|
||||
if ($init['seq']) {
|
||||
$seq = DB::Table($init['db'])->max('seq');
|
||||
$setField['seq'] = $seq+1;
|
||||
}
|
||||
|
||||
$id = DB::table($init['db'])->insertGetId($setField);
|
||||
|
||||
if(count($request->modelingTask)>0) {
|
||||
$dataModelingTask = [];
|
||||
// $idMt = DB::table('rel_model_task')->max('id');
|
||||
// $noId = $idMt + 1;
|
||||
foreach($request->modelingTask as $k => $v) {
|
||||
$dataModelingTask[$k] = [
|
||||
// 'id' => $noId++,
|
||||
'model_id' => $id,
|
||||
'task_id' => $v,
|
||||
'company_id' => Auth::user()->company_id,
|
||||
];
|
||||
}
|
||||
|
||||
ModelingTaskModel::insert($dataModelingTask);
|
||||
}
|
||||
}
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'rc' => 0,
|
||||
'rm' => "Berhasil"
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
//throw $th;
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 99,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'rc' => 500,
|
||||
'data' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
80
app/Models/ModelingTaskModel.php
Normal file
80
app/Models/ModelingTaskModel.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class ModelingTaskModel extends Model
|
||||
{
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'rel_model_task';
|
||||
public $timestamps = false;
|
||||
|
||||
public function initData($request,$route)
|
||||
{
|
||||
// INIT DB
|
||||
$data['title'] = 'Referensi Modelling Task';
|
||||
$data['actButton'] = ['edit', 'hapus'];
|
||||
$data['tableHead'] =
|
||||
array(
|
||||
["Nama Model","all","model_name"],
|
||||
["Nama Task","all","task_name"],
|
||||
["Nama Perusahaan","all","company_name"],
|
||||
["Act","all","action"]
|
||||
);
|
||||
|
||||
|
||||
$data['db'] = $this->table;
|
||||
$data['db_key'] = $this->primaryKey;
|
||||
$data['route'] = $route;
|
||||
$data['timestamps'] = false;
|
||||
$data['bisaAdd'] = true;
|
||||
$data['adaDetail'] = false;
|
||||
$data['idManual'] = true;
|
||||
$data['seq'] = false;
|
||||
$data['serial'] = true;
|
||||
|
||||
|
||||
$dtable = DB::select("SELECT rmt.*, rt.task_name, mm.description as model_name, mc.company_name
|
||||
FROM rel_model_task rmt
|
||||
LEFT JOIN ref_task rt ON rt.id::int = rmt.task_id::int
|
||||
LEFT JOIN master_model mm ON mm.id::int = rmt.model_id::int
|
||||
LEFT JOIN master_company mc ON mc.id::int = rmt.company_id::int
|
||||
ORDER BY rmt.model_id");
|
||||
|
||||
|
||||
// LIST DATA TABLE
|
||||
$data['data_table'] = $dtable;
|
||||
|
||||
// FORM FIELD FOR STORE
|
||||
|
||||
$data['set_field'] = [
|
||||
'model_id' => $request->post('model_id'),
|
||||
'task_id' => $request->post('task_id'),
|
||||
'company_id' => Auth::user()->company_id,
|
||||
];
|
||||
|
||||
// GET DATA FOR EDIT
|
||||
if ($request->post('id')) {
|
||||
$data['get_data_edit'] = DB::selectOne("SELECT * FROM {$this->table} where id = ?",[$request->post('id')]);
|
||||
}
|
||||
|
||||
foreach($data['tableHead'] as $v){
|
||||
$arrHead[] = $v[2];
|
||||
}
|
||||
$data['head'] = implode(",",$arrHead);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDT($data,$init)
|
||||
{
|
||||
$dt = DataTables::of($data);
|
||||
|
||||
|
||||
return $dt;
|
||||
}
|
||||
}
|
13
app/Models/ProjectCommentModel.php
Normal file
13
app/Models/ProjectCommentModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectCommentModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_project_comment';
|
||||
public $timestamps = false;
|
||||
}
|
13
app/Models/ProjectSubTaskModel.php
Normal file
13
app/Models/ProjectSubTaskModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectSubTaskModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_project_subtask';
|
||||
public $timestamps = true;
|
||||
}
|
13
app/Models/ProjectTaskDocument.php
Normal file
13
app/Models/ProjectTaskDocument.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectTaskDocument extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_project_task_document';
|
||||
public $timestamps = true;
|
||||
}
|
13
app/Models/ProjectTaskModel.php
Normal file
13
app/Models/ProjectTaskModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectTaskModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_project_task';
|
||||
public $timestamps = true;
|
||||
}
|
13
app/Models/ProjectsModel.php
Normal file
13
app/Models/ProjectsModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProjectsModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_project';
|
||||
public $timestamps = true;
|
||||
}
|
76
app/Models/RoleModel.php
Normal file
76
app/Models/RoleModel.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class RoleModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'ref_role';
|
||||
public $timestamps = false;
|
||||
|
||||
public function initData($request,$route)
|
||||
{
|
||||
// INIT DB
|
||||
$data['title'] = 'Referensi Role';
|
||||
$data['actButton'] = ['edit','hapus'];
|
||||
$data['tableHead'] =
|
||||
array(
|
||||
["Nama Role","all","definition"],
|
||||
["Status Aktif","all","is_active"],
|
||||
["Nama Perusahaan","all","company_name"],
|
||||
["Act","all","action"]
|
||||
);
|
||||
|
||||
$data['db'] = $this->table;
|
||||
$data['db_key'] = $this->primaryKey;
|
||||
$data['route'] = $route;
|
||||
$data['timestamps'] = false;
|
||||
|
||||
$data['bisaAdd'] = true;
|
||||
$data['adaDetail'] = false;
|
||||
$data['idManual'] = true;
|
||||
$data['seq'] = false;
|
||||
$data['serial'] = false;
|
||||
|
||||
|
||||
$dtable = DB::select("SELECT {$this->table}.*, mc.company_name FROM {$this->table} JOIN master_company mc ON mc.id = {$this->table}.company_id order by {$this->table}.id desc");
|
||||
|
||||
|
||||
// LIST DATA TABLE
|
||||
$data['data_table'] = $dtable;
|
||||
|
||||
// FORM FIELD FOR STORE
|
||||
$data['set_field'] = [
|
||||
'definition' => $request->post('definition'),
|
||||
'company_id' => Auth::user()->company_id,
|
||||
'is_active' => $request->post('is_active')
|
||||
];
|
||||
|
||||
// GET DATA FOR EDIT
|
||||
if ($request->post('id')) {
|
||||
$data['get_data_edit'] = DB::selectOne("SELECT * FROM {$this->table} where id = ?",[$request->post('id')]);
|
||||
}
|
||||
|
||||
foreach($data['tableHead'] as $v){
|
||||
$arrHead[] = $v[2];
|
||||
}
|
||||
$data['head'] = implode(",",$arrHead);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDT($data,$init)
|
||||
{
|
||||
$dt = DataTables::of($data);
|
||||
$dt->editColumn('is_active', function($data) {
|
||||
return $data->is_active?'Aktif':'Non Aktif';
|
||||
});
|
||||
return $dt;
|
||||
}
|
||||
}
|
78
app/Models/StatusModel.php
Normal file
78
app/Models/StatusModel.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class StatusModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = ['id', 'company_id'];
|
||||
protected $table = 'ref_status';
|
||||
public $timestamps = false;
|
||||
|
||||
public function initData($request,$route)
|
||||
{
|
||||
// INIT DB
|
||||
$data['title'] = 'Referensi Status';
|
||||
$data['actButton'] = ['edit','hapus'];
|
||||
$data['tableHead'] =
|
||||
array(
|
||||
["Definisi Status","all","definition"],
|
||||
["Status Aktif","all","is_active"],
|
||||
["Nama Perusahaan","all","company_name"],
|
||||
["Act","all","action"]
|
||||
);
|
||||
|
||||
$data['db'] = $this->table;
|
||||
$data['db_key'] = $this->primaryKey;
|
||||
$data['route'] = $route;
|
||||
$data['timestamps'] = false;
|
||||
|
||||
$data['bisaAdd'] = false;
|
||||
$data['adaDetail'] = false;
|
||||
$data['idManual'] = true;
|
||||
$data['seq'] = false;
|
||||
$data['serial'] = false;
|
||||
|
||||
|
||||
$dtable = DB::select("SELECT {$this->table}.*, mc.company_name FROM {$this->table} JOIN master_company mc ON mc.id = {$this->table}.company_id
|
||||
where {$this->table}.company_id = ? order by {$this->table}.id desc", [Auth::user()->company_id]);
|
||||
|
||||
|
||||
// LIST DATA TABLE
|
||||
$data['data_table'] = $dtable;
|
||||
|
||||
// FORM FIELD FOR STORE
|
||||
$data['set_field'] = [
|
||||
'definition' => $request->post('definition'),
|
||||
'company_id' => Auth::user()->company_id,
|
||||
'is_active' => $request->post('is_active')
|
||||
];
|
||||
|
||||
// GET DATA FOR EDIT
|
||||
if ($request->post('id')) {
|
||||
$multPrim = explode('|', $request->post('id'));
|
||||
$data['get_data_edit'] = DB::selectOne("SELECT * FROM {$this->table} where id = ? and company_id = ?",[$multPrim[0], $multPrim[1]]);
|
||||
}
|
||||
|
||||
foreach($data['tableHead'] as $v){
|
||||
$arrHead[] = $v[2];
|
||||
}
|
||||
$data['head'] = implode(",",$arrHead);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDT($data,$init)
|
||||
{
|
||||
$dt = DataTables::of($data);
|
||||
$dt->editColumn('is_active', function($data) {
|
||||
return $data->is_active?'Aktif':'Non Aktif';
|
||||
});
|
||||
return $dt;
|
||||
}
|
||||
}
|
13
app/Models/TaskCommentModel.php
Normal file
13
app/Models/TaskCommentModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TaskCommentModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_task_comment';
|
||||
public $timestamps = false;
|
||||
}
|
13
app/Models/TaskInboxModel.php
Normal file
13
app/Models/TaskInboxModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TaskInboxModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_task_inbox';
|
||||
public $timestamps = true;
|
||||
}
|
81
app/Models/TaskModel.php
Normal file
81
app/Models/TaskModel.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class TaskModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'ref_task';
|
||||
public $timestamps = false;
|
||||
|
||||
public function initData($request,$route)
|
||||
{
|
||||
// INIT DB
|
||||
$data['title'] = 'Referensi Master Task';
|
||||
$data['actButton'] = ['edit','hapus'];
|
||||
$data['tableHead'] =
|
||||
array(
|
||||
["Nama Task","all","task_name"],
|
||||
["Jenis Task","all","definition"],
|
||||
["Nama Perusahaan","all","company_name"],
|
||||
["Act","all","action"]
|
||||
);
|
||||
|
||||
$data['db'] = $this->table;
|
||||
$data['db_key'] = $this->primaryKey;
|
||||
$data['route'] = $route;
|
||||
$data['timestamps'] = false;
|
||||
|
||||
$data['bisaAdd'] = true;
|
||||
$data['adaDetail'] = false;
|
||||
$data['idManual'] = true;
|
||||
$data['seq'] = false;
|
||||
$data['serial'] = true;
|
||||
|
||||
|
||||
$dtable = DB::select("SELECT {$this->table}.*, mc.company_name, rtt.definition FROM {$this->table}
|
||||
JOIN master_company mc ON mc.id = {$this->table}.company_id
|
||||
JOIN ref_task_type rtt ON rtt.id = {$this->table}.task_type_id
|
||||
WHERE {$this->table}.company_id = ?
|
||||
order by {$this->table}.id desc",[Auth::user()->company_id]);
|
||||
|
||||
|
||||
// LIST DATA TABLE
|
||||
$data['data_table'] = $dtable;
|
||||
|
||||
// FORM FIELD FOR STORE
|
||||
$data['set_field'] = [
|
||||
'task_name' => $request->post('task_name'),
|
||||
'task_type_id' => $request->post('task_type_id'),
|
||||
'company_id' => Auth::user()->company_id,
|
||||
'is_active' => $request->post('is_active')
|
||||
];
|
||||
|
||||
// GET DATA FOR EDIT
|
||||
if ($request->post('id')) {
|
||||
$data['get_data_edit'] = DB::selectOne("SELECT * FROM {$this->table} where id = ?",[$request->post('id')]);
|
||||
}
|
||||
|
||||
foreach($data['tableHead'] as $v){
|
||||
$arrHead[] = $v[2];
|
||||
}
|
||||
$data['head'] = implode(",",$arrHead);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDT($data,$init)
|
||||
{
|
||||
$dt = DataTables::of($data);
|
||||
$dt->editColumn('is_active', function($data) {
|
||||
return $data->is_active?'Aktif':'Non Aktif';
|
||||
});
|
||||
return $dt;
|
||||
}
|
||||
}
|
13
app/Models/TeamModel.php
Normal file
13
app/Models/TeamModel.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TeamModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_team';
|
||||
public $timestamps = true;
|
||||
}
|
79
app/Models/TeamRoleModel.php
Normal file
79
app/Models/TeamRoleModel.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class TeamRoleModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = ['id', 'company_id'];
|
||||
protected $table = 'ref_team_role';
|
||||
public $timestamps = false;
|
||||
|
||||
public function initData($request,$route)
|
||||
{
|
||||
// INIT DB
|
||||
$data['title'] = 'Referensi Team Role';
|
||||
$data['actButton'] = ['edit','hapus'];
|
||||
$data['tableHead'] =
|
||||
array(
|
||||
["Nama Jenis Task","all","definition"],
|
||||
["Status Aktif","all","is_active"],
|
||||
["Nama Perusahaan","all","company_name"],
|
||||
["Act","all","action"]
|
||||
);
|
||||
|
||||
$data['db'] = $this->table;
|
||||
$data['db_key'] = $this->primaryKey;
|
||||
$data['route'] = $route;
|
||||
$data['timestamps'] = false;
|
||||
|
||||
$data['bisaAdd'] = false;
|
||||
$data['adaDetail'] = false;
|
||||
$data['idManual'] = true;
|
||||
$data['seq'] = false;
|
||||
$data['serial'] = false;
|
||||
|
||||
|
||||
$dtable = DB::select("SELECT {$this->table}.*, mc.company_name FROM {$this->table} JOIN master_company mc ON mc.id = {$this->table}.company_id
|
||||
WHERE {$this->table}.company_id = ?
|
||||
order by {$this->table}.id desc", [Auth::user()->company_id]);
|
||||
|
||||
|
||||
// LIST DATA TABLE
|
||||
$data['data_table'] = $dtable;
|
||||
|
||||
// FORM FIELD FOR STORE
|
||||
$data['set_field'] = [
|
||||
'definition' => $request->post('definition'),
|
||||
'company_id' => Auth::user()->company_id,
|
||||
'is_active' => $request->post('is_active')
|
||||
];
|
||||
|
||||
// GET DATA FOR EDIT
|
||||
if ($request->post('id')) {
|
||||
$multPrim = explode('|', $request->post('id'));
|
||||
$data['get_data_edit'] = DB::selectOne("SELECT * FROM {$this->table} where id = ? and company_id = ?",[$multPrim[0], $multPrim[1]]);
|
||||
}
|
||||
|
||||
foreach($data['tableHead'] as $v){
|
||||
$arrHead[] = $v[2];
|
||||
}
|
||||
$data['head'] = implode(",",$arrHead);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDT($data,$init)
|
||||
{
|
||||
$dt = DataTables::of($data);
|
||||
$dt->editColumn('is_active', function($data) {
|
||||
return $data->is_active?'Aktif':'Non Aktif';
|
||||
});
|
||||
return $dt;
|
||||
}
|
||||
}
|
94
app/Models/UnitModel.php
Normal file
94
app/Models/UnitModel.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class UnitModel extends Model
|
||||
{
|
||||
//
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'master_unit';
|
||||
public $timestamps = true;
|
||||
|
||||
public function initData($request,$route)
|
||||
{
|
||||
// INIT DB
|
||||
$data['title'] = 'Master Unit';
|
||||
$data['actButton'] = ['edit','hapus'];
|
||||
$data['tableHead'] =
|
||||
array(
|
||||
["Nama Unit","all","unit_name"],
|
||||
["Unit Code","all","unit_code"],
|
||||
["Jenis Task","all","definition"],
|
||||
["Nama Perusahaan","all","company_name"],
|
||||
["Act","all","action"]
|
||||
);
|
||||
|
||||
$data['db'] = $this->table;
|
||||
$data['db_key'] = $this->primaryKey;
|
||||
$data['route'] = $route;
|
||||
$data['timestamps'] = true;
|
||||
|
||||
$data['bisaAdd'] = true;
|
||||
$data['adaDetail'] = false;
|
||||
$data['idManual'] = true;
|
||||
$data['seq'] = false;
|
||||
$data['serial'] = true;
|
||||
|
||||
|
||||
$dtable = DB::select("SELECT {$this->table}.*, mc.company_name, rtt.definition FROM {$this->table}
|
||||
JOIN ref_task_type rtt ON rtt.id = {$this->table}.task_type_id
|
||||
JOIN master_company mc ON mc.id = {$this->table}.company_id
|
||||
WHERE {$this->table}.company_id = ? order by {$this->table}.id desc",[Auth::user()->company_id]);
|
||||
|
||||
|
||||
// LIST DATA TABLE
|
||||
$data['data_table'] = $dtable;
|
||||
|
||||
// FORM FIELD FOR STORE
|
||||
if($request->post('get_id')) {
|
||||
$data['set_field'] = [
|
||||
'unit_name' => $request->post('unit_name'),
|
||||
'unit_code' => $request->post('unit_code'),
|
||||
'task_type_id' => $request->post('task_type_id'),
|
||||
'user_upd_id' => Auth::user()->id,
|
||||
'company_id' => Auth::user()->company_id,
|
||||
'is_active' => $request->post('is_active')
|
||||
];
|
||||
} else {
|
||||
$data['set_field'] = [
|
||||
'unit_name' => $request->post('unit_name'),
|
||||
'unit_code' => $request->post('unit_code'),
|
||||
'task_type_id' => $request->post('task_type_id'),
|
||||
'user_crt_id' => Auth::user()->id,
|
||||
'company_id' => Auth::user()->company_id,
|
||||
'is_active' => $request->post('is_active')
|
||||
];
|
||||
}
|
||||
|
||||
// GET DATA FOR EDIT
|
||||
if ($request->post('id')) {
|
||||
$data['get_data_edit'] = DB::selectOne("SELECT * FROM {$this->table} where id = ?",[$request->post('id')]);
|
||||
}
|
||||
|
||||
foreach($data['tableHead'] as $v){
|
||||
$arrHead[] = $v[2];
|
||||
}
|
||||
$data['head'] = implode(",",$arrHead);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDT($data,$init)
|
||||
{
|
||||
$dt = DataTables::of($data);
|
||||
$dt->editColumn('is_active', function($data) {
|
||||
return $data->is_active?'Aktif':'Non Aktif';
|
||||
});
|
||||
return $dt;
|
||||
}
|
||||
}
|
28
app/Providers/AppServiceProvider.php
Normal file
28
app/Providers/AppServiceProvider.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
30
app/Providers/AuthServiceProvider.php
Normal file
30
app/Providers/AuthServiceProvider.php
Normal file
@ -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
|
||||
*/
|
||||
protected $policies = [
|
||||
// 'App\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
21
app/Providers/BroadcastServiceProvider.php
Normal file
21
app/Providers/BroadcastServiceProvider.php
Normal file
@ -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');
|
||||
}
|
||||
}
|
34
app/Providers/EventServiceProvider.php
Normal file
34
app/Providers/EventServiceProvider.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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
|
||||
*/
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
80
app/Providers/RouteServiceProvider.php
Normal file
80
app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/home';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @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->namespace)
|
||||
->group(base_path('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->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
}
|
||||
}
|
41
app/User.php
Normal file
41
app/User.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
protected $table = 'master_user';
|
||||
protected $primaryKey = 'id';
|
||||
public $timestamps = true;
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
}
|
53
artisan
Normal file
53
artisan
Normal file
@ -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 our classes "manually". Feels 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);
|
55
bootstrap/app.php
Normal file
55
bootstrap/app.php
Normal file
@ -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;
|
2
bootstrap/cache/.gitignore
vendored
Normal file
2
bootstrap/cache/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
69
composer.json
Normal file
69
composer.json
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.2.5",
|
||||
"barryvdh/laravel-dompdf": "^0.9.0",
|
||||
"brainfoolong/cryptojs-aes-php": "^2.1",
|
||||
"fideloper/proxy": "^4.2",
|
||||
"fruitcake/laravel-cors": "^1.0",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"laravel/framework": "^7.0",
|
||||
"laravel/tinker": "^2.0",
|
||||
"laravel/ui": "2.4",
|
||||
"league/flysystem-aws-s3-v3": "~1.0",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"yajra/laravel-datatables": "1.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"facade/ignition": "^2.0",
|
||||
"fzaninotto/faker": "^1.9.1",
|
||||
"mockery/mockery": "^1.3.1",
|
||||
"nunomaduro/collision": "^4.1",
|
||||
"phpunit/phpunit": "^8.5"
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
},
|
||||
"classmap": [
|
||||
"database/seeds",
|
||||
"database/factories"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
]
|
||||
}
|
||||
}
|
8802
composer.lock
generated
Normal file
8802
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
242
config/app.php
Normal file
242
config/app.php
Normal file
@ -0,0 +1,242 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application. This value is used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| any other location as required by the application or its packages.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| your application so that it is used when running Artisan tasks.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
'asset_url' => env('ASSET_URL', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. We have gone
|
||||
| ahead and set this to a sensible default for you out of the box.
|
||||
|
|
||||
*/
|
||||
|
||||
// 'timezone' => 'UTC',
|
||||
'timezone' => 'Asia/Jakarta',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
*/
|
||||
|
||||
// 'locale' => 'en',
|
||||
'locale' => 'id',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Fallback Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The fallback locale determines the locale to use when the current one
|
||||
| is not available. You may change the value to correspond to any of
|
||||
| the language folders that are provided through your application.
|
||||
|
|
||||
*/
|
||||
|
||||
// 'fallback_locale' => 'en',
|
||||
'fallback_locale' => 'id',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Faker Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This locale will be used by the Faker PHP library when generating fake
|
||||
| data for your database seeds. For example, this will be used to get
|
||||
| localized telephone numbers, street address information and more.
|
||||
|
|
||||
*/
|
||||
|
||||
// 'faker_locale' => 'en_US',
|
||||
'faker_locale' => 'id_ID',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is used by the Illuminate encrypter service and should be set
|
||||
| to a random, 32 character string, otherwise these encrypted strings
|
||||
| will not be safe. Please do this before deploying an application!
|
||||
|
|
||||
*/
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
Illuminate\Auth\AuthServiceProvider::class,
|
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
Illuminate\Cache\CacheServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
||||
Illuminate\Cookie\CookieServiceProvider::class,
|
||||
Illuminate\Database\DatabaseServiceProvider::class,
|
||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||
Illuminate\Hashing\HashServiceProvider::class,
|
||||
Illuminate\Mail\MailServiceProvider::class,
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||
Illuminate\Queue\QueueServiceProvider::class,
|
||||
Illuminate\Redis\RedisServiceProvider::class,
|
||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
||||
Illuminate\Session\SessionServiceProvider::class,
|
||||
Illuminate\Translation\TranslationServiceProvider::class,
|
||||
Illuminate\Validation\ValidationServiceProvider::class,
|
||||
Illuminate\View\ViewServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
|
||||
Yajra\DataTables\DataTablesServiceProvider::class,
|
||||
Barryvdh\DomPDF\ServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
Maatwebsite\Excel\ExcelServiceProvider::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Aliases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array of class aliases will be registered when this application
|
||||
| is started. However, feel free to register as many as you wish as
|
||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||
|
|
||||
*/
|
||||
|
||||
'aliases' => [
|
||||
|
||||
'App' => Illuminate\Support\Facades\App::class,
|
||||
'Arr' => Illuminate\Support\Arr::class,
|
||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
|
||||
'Bus' => Illuminate\Support\Facades\Bus::class,
|
||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||
'Config' => Illuminate\Support\Facades\Config::class,
|
||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||
'DB' => Illuminate\Support\Facades\DB::class,
|
||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
||||
'Event' => Illuminate\Support\Facades\Event::class,
|
||||
'File' => Illuminate\Support\Facades\File::class,
|
||||
'Gate' => Illuminate\Support\Facades\Gate::class,
|
||||
'Hash' => Illuminate\Support\Facades\Hash::class,
|
||||
'Http' => Illuminate\Support\Facades\Http::class,
|
||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||
'Log' => Illuminate\Support\Facades\Log::class,
|
||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
||||
'Notification' => Illuminate\Support\Facades\Notification::class,
|
||||
'Password' => Illuminate\Support\Facades\Password::class,
|
||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
||||
'Redis' => Illuminate\Support\Facades\Redis::class,
|
||||
'Request' => Illuminate\Support\Facades\Request::class,
|
||||
'Response' => Illuminate\Support\Facades\Response::class,
|
||||
'Route' => Illuminate\Support\Facades\Route::class,
|
||||
'Schema' => Illuminate\Support\Facades\Schema::class,
|
||||
'Session' => Illuminate\Support\Facades\Session::class,
|
||||
'Storage' => Illuminate\Support\Facades\Storage::class,
|
||||
'Str' => Illuminate\Support\Str::class,
|
||||
'URL' => Illuminate\Support\Facades\URL::class,
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
'DataTables' => Yajra\DataTables\DataTablesServiceProvider::class,
|
||||
'PDF' => Barryvdh\DomPDF\Facade::class,
|
||||
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
|
||||
|
||||
],
|
||||
|
||||
];
|
117
config/auth.php
Normal file
117
config/auth.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default authentication "guard" and password
|
||||
| reset options for your application. You may change these defaults
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => 'web',
|
||||
'passwords' => 'users',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| here which uses session storage and the Eloquent user provider.
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| Supported: "session", "token"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'driver' => 'token',
|
||||
'provider' => 'users',
|
||||
'hash' => false,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| sources which represent each model / table. These sources may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\User::class,
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may specify multiple password reset configurations if you have more
|
||||
| than one user table or model in the application and you want to have
|
||||
| separate password reset settings based on the specific user types.
|
||||
|
|
||||
| The expire time is the number of minutes that the reset token should be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => 'password_resets',
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the amount of seconds before a password confirmation
|
||||
| times out and the user is prompted to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => 10800,
|
||||
|
||||
];
|
59
config/broadcasting.php
Normal file
59
config/broadcasting.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Broadcaster
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default broadcaster that will be used by the
|
||||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "pusher", "redis", "log", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('BROADCAST_DRIVER', 'null'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the broadcast connections that will be used
|
||||
| to broadcast events to other systems or over websockets. Samples of
|
||||
| each available type of connection are provided inside this array.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'pusher' => [
|
||||
'driver' => 'pusher',
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||
'useTLS' => true,
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'driver' => 'log',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'null',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
103
config/cache.php
Normal file
103
config/cache.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache connection that gets used while
|
||||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
| Supported: "apc", "array", "database", "file",
|
||||
| "memcached", "redis", "dynamodb"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'apc' => [
|
||||
'driver' => 'apc',
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'cache',
|
||||
'connection' => null,
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'cache',
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing a RAM based store such as APC or Memcached, there might
|
||||
| be other applications utilizing the same cache. So, we'll specify a
|
||||
| value to get prefixed to all our keys so we can avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
|
||||
|
||||
];
|
34
config/cors.php
Normal file
34
config/cors.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cross-Origin Resource Sharing (CORS) Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure your settings for cross-origin resource sharing
|
||||
| or "CORS". This determines what cross-origin operations may execute
|
||||
| in web browsers. You are free to adjust these settings as needed.
|
||||
|
|
||||
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['api/*'],
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
'allowed_origins' => ['*'],
|
||||
|
||||
'allowed_origins_patterns' => [],
|
||||
|
||||
'allowed_headers' => ['*'],
|
||||
|
||||
'exposed_headers' => false,
|
||||
|
||||
'max_age' => false,
|
||||
|
||||
'supports_credentials' => false,
|
||||
|
||||
];
|
122
config/datatables.php
Normal file
122
config/datatables.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
* DataTables search options.
|
||||
*/
|
||||
'search' => [
|
||||
/*
|
||||
* Smart search will enclose search keyword with wildcard string "%keyword%".
|
||||
* SQL: column LIKE "%keyword%"
|
||||
*/
|
||||
'smart' => true,
|
||||
|
||||
/*
|
||||
* Multi-term search will explode search keyword using spaces resulting into multiple term search.
|
||||
*/
|
||||
'multi_term' => true,
|
||||
|
||||
/*
|
||||
* Case insensitive will search the keyword in lower case format.
|
||||
* SQL: LOWER(column) LIKE LOWER(keyword)
|
||||
*/
|
||||
'case_insensitive' => true,
|
||||
|
||||
/*
|
||||
* Wild card will add "%" in between every characters of the keyword.
|
||||
* SQL: column LIKE "%k%e%y%w%o%r%d%"
|
||||
*/
|
||||
'use_wildcards' => false,
|
||||
|
||||
/*
|
||||
* Perform a search which starts with the given keyword.
|
||||
* SQL: column LIKE "keyword%"
|
||||
*/
|
||||
'starts_with' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
* DataTables internal index id response column name.
|
||||
*/
|
||||
'index_column' => 'DT_RowIndex',
|
||||
|
||||
/*
|
||||
* List of available builders for DataTables.
|
||||
* This is where you can register your custom dataTables builder.
|
||||
*/
|
||||
'engines' => [
|
||||
'eloquent' => Yajra\DataTables\EloquentDataTable::class,
|
||||
'query' => Yajra\DataTables\QueryDataTable::class,
|
||||
'collection' => Yajra\DataTables\CollectionDataTable::class,
|
||||
'resource' => Yajra\DataTables\ApiResourceDataTable::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* DataTables accepted builder to engine mapping.
|
||||
* This is where you can override which engine a builder should use
|
||||
* Note, only change this if you know what you are doing!
|
||||
*/
|
||||
'builders' => [
|
||||
//Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent',
|
||||
//Illuminate\Database\Eloquent\Builder::class => 'eloquent',
|
||||
//Illuminate\Database\Query\Builder::class => 'query',
|
||||
//Illuminate\Support\Collection::class => 'collection',
|
||||
],
|
||||
|
||||
/*
|
||||
* Nulls last sql pattern for PostgreSQL & Oracle.
|
||||
* For MySQL, use 'CASE WHEN :column IS NULL THEN 1 ELSE 0 END, :column :direction'
|
||||
*/
|
||||
'nulls_last_sql' => ':column :direction NULLS LAST',
|
||||
|
||||
/*
|
||||
* User friendly message to be displayed on user if error occurs.
|
||||
* Possible values:
|
||||
* null - The exception message will be used on error response.
|
||||
* 'throw' - Throws a \Yajra\DataTables\Exceptions\Exception. Use your custom error handler if needed.
|
||||
* 'custom message' - Any friendly message to be displayed to the user. You can also use translation key.
|
||||
*/
|
||||
'error' => env('DATATABLES_ERROR', null),
|
||||
|
||||
/*
|
||||
* Default columns definition of dataTable utility functions.
|
||||
*/
|
||||
'columns' => [
|
||||
/*
|
||||
* List of columns hidden/removed on json response.
|
||||
*/
|
||||
'excess' => ['rn', 'row_num'],
|
||||
|
||||
/*
|
||||
* List of columns to be escaped. If set to *, all columns are escape.
|
||||
* Note: You can set the value to empty array to disable XSS protection.
|
||||
*/
|
||||
'escape' => '*',
|
||||
|
||||
/*
|
||||
* List of columns that are allowed to display html content.
|
||||
* Note: Adding columns to list will make us available to XSS attacks.
|
||||
*/
|
||||
'raw' => ['action'],
|
||||
|
||||
/*
|
||||
* List of columns are are forbidden from being searched/sorted.
|
||||
*/
|
||||
'blacklist' => ['password', 'remember_token'],
|
||||
|
||||
/*
|
||||
* List of columns that are only allowed fo search/sort.
|
||||
* If set to *, all columns are allowed.
|
||||
*/
|
||||
'whitelist' => '*',
|
||||
],
|
||||
|
||||
/*
|
||||
* JsonResponse header and options config.
|
||||
*/
|
||||
'json' => [
|
||||
'header' => [],
|
||||
'options' => 0,
|
||||
],
|
||||
|
||||
];
|
244
config/dompdf.php
Normal file
244
config/dompdf.php
Normal file
@ -0,0 +1,244 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set some default values. It is possible to add all defines that can be set
|
||||
| in dompdf_config.inc.php. You can also override the entire config file.
|
||||
|
|
||||
*/
|
||||
'show_warnings' => false, // Throw an Exception on warnings from dompdf
|
||||
'orientation' => 'portrait',
|
||||
'defines' => array(
|
||||
/**
|
||||
* The location of the DOMPDF font directory
|
||||
*
|
||||
* The location of the directory where DOMPDF will store fonts and font metrics
|
||||
* Note: This directory must exist and be writable by the webserver process.
|
||||
* *Please note the trailing slash.*
|
||||
*
|
||||
* Notes regarding fonts:
|
||||
* Additional .afm font metrics can be added by executing load_font.php from command line.
|
||||
*
|
||||
* Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
|
||||
* be embedded in the pdf file or the PDF may not display correctly. This can significantly
|
||||
* increase file size unless font subsetting is enabled. Before embedding a font please
|
||||
* review your rights under the font license.
|
||||
*
|
||||
* Any font specification in the source HTML is translated to the closest font available
|
||||
* in the font directory.
|
||||
*
|
||||
* The pdf standard "Base 14 fonts" are:
|
||||
* Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
|
||||
* Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
|
||||
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
|
||||
* Symbol, ZapfDingbats.
|
||||
*/
|
||||
"font_dir" => storage_path('fonts/'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
|
||||
|
||||
/**
|
||||
* The location of the DOMPDF font cache directory
|
||||
*
|
||||
* This directory contains the cached font metrics for the fonts used by DOMPDF.
|
||||
* This directory can be the same as DOMPDF_FONT_DIR
|
||||
*
|
||||
* Note: This directory must exist and be writable by the webserver process.
|
||||
*/
|
||||
"font_cache" => storage_path('fonts/'),
|
||||
|
||||
/**
|
||||
* The location of a temporary directory.
|
||||
*
|
||||
* The directory specified must be writeable by the webserver process.
|
||||
* The temporary directory is required to download remote images and when
|
||||
* using the PFDLib back end.
|
||||
*/
|
||||
"temp_dir" => sys_get_temp_dir(),
|
||||
|
||||
/**
|
||||
* ==== IMPORTANT ====
|
||||
*
|
||||
* dompdf's "chroot": Prevents dompdf from accessing system files or other
|
||||
* files on the webserver. All local files opened by dompdf must be in a
|
||||
* subdirectory of this directory. DO NOT set it to '/' since this could
|
||||
* allow an attacker to use dompdf to read any files on the server. This
|
||||
* should be an absolute path.
|
||||
* This is only checked on command line call by dompdf.php, but not by
|
||||
* direct class use like:
|
||||
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
|
||||
*/
|
||||
"chroot" => realpath(base_path()),
|
||||
|
||||
/**
|
||||
* Whether to enable font subsetting or not.
|
||||
*/
|
||||
"enable_font_subsetting" => false,
|
||||
|
||||
/**
|
||||
* The PDF rendering backend to use
|
||||
*
|
||||
* Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
|
||||
* 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
|
||||
* fall back on CPDF. 'GD' renders PDFs to graphic files. {@link
|
||||
* Canvas_Factory} ultimately determines which rendering class to instantiate
|
||||
* based on this setting.
|
||||
*
|
||||
* Both PDFLib & CPDF rendering backends provide sufficient rendering
|
||||
* capabilities for dompdf, however additional features (e.g. object,
|
||||
* image and font support, etc.) differ between backends. Please see
|
||||
* {@link PDFLib_Adapter} for more information on the PDFLib backend
|
||||
* and {@link CPDF_Adapter} and lib/class.pdf.php for more information
|
||||
* on CPDF. Also see the documentation for each backend at the links
|
||||
* below.
|
||||
*
|
||||
* The GD rendering backend is a little different than PDFLib and
|
||||
* CPDF. Several features of CPDF and PDFLib are not supported or do
|
||||
* not make any sense when creating image files. For example,
|
||||
* multiple pages are not supported, nor are PDF 'objects'. Have a
|
||||
* look at {@link GD_Adapter} for more information. GD support is
|
||||
* experimental, so use it at your own risk.
|
||||
*
|
||||
* @link http://www.pdflib.com
|
||||
* @link http://www.ros.co.nz/pdf
|
||||
* @link http://www.php.net/image
|
||||
*/
|
||||
"pdf_backend" => "CPDF",
|
||||
|
||||
/**
|
||||
* PDFlib license key
|
||||
*
|
||||
* If you are using a licensed, commercial version of PDFlib, specify
|
||||
* your license key here. If you are using PDFlib-Lite or are evaluating
|
||||
* the commercial version of PDFlib, comment out this setting.
|
||||
*
|
||||
* @link http://www.pdflib.com
|
||||
*
|
||||
* If pdflib present in web server and auto or selected explicitely above,
|
||||
* a real license code must exist!
|
||||
*/
|
||||
//"DOMPDF_PDFLIB_LICENSE" => "your license key here",
|
||||
|
||||
/**
|
||||
* html target media view which should be rendered into pdf.
|
||||
* List of types and parsing rules for future extensions:
|
||||
* http://www.w3.org/TR/REC-html40/types.html
|
||||
* screen, tty, tv, projection, handheld, print, braille, aural, all
|
||||
* Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
|
||||
* Note, even though the generated pdf file is intended for print output,
|
||||
* the desired content might be different (e.g. screen or projection view of html file).
|
||||
* Therefore allow specification of content here.
|
||||
*/
|
||||
"default_media_type" => "screen",
|
||||
|
||||
/**
|
||||
* The default paper size.
|
||||
*
|
||||
* North America standard is "letter"; other countries generally "a4"
|
||||
*
|
||||
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
|
||||
*/
|
||||
"default_paper_size" => "a4",
|
||||
|
||||
/**
|
||||
* The default font family
|
||||
*
|
||||
* Used if no suitable fonts can be found. This must exist in the font folder.
|
||||
* @var string
|
||||
*/
|
||||
"default_font" => "serif",
|
||||
|
||||
/**
|
||||
* Image DPI setting
|
||||
*
|
||||
* This setting determines the default DPI setting for images and fonts. The
|
||||
* DPI may be overridden for inline images by explictly setting the
|
||||
* image's width & height style attributes (i.e. if the image's native
|
||||
* width is 600 pixels and you specify the image's width as 72 points,
|
||||
* the image will have a DPI of 600 in the rendered PDF. The DPI of
|
||||
* background images can not be overridden and is controlled entirely
|
||||
* via this parameter.
|
||||
*
|
||||
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
|
||||
* If a size in html is given as px (or without unit as image size),
|
||||
* this tells the corresponding size in pt.
|
||||
* This adjusts the relative sizes to be similar to the rendering of the
|
||||
* html page in a reference browser.
|
||||
*
|
||||
* In pdf, always 1 pt = 1/72 inch
|
||||
*
|
||||
* Rendering resolution of various browsers in px per inch:
|
||||
* Windows Firefox and Internet Explorer:
|
||||
* SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
|
||||
* Linux Firefox:
|
||||
* about:config *resolution: Default:96
|
||||
* (xorg screen dimension in mm and Desktop font dpi settings are ignored)
|
||||
*
|
||||
* Take care about extra font/image zoom factor of browser.
|
||||
*
|
||||
* In images, <img> size in pixel attribute, img css style, are overriding
|
||||
* the real image dimension in px for rendering.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
"dpi" => 96,
|
||||
|
||||
/**
|
||||
* Enable inline PHP
|
||||
*
|
||||
* If this setting is set to true then DOMPDF will automatically evaluate
|
||||
* inline PHP contained within <script type="text/php"> ... </script> tags.
|
||||
*
|
||||
* Enabling this for documents you do not trust (e.g. arbitrary remote html
|
||||
* pages) is a security risk. Set this option to false if you wish to process
|
||||
* untrusted documents.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
"enable_php" => false,
|
||||
|
||||
/**
|
||||
* Enable inline Javascript
|
||||
*
|
||||
* If this setting is set to true then DOMPDF will automatically insert
|
||||
* JavaScript code contained within <script type="text/javascript"> ... </script> tags.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
"enable_javascript" => true,
|
||||
|
||||
/**
|
||||
* Enable remote file access
|
||||
*
|
||||
* If this setting is set to true, DOMPDF will access remote sites for
|
||||
* images and CSS files as required.
|
||||
* This is required for part of test case www/test/image_variants.html through www/examples.php
|
||||
*
|
||||
* Attention!
|
||||
* This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and
|
||||
* allowing remote access to dompdf.php or on allowing remote html code to be passed to
|
||||
* $dompdf = new DOMPDF(, $dompdf->load_html(...,
|
||||
* This allows anonymous users to download legally doubtful internet content which on
|
||||
* tracing back appears to being downloaded by your server, or allows malicious php code
|
||||
* in remote html pages to be executed by your server with your account privileges.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
"enable_remote" => true,
|
||||
|
||||
/**
|
||||
* A ratio applied to the fonts height to be more like browsers' line height
|
||||
*/
|
||||
"font_height_ratio" => 1.1,
|
||||
|
||||
/**
|
||||
* Use the more-than-experimental HTML5 Lib parser
|
||||
*/
|
||||
"enable_html5_parser" => false,
|
||||
),
|
||||
|
||||
|
||||
);
|
95
config/filesystems.php
Normal file
95
config/filesystems.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application. Just store away!
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DRIVER', 'do_spaces'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cloud Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Many applications store files both locally and in the cloud. For this
|
||||
| reason, you may specify a default "cloud" driver here. This driver
|
||||
| will be bound as the Cloud disk implementation in the container.
|
||||
|
|
||||
*/
|
||||
|
||||
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||
| may even configure multiple disks of the same driver. Defaults have
|
||||
| been setup for each driver as an example of the required options.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
],
|
||||
|
||||
'do_spaces' => [
|
||||
'driver' => 's3',
|
||||
'root' => 'chess',
|
||||
'key' => 'DO00RTTNAYHXQH8VW6AE',
|
||||
'secret' => '+XsSTzhLCYW79G9pMgcjBcoEYXzQ4CsJ1ePv6V+vyfc',
|
||||
'region' => 'sgp1',
|
||||
'bucket' => 'basys-space',
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => 'https://sgp1.digitaloceanspaces.com',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
52
config/hashing.php
Normal file
52
config/hashing.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Hash Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default hash driver that will be used to hash
|
||||
| passwords for your application. By default, the bcrypt algorithm is
|
||||
| used; however, you remain free to modify this option if you wish.
|
||||
|
|
||||
| Supported: "bcrypt", "argon", "argon2id"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'bcrypt',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bcrypt Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'bcrypt' => [
|
||||
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Argon Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Argon algorithm. These will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'argon' => [
|
||||
'memory' => 1024,
|
||||
'threads' => 2,
|
||||
'time' => 2,
|
||||
],
|
||||
|
||||
];
|
104
config/logging.php
Normal file
104
config/logging.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that gets used when writing
|
||||
| messages to the logs. The name specified in this option should match
|
||||
| one of the channels defined in the "channels" configuration array.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Out of
|
||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||
| you a variety of powerful log handlers / formatters to utilize.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog",
|
||||
| "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single'],
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => 'debug',
|
||||
'days' => 14,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => 'Laravel Log',
|
||||
'emoji' => ':boom:',
|
||||
'level' => 'critical',
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => 'debug',
|
||||
'handler' => SyslogUdpHandler::class,
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
109
config/mail.php
Normal file
109
config/mail.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send any email
|
||||
| messages sent by your application. Alternative mailers may be setup
|
||||
| and used as needed; however, this mailer will be used by default.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'smtp'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers to be used while
|
||||
| sending an e-mail. You will specify which one you are using for your
|
||||
| mailers below. You are free to add additional mailers as required.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||
| "postmark", "log", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
// 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
'host' => 'srv115.niagahoster.com',
|
||||
// 'port' => env('MAIL_PORT', 587),
|
||||
'port' => 587,
|
||||
// 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
'encryption' => 'tls',
|
||||
// 'username' => env('MAIL_USERNAME'),
|
||||
'username' => 'support@basys.co.id',
|
||||
// 'password' => env('MAIL_PASSWORD'),
|
||||
'password' => 'Basys2023',
|
||||
'timeout' => null,
|
||||
'auth_mode' => null,
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => '/usr/sbin/sendmail -bs',
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all e-mails sent by your application to be sent from
|
||||
| the same address. Here, you may specify a name and address that is
|
||||
| used globally for all e-mails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
// 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'address' => 'no-reply@basys.co.id',
|
||||
// 'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
'name' => 'PT BAYU SINERGI SOLUSI',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Markdown Mail Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using Markdown based email rendering, you may configure your
|
||||
| theme and component paths here, allowing you to customize the design
|
||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||
|
|
||||
*/
|
||||
|
||||
'markdown' => [
|
||||
'theme' => 'default',
|
||||
|
||||
'paths' => [
|
||||
resource_path('views/vendor/mail'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
88
config/queue.php
Normal file
88
config/queue.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue API supports an assortment of back-ends via a single
|
||||
| API, giving you convenient access to each back-end using the same
|
||||
| syntax for every one. Here you may define a default connection.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection information for each server that
|
||||
| is used by your application. A default configuration has been added
|
||||
| for each back-end shipped with Laravel. You are free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'block_for' => 0,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'your-queue-name'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => 90,
|
||||
'block_for' => null,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control which database and table are used to store the jobs that
|
||||
| have failed. You may change them to any database / table you wish.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
33
config/services.php
Normal file
33
config/services.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
];
|
200
config/session.php
Normal file
200
config/session.php
Normal file
@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default session "driver" that will be used on
|
||||
| requests. By default, we will use the lightweight native driver but
|
||||
| you may specify any of the other wonderful drivers provided here.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to immediately expire on the browser closing, set that option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||
// 'lifetime' => 2,
|
||||
|
||||
'expire_on_close' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it is stored. All encryption will be run
|
||||
| automatically by Laravel and you can use the Session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the native session driver, we need a location where session
|
||||
| files may be stored. A default has been set for you but a different
|
||||
| location may be specified. This is only needed for file sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table we
|
||||
| should use to manage the sessions. Of course, a sensible default is
|
||||
| provided for you; however, you are free to change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => 'sessions',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "apc", "memcached", or "dynamodb" session drivers you may
|
||||
| list a cache store that should be used for these sessions. This value
|
||||
| must match with one of the application's configured cache "stores".
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the cookie used to identify a session
|
||||
| instance by ID. The name specified here will get used every time a
|
||||
| new session cookie is created by the framework for every driver.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application but you are free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => '/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the domain of the cookie used to identify a session
|
||||
| in your application. This will determine which domains the cookie is
|
||||
| available to in your application. A sensible default has been set.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you if it can not be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. You are free to modify this option if needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| do not enable this as other CSRF protection services are in place.
|
||||
|
|
||||
| Supported: "lax", "strict", "none"
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => 'lax',
|
||||
|
||||
];
|
49
config/view.php
Normal file
49
config/view.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| View Storage Paths
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Most templating systems load templates from disk. Here you may specify
|
||||
| an array of paths that should be checked for your views. Of course
|
||||
| the usual Laravel view path has already been registered for you.
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => [
|
||||
resource_path('views'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Compiled View Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines where all the compiled Blade templates will be
|
||||
| stored for your application. Typically, this is within the storage
|
||||
| directory. However, as usual, you are free to change this value.
|
||||
|
|
||||
*/
|
||||
|
||||
'compiled' => env(
|
||||
'VIEW_COMPILED_PATH',
|
||||
realpath(storage_path('framework/views'))
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Blade View Modification Checking
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| On every request the framework will check to see if a view has expired
|
||||
| to determine if it needs to be recompiled. If you are in production
|
||||
| and precompiling views this feature may be disabled to save time.
|
||||
|
|
||||
*/
|
||||
|
||||
'expires' => env('VIEW_CHECK_EXPIRATION', true),
|
||||
|
||||
];
|
2
database/.gitignore
vendored
Normal file
2
database/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.sqlite
|
||||
*.sqlite-journal
|
28
database/factories/UserFactory.php
Normal file
28
database/factories/UserFactory.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use App\User;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(User::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
});
|
36
database/migrations/2014_10_12_000000_create_users_table.php
Normal file
36
database/migrations/2014_10_12_000000_create_users_table.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateFailedJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
16
database/seeds/DatabaseSeeder.php
Normal file
16
database/seeds/DatabaseSeeder.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call(UsersTableSeeder::class);
|
||||
}
|
||||
}
|
42
docker-compose.yml
Normal file
42
docker-compose.yml
Normal file
@ -0,0 +1,42 @@
|
||||
version: "3.9"
|
||||
|
||||
networks:
|
||||
chess:
|
||||
|
||||
services:
|
||||
|
||||
# Nginx Web server
|
||||
webserver:
|
||||
image: nginx:stable-alpine
|
||||
container_name: webserver
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./:/var/www/html/
|
||||
- ./docker/nginx/site.conf:/etc/nginx/conf.d/default.conf:rw
|
||||
- ./storage:/var/www/html/storage:rw
|
||||
- ./docker/logs/nginx:/var/logs/nginx:rw
|
||||
tty: true
|
||||
ports:
|
||||
- "8300:80"
|
||||
depends_on:
|
||||
- php
|
||||
links:
|
||||
- php
|
||||
networks:
|
||||
- chess
|
||||
|
||||
# PHP Service
|
||||
php:
|
||||
container_name: php7.4
|
||||
volumes:
|
||||
- ./:/var/www/html
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
tty: true
|
||||
working_dir: /var/www/html
|
||||
networks:
|
||||
- chess
|
||||
|
||||
|
27
docker/nginx/site.conf
Normal file
27
docker/nginx/site.conf
Normal file
@ -0,0 +1,27 @@
|
||||
server {
|
||||
listen 80;
|
||||
index index.php index.html;
|
||||
server_name chess-basys.com;
|
||||
|
||||
error_log /var/log/nginx/error.log;
|
||||
access_log /var/log/nginx/access.log;
|
||||
|
||||
root /var/www/html/public;
|
||||
|
||||
client_max_body_size 100M;
|
||||
fastcgi_read_timeout 1800;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
}
|
21
index.php
Normal file
21
index.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Laravel - A PHP Framework For Web Artisans
|
||||
*
|
||||
* @package Laravel
|
||||
* @author Taylor Otwell <taylor@laravel.com>
|
||||
*/
|
||||
|
||||
$uri = urldecode(
|
||||
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
|
||||
);
|
||||
|
||||
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
|
||||
// built-in PHP web server. This provides a convenient way to test a Laravel
|
||||
// application without having installed a "real" web server software here.
|
||||
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
require_once __DIR__.'/public/index.php';
|
44
old_dockerfile1
Normal file
44
old_dockerfile1
Normal file
@ -0,0 +1,44 @@
|
||||
FROM php:7.4-fpm-alpine
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY composer.json composer.lock /var/www/html/
|
||||
|
||||
RUN apk add oniguruma-dev --no-cache postgresql-dev libxml2-dev git vim nano curl zip unzip
|
||||
RUN docker-php-ext-install \
|
||||
bcmath \
|
||||
ctype \
|
||||
fileinfo \
|
||||
json \
|
||||
mbstring \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
tokenizer \
|
||||
xml
|
||||
|
||||
# Install composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Copy existing application directory contents
|
||||
COPY . /var/www/html
|
||||
|
||||
# Install dependency
|
||||
RUN composer install --no-interaction
|
||||
|
||||
# Copy directory project permission ke container
|
||||
COPY --chown=www-data:www-data . /var/www/html
|
||||
|
||||
RUN chown -R www-data:www-data /var/www/html
|
||||
RUN chown -R www-data:www-data /var/www/html/storage
|
||||
|
||||
# Optimizing Configuration loading
|
||||
RUN php artisan optimize:clear
|
||||
|
||||
# Ganti user ke www-data
|
||||
USER www-data
|
||||
|
||||
# Expose port 9000 and start php-fpm server
|
||||
EXPOSE 9000
|
||||
|
||||
# CMD ["php-fpm"]
|
26
package.json
Normal file
26
package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"watch": "npm run development -- --watch",
|
||||
"watch-poll": "npm run watch -- --watch-poll",
|
||||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||
"prod": "npm run production",
|
||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.19",
|
||||
"bootstrap": "^4.0.0",
|
||||
"cross-env": "^7.0",
|
||||
"jquery": "^3.2",
|
||||
"laravel-mix": "^5.0.1",
|
||||
"lodash": "^4.17.13",
|
||||
"popper.js": "^1.12",
|
||||
"resolve-url-loader": "^2.3.1",
|
||||
"sass": "^1.20.1",
|
||||
"sass-loader": "^8.0.0",
|
||||
"vue": "^2.5.17",
|
||||
"vue-template-compiler": "^2.6.10"
|
||||
}
|
||||
}
|
30
phpunit.xml
Normal file
30
phpunit.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./app</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<php>
|
||||
<server name="APP_ENV" value="testing"/>
|
||||
<server name="BCRYPT_ROUNDS" value="4"/>
|
||||
<server name="CACHE_DRIVER" value="array"/>
|
||||
<server name="DB_CONNECTION" value="sqlite"/>
|
||||
<server name="DB_DATABASE" value=":memory:"/>
|
||||
<server name="MAIL_MAILER" value="array"/>
|
||||
<server name="QUEUE_CONNECTION" value="sync"/>
|
||||
<server name="SESSION_DRIVER" value="array"/>
|
||||
</php>
|
||||
</phpunit>
|
BIN
pm_css_backup.tar
Normal file
BIN
pm_css_backup.tar
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user