Initial Project Step 1

This commit is contained in:
adesyawal 2025-03-26 10:01:46 +07:00
commit ce95b9801e
10891 changed files with 1463501 additions and 0 deletions

15
.editorconfig Normal file
View 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

58
.env Normal file
View File

@ -0,0 +1,58 @@
APP_NAME="RSABHK"
APP_ENV=local
APP_KEY=base64:H3PvFH63g7VMkPboCs7CYAAfCYw/3xKTtTt2AHM1TAk=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000
IS_DEMO=false
TIMEZONE=Asia/Jakarta
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=pgsql
DB_HOST=172.16.88.22
DB_PORT=5432
DB_DATABASE=test_db_telekonsul
DB_USERNAME=simrs
DB_PASSWORD=@S1mrs.3205@
DB_CONNECTION_SMART=pgsql
DB_HOST_SMART=192.168.12.3
DB_PORT_SMART=5432
DB_DATABASE_SMART=rsab_hk_25_01_14
DB_USERNAME_SMART=postgres
DB_PASSWORD_SMART=postgres
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"

50
.env.example Normal file
View File

@ -0,0 +1,50 @@
APP_NAME="Hope UI"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://127.0.0.1:8000
IS_DEMO=false
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=HopeUi
DB_USERNAME=root
DB_PASSWORD=''
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"

5
.gitattributes vendored Normal file
View File

@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log

13
.styleci.yml Normal file
View File

@ -0,0 +1,13 @@
php:
preset: laravel
disabled:
- no_unused_imports
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true

4
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"git.ignoreLimitWarning": true,
"liveServer.settings.port": 5501
}

1
README.md Normal file
View File

@ -0,0 +1 @@
Tester

305
README.md.ori Normal file
View File

@ -0,0 +1,305 @@
<p align="center">
<a href="https://hopeui.iqonic.design/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github" target="__blank" title="Hope UI">
<img src="https://assets.iqonic.design/hope-ui/github/logo.png" />
</a>
</p>
<p align="center">
<a href="https://github.com/iqonicdesignofficial/hope-ui-design-system/" target="__blank"><img src="https://img.shields.io/github/stars/iqonicdesignofficial/hope-ui-design-system" /> </a>
<a href="https://github.com/iqonicdesignofficial/hope-ui-design-system/network" target="__blank"><img src="https://img.shields.io/github/forks/iqonicdesignofficial/hope-ui-design-system" /> </a>
<a href="https://github.com/iqonicdesignofficial/hope-ui-design-system/issues" target="__blank"><img src="https://img.shields.io/github/issues/iqonicdesignofficial/hope-ui-design-system" /> </a>
<a href="#" target="__blank"><img src="https://img.shields.io/bower/v/editor.md.svg" /> </a>
<a href="https://github.com/iqonicdesignofficial/hope-ui-design-system/blob/main/LICENSE" target="__blank"><img src="https://img.shields.io/github/license/iqonicdesignofficial/hope-ui-design-system" /> </a>
<a href="https://twitter.com/iqonicdesign" target="__blank"><img src="https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Ftwitter.com%2Fiqonicdesign" /></a>
</p>
<h3 align="center">Free Open Source Bootstrap 5 Design System.</h3>
<p align="center">
<a href="https://templates.iqonic.design/hope-ui/html/dist" title="Hope UI"><strong>Live Demo</strong></a>
<span>|</span>
<a href="https://www.figma.com/community/file/1009728454881721702" title="Hope UI"><strong>Figma UI Kit</strong></a>
<span>|</span>
<a href="https://iqonic.design/product/admin-templates/hope-ui-admin-free-open-source-bootstrap-admin-template/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github" title="Hope UI"><strong>HTML Dashboard</strong></a>
<span>|</span>
<a href="https://iqonic.design/product/admin-templates/hope-ui-open-source-vue-js-admin-template/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github" title="Hope UI"><strong>Vue JS Dashboard</strong></a>
<span>|</span>
<a href="https://iqonic.design/product/admin-templates/hope-ui-free-open-source-react-admin-template/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github" title="Hope UI"><strong>React JS Dashboard</strong></a>
<span>|</span>
<a href="https://iqonic.design/product/admin-templates/hope-ui-free-open-source-laravel-admin-panel/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github" title="Hope UI"><strong>Laravel Dashboard</strong></a>
</p>
------------
<a href="https://templates.iqonic.design/hope-ui/html/dist" target="__blank" title="Hope UI Dashboard">
<img src="https://assets.iqonic.design/hope-ui/github/rtl-mode-min.png" alt="Hope UI Dashboard" />
</a>
Hope UI free open source Bootstrap Design System is a gorgeously built UI kit based on bootstrap 5. The best free Bootstrap 5 design system is fully responsive and user-friendly, allowing Hope UI users to work effortlessly.
Being easily adaptable and flexible, Hope UI can be a go-to design system for the developer out there.
Looking up to creating a new application for a personal project or client? Hope UI free open source Bootstrap design system can help build a robust and understandable admin dashboard or website without spending much time designing the whole thing from scratch.
### What Can You Do with The Hope UI
Hope UI is packed with finely-crafted UI elements, multiple styles of Menu, a set of graphs, charts, and animated icons.
Built ideally for developers, designers, and startups, or Creators, Hope UI brings design consistency and acts as a strong foundation to manage a successful web or app project.
### 5 Irresistible Reasons To Have Hope UI
- Unlike any other Design System, Hope UI is fully responsive which facilitates business owners to view the admin panel right from their mobile screens without losing the resolution.
- With the purpose of data presentation, this best free Bootstrap 5 design system comes with extensive elements and widgets to add texts and images.
- Besides being super easy and rapidly adaptable features, Hope UI is the cost-effective way to control and overview web or app project performance with a pre-coded design system and examples.
- Hope UI is a strongly built system, a layout that focuses on both the scalability and performance of the project.
- Hope UI Packs 100+ Fully-Codes Elements and widgets backed with SCSS and Gulp to make the development easy and fast.
### Features
- Support with bootstrap 5
- Scss component based design
- Fully Responsive
- Clean Code
- Demo Pages
- Color Mode
- Working auth page
- Direction Mode
- Layout Setting
- 30+ Menu Styles
<a href="https://www.youtube.com/watch?v=3OMj6nqDuAA" title="Hope UI" target="__blank">
<img src="https://assets.iqonic.design/hope-ui/github/hope-ui-youtube.png" alt="Hope UI Video" />
</a>
# Table of Contents
- [Quick Start](#quick-start)
- [Method 1: Direct Download](#method-1-direct-download)
- [Method 2: Using CDN](#method-2-using-cdn)
- [Method 3: Using NPM](#method-3-using-npm)
- [Documentation](#documentation)
- [Version](#version)
- [Public RoadMap](#public-roadmap)
- [File Structure](#file-structure)
- [Browser Support](#browser-support)
- [Don't Buy a Coffee for Us Instead Support Us](#dont-buy-a-coffee-for-us-instead-support-us)
- [More from Iqonic Design](#more-from-iqonic-design)
- [Reporting Issues](#reporting-issues)
- [Special Thanks](#special-thanks)
- [Change Log](#change-log)
- [Follow Us](#follow-us)
- [Licensing](#licensing)
## Quick Start
You can use following method to get started with CSS and JS files of the design system.
### Method 1: Direct Download
[Dowload from Github](https://github.com/tafcoder/sleek-dashboard/archive/refs/heads/master.zip)
[Download from Iqonic Design](https://iqonic.design/product/admin-templates/hope-ui-admin-free-open-source-bootstrap-admin-template/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github)
### Method 2: Using CDN
```
<link href="https://cdn.jsdelivr.net/gh/iqonicdesignofficial/hope-ui-design-system@main/dist/assets/css/hope-ui.min.css" rel="stylesheet"/>
```
```
<script src="https://cdn.jsdelivr.net/gh/iqonicdesignofficial/hope-ui-design-system@main/dist/assets/js/hope-ui.js"></script>
```
### Method 3: Using NPM
Start working with the design system
1. Install node_modules Run in terminal or CMD:
```
npm install
```
2. Install vendor Run in terminal or CMD:
```
composer install
```
3. To build css and js for Run in terminal or CMD:
```
npm run dev
```
4. Generate Key for project in terminal or CMD:
```
cp .env.example .env
php artisan key:artisan
```
5. To run the project:
```
php artisan serve
```
[More Details...](https://templates.iqonic.design/hope-ui/documentation/html/dist/main/gulp.html)
## Documentation
You can find our documentation [here](https://templates.iqonic.design/hope-ui/documentation/html/dist/main/).
## Version
- [Figma](https://www.figma.com/community/file/1009728454881721702)
- [HTML Admin Dashboard](https://iqonic.design/product/admin-templates/hope-ui-admin-free-open-source-bootstrap-admin-template/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github)
- [Vue JS Dashobard](https://iqonic.design/product/admin-templates/hope-ui-open-source-vue-js-admin-template/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github)
- [React JS Dashobard](https://iqonic.design/product/admin-templates/hope-ui-free-open-source-react-admin-template/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github)
- [Laravel Dashobard](https://iqonic.design/product/admin-templates/hope-ui-free-open-source-laravel-admin-panel/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github)
## Public RoadMap
Checkout our public roadmap of Hope UI and also submit features requests [here](https://iqonic.design/hopeui-roadmap/).
## File Structure
Within the download you'll find the following directories and files, logically grouping common assets and providing both compiled and minified variations. You'll see something like this:
```
github/hope-ui-admin-dashboard/
laravel
├── app
│ ├── Console
│ ├── Exceptions
│ ├── Helpers
│ ├── Http
│ │ ├── Controllers
| | | ├── Auth
| | | ├── security
│ | | ├── Controller.php
│ | | ├── UserController.php
│ | | └── HomeController.php
│ │ ├── Middleware
│ │ └── lRequests
│ ├── Model
│ ├── Provider
│ └── View
├── bootstrap
├── config
├── database
├── node_modelus
├── public
│ ├── images
│ │ ├── icon.png
│ │ ├── favicon.ico
│ │ └── loader.gif
│ ├── js
| │ ├── slider-tabs.js
| │ ├── countdown.js
| | └── prism.min.js
│ └── scss
│ ├── bootstrap/
│ │ ├── forms/
│ │ ├── helper/
│ │ ├── mixins/
│ │ ├── utilites/
│ │ └── vendor/
│ ├── custom
│ │ ├── auth/
│ │ ├── kanban/
│ │ ├── pricing/
│ │ └── ui-kit/
│ ├── hope-ui-design-system
│ │ ├── components/
│ │ ├── helper/
│ │ ├── layout-style/
│ │ ├── pages/
│ │ ├── plugins/
│ │ ├── variables/
│ │ └── variables.scss
│ ├── dark
│ │ ├── components/
│ │ ├── helper/
│ │ ├── layout-style/
│ │ ├── pages/
│ │ ├── plugins/
│ │ ├── reboot/
│ │ ├── _dark.scss
│ │ └── _index.scss
│ ├── rtl
│ │ ├── components/
│ │ ├── pages/
│ │ ├── reboot/
│ │ ├── utilities/
│ │ └── _index.scss
│ ├── customizer
│ │ ├── components/
│ │ ├── layouts/
│ │ ├── menu-style/
│ │ ├── utilities/
│ │ ├── _components.scss
│ │ ├── _dark.scss
│ │ ├── _layouts.scss
│ │ ├── _reboot.scss
│ │ ├── _root.scss
│ │ └── _variables.scss
│ ├── rtl.scss
│ ├── dark.scss
│ ├── custom.scss
│ ├── customizer.scss
│ └── hope-ui.scss
├── resources
| ├── css
| ├── js
| ├── lang
| ├── sass
| └── views
│ ├── app
│ ├── auth
│ ├── chart
│ ├── components
│ ├── dashboards
│ ├── extrapages
│ ├── forms
│ ├── icons
│ ├── layouts
│ ├── pageError
│ ├── partial
│ ├── table
│ ├── timeline
│ ├── ui
│ ├── role-permission
│ ├── dashboard.blade.php
| └── welcome.blade.php
├── route
├── tests
├── .editorconfig
├── .env.example
├── .styleci.yml
├── artisan
├── composer.json
├── package.json
├── phpunit.xml
├── README.md
├── server.php
└── webpack.mix.js
```
## Browser Support
![chrome](https://assets.iqonic.design/hope-ui/github/chrome.png)
![Firefox](https://assets.iqonic.design/hope-ui/github/Firefox.png)
![Safari](https://assets.iqonic.design/hope-ui/github/Safari.png)
![Microsoft](https://assets.iqonic.design/hope-ui/github/Microsoft%20edge.png)
![Operamini](https://assets.iqonic.design/hope-ui/github/Operamini.png)
## Don't Buy a Coffee for Us Instead Support Us
- Star our GitHub repo ⭐
- [Tweet about it](https://twitter.com/intent/tweet?text=Checkout%20%23HopeUI%20%E2%80%93%20Amazing%20open-source%20Bootstrap%205%20Admin%20Dashboard%20%26%20Design%20system.%20%23BuildwithHopeUI&url=https%3A%2F%2Fbit.ly%2F3ANB7gT).
- Submit bugs, or suggest new features and documentation updates 🔧
- Follow [@iqonicdesign](https://twitter.com/iqonicdesign) on Twitter.
- Follow Us on [Instagram](https://www.instagram.com/iqonicdesign/)
- Subscribe to Iqonic newsletter at [iqonic.design](https://iqonic.design)
## More from Iqonic Design
- [Free Products Every Week](https://iqonic.design/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github)
- [Premium Themes, templates, dashbaords, Apps, and more](https://iqonic.design/shop/?iqonic=1&orderby=sales&paged=1&product_for=premium)
- [Subscribe on Youtube](https://www.youtube.com/c/IqonicDesign)
- [Reach US](https://iqonic.design/contact-us/)
## Reporting Issues
Have a bug or a feature request? Raise a new issue at our [github](https://github.com/iqonicdesignofficial/hope-ui-design-system/issues) support
## Special Thanks
- [Bootstrap](https://getbootstrap.com/)
- [Google Fonts](https://www.google.com/fonts)
- [Jquery](https://jquery.com/)
- [Apex Charts](https://apexcharts.com/)
[Checkout complete list](https://templates.iqonic.design/hope-ui/documentation/html/dist/main/sourceAndCredit.html)
## Change Log
[Click Here](https://templates.iqonic.design/hope-ui/documentation/html/dist/main/change-log.html) to check our full change log.
## Follow Us
- [Twitter](https://twitter.com/iqonicdesign)
- [Facebook](https://www.facebook.com/iqonicdesign/)
- [Dribbble](https://dribbble.com/IqonicDesign)
- [Instagram](https://www.instagram.com/iqonicdesign/)
- [Product Hunt](https://www.producthunt.com/posts/iqonic-design)
## Licensing
- Code and Documentation Copyright 2021 All Rights Reserved by [IQONIC](https://iqonic.design/?utm_source=github&utm_medium=github-description&utm_campaign=open_source_github) Design. Code released under the [MIT](https://iqonic.design/licenses/) License.

View File

@ -0,0 +1,45 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class RefreshDatabase extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'refresh:database';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
if(ENV('IS_DEMO')){
\Artisan::call('migrate:fresh --seed');
}
}
}

41
app/Console/Kernel.php Normal file
View 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('refresh:database')->twiceDaily(1, 13)->withoutOverlapping();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

@ -0,0 +1,129 @@
<?php
namespace App\DataTables;
use App\Models\User;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;
class UsersDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->editColumn('userProfile.country', function($query) {
return $query->userProfile->country ?? '-';
})
->editColumn('userProfile.company_name', function($query) {
return $query->userProfile->company_name ?? '-';
})
->editColumn('status', function($query) {
$status = 'warning';
switch ($query->status) {
case 'active':
$status = 'primary';
break;
case 'inactive':
$status = 'danger';
break;
case 'banned':
$status = 'dark';
break;
}
return '<span class="text-capitalize badge bg-'.$status.'">'.$query->status.'</span>';
})
->editColumn('created_at', function($query) {
return date('Y/m/d',strtotime($query->created_at));
})
->filterColumn('full_name', function($query, $keyword) {
$sql = "CONCAT(users.first_name,' ',users.last_name) like ?";
return $query->whereRaw($sql, ["%{$keyword}%"]);
})
->filterColumn('userProfile.company_name', function($query, $keyword) {
return $query->orWhereHas('userProfile', function($q) use($keyword) {
$q->where('company_name', 'like', "%{$keyword}%");
});
})
->filterColumn('userProfile.country', function($query, $keyword) {
return $query->orWhereHas('userProfile', function($q) use($keyword) {
$q->where('country', 'like', "%{$keyword}%");
});
})
->addColumn('action', 'users.action')
->rawColumns(['action','status']);
}
/**
* Get query source of dataTable.
*
* @param \App\Models\User $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query()
{
$model = User::query()->with('userProfile');
return $this->applyScopes($model);
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('dataTable')
->columns($this->getColumns())
->minifiedAjax()
->dom('<"row align-items-center"<"col-md-2" l><"col-md-6" B><"col-md-4"f>><"table-responsive my-3" rt><"row align-items-center" <"col-md-6" i><"col-md-6" p>><"clear">')
->parameters([
"processing" => true,
"autoWidth" => false,
]);
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
['data' => 'id', 'name' => 'id', 'title' => 'id'],
['data' => 'full_name', 'name' => 'full_name', 'title' => 'FULL NAME', 'orderable' => false],
['data' => 'phone_number', 'name' => 'phone_number', 'title' => 'Phone Number'],
['data' => 'email', 'name' => 'email', 'title' => 'Email'],
['data' => 'userProfile.country', 'name' => 'userProfile.country', 'title' => 'Country'],
['data' => 'status', 'name' => 'status', 'title' => 'Status'],
['data' => 'userProfile.company_name', 'name' => 'userProfile.company_name', 'title' => 'Company'],
['data' => 'created_at', 'name' => 'created_at', 'title' => 'Join Date'],
Column::computed('action')
->exportable(false)
->printable(false)
->searchable(false)
->width(60)
->addClass('text-center hide-search'),
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename()
{
return 'Users_' . date('YmdHis');
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace App\Helpers;
use Exception;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Auth;
class AuthHelper {
public static function authSession(){
$session = new \App\Models\User;
if(Session::has('auth_user')){
$session = Session::get('auth_user');
}else{
$user = Auth::user();
Session::put('auth_user',$user);
$session = Session::get('auth_user');
}
return $session;
}
public static function checkMenuRoleAndPermission($menu)
{
if (Auth::check()) {
if ($menu->data('role') == null && auth()->user()->hasRole('admin')) {
return true;
}
if($menu->data('permission') == null && $menu->data('role') == null) {
return true;
}
if($menu->data('role') != null) {
if(auth()->user()->hasAnyRole(explode(',', $menu->data('role')))) {
return true;
}
}
if($menu->data('permission') != null) {
if(auth()->user()->can($menu->data('permission')) ) {
return true;
}
}
}
return false;
}
public static function checkRolePermission($role,$permission){
try{
if($role->hasPermissionTo($permission)){
return true;
}
return false;
}catch (Exception $e){
return false;
}
}
public static function demoUserPermission(){
if(Auth::user()->hasRole('demo_admin')){
return true;
}else{
return false;
}
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace App\Helpers;
class DateTimeHelper {
public static function timeAgo($date)
{
if($date==null){ return '-'; }
date_default_timezone_set('UTC');
$diff_time= \Carbon\Carbon::createFromTimeStamp(strtotime($date))->diffForHumans();
return $diff_time;
}
public static function dateAgo($date,$type2='')
{
if($date==null || $date=='0000-00-00 00:00:00'){ return '-'; }
$diff_time1= \Carbon\Carbon::createFromTimeStamp(strtotime($date))->diffForHumans();
$datetime = new \DateTime($date);
$datetime->setTimezone(new \DateTimeZone(\Auth::check() ? \Auth::user()->time_zone ?? 'UTC' : 'UTC'));
$diff_time= \Carbon\Carbon::parse($datetime->format('Y-m-d H:i:s'))->isoFormat('LLL');
if($type2 != ''){ return $diff_time; }
return $diff_time1 .' on '.$diff_time;
}
public static function date($date, $format = 'd-m-Y H:i:s')
{
if($date==null || $date=='0000-00-00 00:00:00'){ return '-'; }
$datetime = new \DateTime($date);
$la_time = new \DateTimeZone(\Auth::check() ? \Auth::user()->time_zone ?? 'UTC' : 'UTC');
$datetime->setTimezone($la_time);
$newDate= $datetime->format('Y-m-d H:i:s');
$diff_time = \Carbon\Carbon::createFromTimeStamp(strtotime($newDate))->format($format);
return $diff_time;
}
public static function saveDate($date)
{
if($date==null || $date=='0000-00-00 00:00:00'){ return null; }
$datetime = new \DateTime($date);
$la_time = new \DateTimeZone(\Auth::check() ? \Auth::user()->time_zone ?? 'UTC' : 'UTC');
$datetime->setTimezone($la_time);
$newDate= $datetime->format('Y-m-d H:i:s');
$diff_time = \Carbon\Carbon::createFromTimeStamp(strtotime($newDate));
return $diff_time;
}
public static function strtotimeToDate($date)
{
if($date==null || $date=='0000-00-00 00:00:00'){ return '-'; }
date_default_timezone_set(\Auth::check() ? \Auth::user()->time_zone ?? 'UTC' : 'UTC');
$diff_time = \Carbon\Carbon::createFromTimeStamp($date);
return $diff_time;
}
}

39
app/Helpers/EnvChange.php Normal file
View File

@ -0,0 +1,39 @@
<?php
namespace App\Helpers;
class EnvChange{
public static function envChanges($type,$value){
$path = base_path('.env');
$checkType = $type.'="';
if(strpos($value,' ') || strpos(file_get_contents($path),$checkType) || preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $value)){
$value = '"'.$value.'"';
}
$value=str_replace('\\', '\\\\', $value);
if (file_exists($path)) {
if(in_array($type,config('constant.BOOLEAN_VARIABLE'))){
if($value === '1') {
$value = 'true';
}else {
$value = 'false';
}
}
if (env($type) === null){
\File::append($path, "\n".$type.'='.$value);
}else{
if(in_array($type,config('constant.BOOLEAN_VARIABLE'))){
file_put_contents($path, str_replace(
$type.'='.(env($type) ? 'true' : 'false'), $type.'='.$value, file_get_contents($path)
));
}else{
$typeValue = env($type);
if(strpos(env($type),' ') || strpos(file_get_contents($path),$checkType)){
$typeValue = '"'.env($type).'"';
}
file_put_contents($path, str_replace(
$type.'='.$typeValue, $type.'='.$value, file_get_contents($path)
));
}
}
}
}
}

100
app/Helpers/helper.php Normal file
View File

@ -0,0 +1,100 @@
<?php
function removeSession($session){
if(\Session::has($session)){
\Session::forget($session);
}
return true;
}
function randomString($length,$type = 'token'){
if($type == 'password')
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
elseif($type == 'username')
$chars = "abcdefghijklmnopqrstuvwxyz0123456789";
else
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$token = substr( str_shuffle( $chars ), 0, $length );
return $token;
}
function activeRoute($route, $isClass = false): string
{
$requestUrl = request()->fullUrl() === $route ? true : false;
if($isClass) {
return $requestUrl ? $isClass : '';
} else {
return $requestUrl ? 'active' : '';
}
}
function checkRecordExist($table_list,$column_name,$id){
if(count($table_list) > 0){
foreach($table_list as $table){
$check_data = \DB::table($table)->where($column_name,$id)->count();
if($check_data > 0) return false ;
}
return true;
}
return true;
}
// Model file save to storage by spatie media library
function storeMediaFile($model,$file,$name)
{
if($file) {
$model->clearMediaCollection($name);
if (is_array($file)){
foreach ($file as $key => $value){
$model->addMedia($value)->toMediaCollection($name);
}
}else{
$model->addMedia($file)->toMediaCollection($name);
}
}
return true;
}
// Model file get by storage by spatie media library
function getSingleMedia($model, $collection = 'image_icon',$skip=true)
{
if (!\Auth::check() && $skip) {
return asset('images/avatars/01.png');
}
if ($model !== null) {
$media = $model->getFirstMedia($collection);
}
$imgurl= isset($media)?$media->getPath():'';
if (file_exists($imgurl)) {
return $media->getFullUrl();
}
else
{
switch ($collection) {
case 'image_icon':
$media = asset('images/avatars/01.png');
break;
case 'profile_image':
$media = asset('images/avatars/01.png');
break;
default:
$media = asset('images/common/add.png');
break;
}
return $media;
}
}
// File exist check
function getFileExistsCheck($media)
{
$mediaCondition = false;
if($media) {
if($media->disk == 'public') {
$mediaCondition = file_exists($media->getPath());
} else {
$mediaCondition = \Storage::disk($media->disk)->exists($media->getPath());
}
}
return $mediaCondition;
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Spatie\Permission\Models\Role;
class AuthenticatedSessionController extends Controller
{
/**
* Display the login view.
*
* @return \Illuminate\View\View
*/
public function create()
{
return view('auth.login');
}
/**
* Handle an incoming authentication request.
*
* @param \App\Http\Requests\Auth\LoginRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(LoginRequest $request)
{
$request->authenticate();
$request->session()->regenerate();
return redirect(RouteServiceProvider::HOME);
}
/**
* Destroy an authenticated session.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Request $request)
{
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/');
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
class ConfirmablePasswordController extends Controller
{
/**
* Show the confirm password view.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function show(Request $request)
{
return view('auth.confirm-password');
}
/**
* Confirm the user's password.
*
* @param \Illuminate\Http\Request $request
* @return mixed
*/
public function store(Request $request)
{
if (! Auth::guard('web')->validate([
'email' => $request->user()->email,
'password' => $request->password,
])) {
throw ValidationException::withMessages([
'password' => __('auth.password'),
]);
}
$request->session()->put('auth.password_confirmed_at', time());
return redirect()->intended(RouteServiceProvider::HOME);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
class EmailVerificationNotificationController extends Controller
{
/**
* Send a new email verification notification.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(RouteServiceProvider::HOME);
}
$request->user()->sendEmailVerificationNotification();
return back()->with('status', 'verification-link-sent');
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
class EmailVerificationPromptController extends Controller
{
/**
* Display the email verification prompt.
*
* @param \Illuminate\Http\Request $request
* @return mixed
*/
public function __invoke(Request $request)
{
return $request->user()->hasVerifiedEmail()
? redirect()->intended(RouteServiceProvider::HOME)
: view('auth.verify-email');
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
class NewPasswordController extends Controller
{
/**
* Display the password reset view.
*
* @return \Illuminate\View\View
*/
public function create(Request $request)
{
return view('auth.reset-password', ['request' => $request]);
}
/**
* Handle an incoming new password request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request)
{
$request->validate([
'token' => 'required',
'email' => 'required|email',
'password' => 'required|string|confirmed|min:8',
]);
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$status = Password::reset(
$request->only('email', 'password', 'password_confirmation', 'token'),
function ($user) use ($request) {
$user->forceFill([
'password' => Hash::make($request->password),
'remember_token' => Str::random(60),
])->save();
event(new PasswordReset($user));
}
);
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
return $status == Password::PASSWORD_RESET
? redirect()->route('login')->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
class PasswordResetLinkController extends Controller
{
/**
* Display the password reset link request view.
*
* @return \Illuminate\View\View
*/
public function create()
{
return view('auth.forgot-password');
}
/**
* Handle an incoming password reset link request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request)
{
$request->validate([
'email' => 'required|email',
]);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$status = Password::sendResetLink(
$request->only('email')
);
return $status == Password::RESET_LINK_SENT
? back()->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
class RegisteredUserController extends Controller
{
/**
* Display the registration view.
*
* @return \Illuminate\View\View
*/
public function create()
{
return view('auth.register');
}
/**
* Handle an incoming registration request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request)
{
$request->validate([
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|confirmed|min:8',
]);
Auth::login($user = User::create([
'username' => strtolower($request->first_name).strtolower($request->last_name),
'first_name' => $request->first_name,
'last_name' => $request->last_name,
'phone_number' => $request->phone_number,
'email' => $request->email,
'password' => Hash::make($request->password),
'user_type' => 'user'
]));
$user->assignRole('user');
event(new Registered($user));
return redirect(RouteServiceProvider::HOME);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Auth\Events\Verified;
use Illuminate\Foundation\Auth\EmailVerificationRequest;
class VerifyEmailController extends Controller
{
/**
* Mark the authenticated user's email address as verified.
*
* @param \Illuminate\Foundation\Auth\EmailVerificationRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(EmailVerificationRequest $request)
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
}
if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers\Dokter;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Dokter\Partial\PartialController;
use DB;
class DokterViewController extends Controller
{
public function ViewDashboardDokter(Request $request)
{
$getDataPD = PartialController::identitasPasien('pdnorec', $request->pdnorec);
$dataReturn['pdnorec'] = $request->pdnorec;
$dataReturn['pasien_identitas'] = $getDataPD[0];
$assets = ['chart', 'animation'];
return view('dokter.dashboard-pasien')->with("data", $dataReturn);
}
}

View File

@ -0,0 +1,234 @@
<?php
namespace App\Http\Controllers\Dokter\EMR\CPPT;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Dokter\Partial\PartialController;
use DB;
use Auth;
class CpptController extends Controller
{
public function viewSoapCPPT(Request $request)
{
$getDataPD = PartialController::identitasPasien('pdnorec', $request->pdnorec);
$dataHistoryCPPT = DB::connection('smart')->select("
select
pasiendaftar_t.norec as pd_norec,
pegawai_m.namalengkap,
pasiendaftar_t.noregistrasi,
ruangan_m.id as id_ruangan,
ruangan_m.namaruangan,
case when cppt_t.flag_ = 1 then 'SOAP' when cppt_t.flag_ = 3 then 'SOAPIE' else 'TBAK' end as keterangan,
cppt_t.norec as cpptnorec,
cppt_t.tglinput,
cppt_t.s,
cppt_t.o,
cppt_t.a,
cppt_t.p,
cppt_t.cppt_i,
cppt_t.cppt_e,
cppt_t.tbak,
cppt_t.pegawaifk
from
cppt_t inner join
pegawai_m on cppt_t.pegawaifk = pegawai_m.id inner join
antrianpasiendiperiksa_t on cppt_t.noregistrasifk = antrianpasiendiperiksa_t.norec inner join
pasiendaftar_t on antrianpasiendiperiksa_t.noregistrasifk = pasiendaftar_t.norec inner join
ruangan_m on cppt_t.ruanganfk = ruangan_m.id
where
cppt_t.statusenabled is true
and cppt_t.flag_ in (1,3,4)
and cppt_t.isverifikasi is true
and cppt_t.pasienfk = ?
order by
cppt_t.tglinput desc
limit 10
", array($getDataPD[0]->nocmfk));
$dataHistoryResep = DB::connection('smart')->select("
select
strukorder_t.tglorder,
pegawai_m.namalengkap
from
t_resep_dokter inner join
strukorder_t on t_resep_dokter.strukorderfk = strukorder_t.norec inner join
pegawai_m on strukorder_t.objectpegawaiorderfk = pegawai_m.id
where
t_resep_dokter.statusenabled is true
and strukorder_t.statusenabled is true
and strukorder_t.nocmfk = ?
order by
strukorder_t.tglorder desc
limit 10
", array($getDataPD[0]->nocmfk));
$dataMasterObat = DB::connection('smart')->select("
select
produk_m.id,
produk_m.namaproduk
from
produk_m inner join
detailjenisproduk_m on produk_m.objectdetailjenisprodukfk = detailjenisproduk_m.id
where
detailjenisproduk_m.objectjenisprodukfk = 97
AND produk_m.statusenabled IS true
order by
namaproduk
limit 20
");
$dataReturn['pdnorec'] = $request->pdnorec;
$dataReturn['pasien_identitas'] = $getDataPD[0];
$dataReturn['his_cppt'] = $dataHistoryCPPT;
$dataReturn['his_resep'] = $dataHistoryResep;
$dataReturn['master_obat'] = $dataMasterObat;
return view('dokter.emr.form.soap')->with("data", $dataReturn);
}
public function formSoapCPPT(Request $request)
{
$getDataPD = PartialController::identitasPasien('pdnorec', $request->pdnorec);
if(isset($request->cpptnorec)){
$dataHistoryCPPT = DB::connection('smart')->select("
select
pasiendaftar_t.norec as pd_norec,
pegawai_m.namalengkap,
pasiendaftar_t.noregistrasi,
ruangan_m.id as id_ruangan,
ruangan_m.namaruangan,
case when cppt_t.flag_ = 1 then 'SOAP' when cppt_t.flag_ = 3 then 'SOAPIE' else 'TBAK' end as keterangan,
cppt_t.norec as cpptnorec,
cppt_t.tglinput,
cppt_t.s,
cppt_t.o,
cppt_t.a,
cppt_t.p,
cppt_t.cppt_i,
cppt_t.cppt_e,
cppt_t.tbak,
cppt_t.pegawaifk
from
cppt_t inner join
pegawai_m on cppt_t.pegawaifk = pegawai_m.id inner join
antrianpasiendiperiksa_t on cppt_t.noregistrasifk = antrianpasiendiperiksa_t.norec inner join
pasiendaftar_t on antrianpasiendiperiksa_t.noregistrasifk = pasiendaftar_t.norec inner join
ruangan_m on cppt_t.ruanganfk = ruangan_m.id
where
cppt_t.statusenabled is true
and cppt_t.flag_ in (1,3,4)
and cppt_t.isverifikasi is true
and cppt_t.norec = ?
order by
cppt_t.tglinput desc
limit 10
", array($request->cpptnorec));
}
$dataReturn['pdnorec'] = $request->pdnorec;
$dataReturn['cpptnorec'] = (isset($request->cpptnorec) ? $request->cpptnorec : null);
$dataReturn['pasien_identitas'] = $getDataPD[0];
$dataReturn['his_cppt'] = (isset($request->cpptnorec)) ? $dataHistoryCPPT[0] : [];
return view('dokter.emr.form.soap-form')->with("data", $dataReturn);
}
public function simpanSoapCPPT(Request $request)
{
//dd($request->all());
//dd(Auth::user()->smart_pk);
DB::connection('smart')->beginTransaction();
try {
$cppt_t = [
'norec' => $this->generateNorecSmartV1(),
'kdprofile' => 0,
'statusenabled' => 't',
'tglinput' => date('Y-m-d H:i:s'),
'isverifikasi' => true,
'pasienfk' => $request->pasienfk,
'pegawaifk' => 88,
'noregistrasifk' => $request->noregistrasifk,
'ruanganfk' => $request->ruanganfk,
's' => $request->s,
'o' => $request->o,
'a' => $request->a,
'p' => $request->p,
'flag_' => 1,
];
DB::connection('smart')->table('cppt_t')->insert([
'norec' => $this->generateNorecSmartV1(),
'kdprofile' => 0,
'statusenabled' => 't',
'tglinput' => date('Y-m-d H:i:s'),
'isverifikasi' => true,
'pasienfk' => $request->pasienfk,
'pegawaifk' => 88,
'noregistrasifk' => $request->noregistrasifk,
'ruanganfk' => $request->ruanganfk,
's' => $request->s,
'o' => $request->o,
'a' => $request->a,
'p' => $request->p,
'flag_' => 1,
]);
DB::connection('smart')->commit();
return redirect()->route('dokter.emr.soap.view', ['pdnorec' => $request->pdnorec])->with('success','SOAP Berhasil Disimpan.');
} catch (\Exception $e) {
DB::connection('smart')->rollBack();
return back()->with('error', 'Data gagal disimpan, mohon periksa kembali inputan anda.');
}
}
public function updateSoapCPPT(Request $request)
{
DB::connection('smart')->beginTransaction();
try {
DB::connection('smart')->table('cppt_t')->where('norec', '=', $request->cpptnorec)->update([
's' => $request->s,
'o' => $request->o,
'a' => $request->a,
'p' => $request->p,
]);
DB::connection('smart')->commit();
return redirect()->route('dokter.emr.soap.view', ['pdnorec' => $request->pdnorec])->with('success','Edit SOAP Berhasil.');
} catch (\Exception $e) {
DB::connection('smart')->rollBack();
return back()->with('error', 'Data gagal disimpan, mohon periksa kembali inputan anda.');
}
}
public function deleteSoapCPPT(Request $request)
{
DB::connection('smart')->beginTransaction();
try {
DB::connection('smart')->table('cppt_t')->where('norec', '=', $request->cpptnorec)->update([
'statusenabled' => false
]);
DB::connection('smart')->commit();
return redirect()->route('dokter.emr.soap.view', ['pdnorec' => $request->pdnorec])->with('success','Batal SOAP Berhasil.');
} catch (\Exception $e) {
DB::connection('smart')->rollBack();
return back()->with('error', 'Gagal Delete Data.');
}
}
public function generateNorecSmartV1(){
return str_replace("-","",strtolower(Str::uuid()->toString()));
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers\Dokter;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;
use Auth;
class ListPasienTelekonsultasiController extends Controller
{
public function ListPasienTelekonsultasi(Request $request)
{
//$dateStart = (isset($request->tanggal)) ? $request->tanggal.' 00:00:00' : date('2025-01-01 00:00:00');
//$dateEnd = (isset($request->tanggal)) ? $request->tanggal.' 23:59:59' : date('2025-03-30 23:59:59');
$pegawaiLogin = Auth::user()->smart_pk;
$dateStart = (isset($request->tanggal)) ? $request->tanggal.' 00:00:00' : date('Y-m-d 00:00:00');
$dateEnd = (isset($request->tanggal)) ? $request->tanggal.' 23:59:59' : date('Y-m-d 23:59:59');
$dataReturn = DB::connection('smart')->select("
select distinct
pasiendaftar_telekonsultasi.noregistrasi_telekonsultasi as noregistrasi,
pasien_m.nocm as nomr,
pasien_m.namapasien as namapasien,
jeniskelamin_m.jeniskelamin,
pasien_m.tgllahir as tgllahir,
pasiendaftar_telekonsultasi.tanggal_rencana_telekonsultasi as tgljamtelekonsultasi,
case when bayar_telekonsultasi.bayar_telekonsultasi_id is not null then 'Sudah Bayar' else 'Menunggu Pembayaran' end as statuspembayaran,
case when zoom_telekonsultasi.link_zoom is not null then zoom_telekonsultasi.link_zoom else null end as linkzoom,
(case
when pasiendaftar_t.norec is null then 'Belum Terdaftar'
else
case when cppt_t.norec is not null then 'Sudah CPPT' else 'Belum CPPT' end
end
) as statuspelayanan,
pasiendaftar_t.norec as pdnorec
from
pasiendaftar_telekonsultasi inner join
pasien_m on pasien_m.id = pasiendaftar_telekonsultasi.pasien_id left outer join
jeniskelamin_m on jeniskelamin_m.id = pasien_m.objectjeniskelaminfk left outer join
pasiendaftar_t on pasiendaftar_telekonsultasi.noregistrasi_pd = pasiendaftar_t.noregistrasi and pasiendaftar_t.statusenabled is true left outer join
antrianpasiendiperiksa_t on antrianpasiendiperiksa_t.noregistrasifk = pasiendaftar_t.norec left outer join
cppt_t on antrianpasiendiperiksa_t.norec = cppt_t.noregistrasifk and cppt_t.statusenabled is true left outer join
bayar_telekonsultasi on bayar_telekonsultasi.pasiendaftar_telekonsultasi_id = pasiendaftar_telekonsultasi.pasiendaftar_telekonsultasi_id left outer join
zoom_telekonsultasi on zoom_telekonsultasi.pasiendaftar_telekonsultasi_id = pasiendaftar_telekonsultasi.pasiendaftar_telekonsultasi_id
where
pasiendaftar_telekonsultasi.statusenabled is true
and pasiendaftar_telekonsultasi.tanggal_rencana_telekonsultasi >= ? and pasiendaftar_telekonsultasi.tanggal_rencana_telekonsultasi <= ?
and (pasiendaftar_telekonsultasi.dokter_pegawai_id = ? OR pasiendaftar_t.objectpegawaifk = ?)
", array(
$dateStart,
$dateEnd,
$pegawaiLogin,
$pegawaiLogin
));
$dataSudahBayar = array_filter($dataReturn, function ($val) {
return ($val->statuspembayaran == 'Sudah Bayar');
});
$dataSudahDilayani = array_filter($dataReturn, function ($val) {
return ($val->statuspelayanan == 'Sudah CPPT');
});
$returnDataToFront['list'] = $dataReturn;
$returnDataToFront['terdaftar'] = count($dataReturn);
$returnDataToFront['sudahbayar'] = count($dataSudahBayar);
$returnDataToFront['sudahdilayani'] = count($dataSudahDilayani);
$returnDataToFront['belumdilayani'] = $returnDataToFront['sudahbayar'] - $returnDataToFront['sudahdilayani'];
$assets = ['chart', 'animation'];
return view('dokter.list-pasien-telekonsultasi', compact('assets'))->with("data", $returnDataToFront);
}
}

View File

@ -0,0 +1,288 @@
<?php
namespace App\Http\Controllers\Dokter\Order;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Dokter\Partial\PartialController;
use DB;
use Auth;
class PeresepanObatController extends Controller
{
public function viewPeresepanObat(Request $request)
{
$getDataPD = PartialController::identitasPasien('pdnorec', $request->pdnorec);
$dataHistoryResep = DB::connection('smart')->select("
select
t_resep_dokter.strukorderfk,
strukorder_t.tglorder,
pegawai_m.namalengkap,
jeniskemasan_m.jeniskemasan,
t_resep_dokter.namaobat,
t_resep_dokter.keteranganpakai,
t_resep_dokter.keteranganlainnya,
t_resep_dokter.racikanke,
t_resep_dokter.qtyproduk
from
t_resep_dokter inner join
strukorder_t on t_resep_dokter.strukorderfk = strukorder_t.norec inner join
pegawai_m on strukorder_t.objectpegawaiorderfk = pegawai_m.id inner join
jeniskemasan_m on jeniskemasan_m.id = t_resep_dokter.jeniskemasanfk
where
t_resep_dokter.statusenabled is true
and strukorder_t.statusenabled is true
and strukorder_t.nocmfk = ?
order by
strukorder_t.tglorder desc
limit 10
", array($getDataPD[0]->nocmfk));
if(!empty($dataHistoryResep)){
$listNorecOrderan = [];
$returnData = [];
foreach($dataHistoryResep as $key => $value){
array_push($listNorecOrderan, $value->strukorderfk);
$dataRacikenke[$value->strukorderfk]['racikanke'][] = $value->racikanke;
$dataRacikenke[$value->strukorderfk][$value->racikanke]['jeniskemasan'][] = $value->jeniskemasan;
$dataRacikenke[$value->strukorderfk][$value->racikanke]['keterangan'][] = $value->keteranganpakai;
$dataRacikenke[$value->strukorderfk][$value->racikanke]['keteranganlainnya'][] = $value->keteranganlainnya;
$dataHead[$value->strukorderfk]['namalengkap'] = $value->namalengkap;
$dataHead[$value->strukorderfk]['tglorder'] = $value->tglorder;
$dataHead[$value->strukorderfk]['tglorder'] = $value->tglorder;
}
$listNorecOrderan = array_unique($listNorecOrderan);
foreach($listNorecOrderan as $perResep){
$dataRacikanKeUniq = array_unique($dataRacikenke[$perResep]['racikanke']);
$detailResep = [];
foreach($dataRacikanKeUniq as $dataRacikanKe => $valRacikanKe){
$dataJenisKemasanUniq = array_unique($dataRacikenke[$perResep][$valRacikanKe]['jeniskemasan']);
$dataKeteranganUniq = array_unique($dataRacikenke[$perResep][$valRacikanKe]['keterangan']);
$dataKeteranganLainnyaUniq = array_unique($dataRacikenke[$perResep][$valRacikanKe]['keteranganlainnya']);
$afterFilterDetails = array_filter($dataHistoryResep, function ($val) use ($perResep, $valRacikanKe) {
return ($val->strukorderfk == $perResep && $val->racikanke == $valRacikanKe);
});
array_push($detailResep, array(
'racikanke' => $valRacikanKe,
'jeniskemasan' => $dataJenisKemasanUniq[0],
'keteranganpakai' => $dataKeteranganUniq[0],
'keteranganlainnya' => $dataKeteranganLainnyaUniq[0],
'details' => $afterFilterDetails
));
}
array_push($returnData, array(
'norecOrder' => $perResep,
'namalengkap' => $dataHead[$perResep]['namalengkap'],
'tglorder' => $dataHead[$perResep]['tglorder'],
'detail' => $detailResep
));
}
}
$dataMasterObat = DB::connection('smart')->select("
select
produk_m.id,
produk_m.namaproduk
from
produk_m inner join
detailjenisproduk_m on produk_m.objectdetailjenisprodukfk = detailjenisproduk_m.id
where
detailjenisproduk_m.objectjenisprodukfk = 97
AND produk_m.statusenabled IS true
order by
namaproduk
limit 20
");
$dataReturn['pdnorec'] = $request->pdnorec;
$dataReturn['pasien_identitas'] = $getDataPD[0];
$dataReturn['his_resep'] = $returnData;
$dataReturn['master_obat'] = $dataMasterObat;
//dd($dataReturn);
return view('dokter.order.form.resep')->with("data", $dataReturn);
}
public function formPeresepanObat(Request $request)
{
$getDataPD = PartialController::identitasPasien('pdnorec', $request->pdnorec);
$dataHistoryResep = DB::connection('smart')->select("
select
strukorder_t.tglorder,
pegawai_m.namalengkap
from
t_resep_dokter inner join
strukorder_t on t_resep_dokter.strukorderfk = strukorder_t.norec inner join
pegawai_m on strukorder_t.objectpegawaiorderfk = pegawai_m.id
where
t_resep_dokter.statusenabled is true
and strukorder_t.statusenabled is true
and strukorder_t.nocmfk = ?
order by
strukorder_t.tglorder desc
limit 10
", array($getDataPD[0]->nocmfk));
$dataMasterObat = DB::connection('smart')->select("
select
produk_m.id,
produk_m.namaproduk,
detailjenisproduk_m.id as detid,
detailjenisproduk_m.detailjenisproduk
from
produk_m inner join
detailjenisproduk_m on produk_m.objectdetailjenisprodukfk = detailjenisproduk_m.id
where
detailjenisproduk_m.objectjenisprodukfk = 97
AND produk_m.statusenabled IS true
and detailjenisproduk_m.statusenabled is true
and detailjenisproduk_m.id in (474,1474,1346)
order by
namaproduk
");
$dataReturn['pdnorec'] = $request->pdnorec;
$dataReturn['pasien_identitas'] = $getDataPD[0];
$dataReturn['his_resep'] = $dataHistoryResep;
$dataReturn['master_obat'] = $dataMasterObat;
$assets = ['pro','select2'];
return view('dokter.order.form.resep-form', compact('assets'))->with("data", $dataReturn);
}
public function SimpanPeresepanObat(Request $request)
{
DB::connection('smart')->beginTransaction();
try {
$now = date('Y-m-d H:i:s');
$registrasiDetail = DB::connection('smart')->table('antrianpasiendiperiksa_t as apd')
->JOIN('pasiendaftar_t as pd','pd.norec','=','apd.noregistrasifk')
->select('pd.norec','pd.nocmfk','apd.objectruanganfk','pd.objectkelasfk','apd.norec as apdnorec')
->where('apd.norec',$request->noregistrasifk)
->first();
$newId = DB::connection('smart')->table('strukorder_t')->where('noorder','like',date('Ym').'%')->max('noorder');
$newId = substr(trim($newId),4);
$newId = (int)$newId + 1;
$noOrder = date('Ym'). str_pad($newId, 6, "0", STR_PAD_LEFT);
$strukOrder = [
'norec' => $this->generateNorecSmartV1(),
'kdprofile' => 0,
'statusenabled' => 't',
'nocmfk' => $registrasiDetail->nocmfk,
'kddokter' => $request->penulisresepfk,
'objectjenisorderfk' => 5,
'isdelivered' => 1,
'objectkelompoktransaksifk' => 4,
'keteranganorder' => 'Order Farmasi',
'noorder' => $noOrder,
'noregistrasifk' => $registrasiDetail->norec,
'objectpegawaiorderfk' => $request->penulisresepfk,
'qtyproduk' => 0,
'qtyjenisproduk' => 0,
'objectruanganfk' => $registrasiDetail->objectruanganfk,
'objectruangantujuanfk' => $this->getRuanganTujuanOrderFarmasi($registrasiDetail->objectruanganfk),
'statusorder' => 0,
'tglorder' => $now,
'totalbeamaterai' => 0,
'totalbiayakirim' => 0,
'totalbiayatambahan' => 0,
'totaldiscount' => 0,
'totalhargasatuan' => 0,
'totalharusdibayar' => 0,
'totalpph' => 0,
'totalppn' => 0,
'masalah' => $request->riwayatalergi,
'diagnosis' => $request->beratbadan,
'cito' => (isset($request->cito) && $request->cito == 'on') ? true : false,
'ispickup' => (isset($request->pulang) && $request->pulang == 'on') ? true : false,
'alamattempattujuan' => 'Tidak',
];
DB::connection('smart')->table('strukorder_t')->insert($strukOrder);
foreach($request->resepdokter as $listItemObat){
$resepDokter = [
'norec' => $this->generateNorecSmartV1(),
'statusenabled' => 't',
'noorderfk' => $strukOrder['norec'],
'qtyproduk' => $listItemObat['jumlah'],
'objectruanganfk' => $registrasiDetail->objectruanganfk,
'strukorderfk' => $strukOrder['norec'],
'racikanke' => $listItemObat['rke'],
'jenisobatfk' => 5,
'jeniskemasanfk' => $listItemObat['jeniskemasanfk'],
'keteranganlainnya' => $listItemObat['keteranganlainnya'],
'keteranganpakai' =>$listItemObat['keteranganpakai'],
'namaobat' => $listItemObat['namaobat'],
];
DB::connection('smart')->table('t_resep_dokter')->insert($resepDokter);
}
DB::connection('smart')->commit();
return redirect()->route('dokter.order.resep.view', ['pdnorec' => $request->pdnorec])->with('success','Resep Berhasil Disimpan.');
} catch (\Exception $e) {
DB::connection('smart')->rollBack();
return back()->with('error', 'Data gagal disimpan, mohon periksa kembali inputan anda.');
}
}
public function generateNorecSmartV1(){
return str_replace("-","",strtolower(Str::uuid()->toString()));
}
public function getRuanganTujuanOrderFarmasi($asalOrder){
if($asalOrder==491){
return 116;
} elseif ($asalOrder==510) {
return 116;
} elseif ($asalOrder==511) {
return 116;
} elseif ($asalOrder==512) {
return 116;
} elseif ($asalOrder==514) {
return 116;
} elseif ($asalOrder==517) {
return 116;
} elseif ($asalOrder==518) {
return 116;
} elseif ($asalOrder==519) {
return 116;
} elseif ($asalOrder==520) {
return 116;
} elseif ($asalOrder==521) {
return 116;
} elseif ($asalOrder==522) {
return 116;
} elseif ($asalOrder==523) {
return 116;
} elseif ($asalOrder==525) {
return 116;
} elseif ($asalOrder==531) {
return 116;
} elseif ($asalOrder==533) {
return 116;
} elseif ($asalOrder==534) {
return 116;
} else {
return 94;
}
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace App\Http\Controllers\Dokter\Partial;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use App\Http\Controllers\Controller;
use DB;
use Auth;
class PartialController extends Controller
{
public function identitasPasien($tipeFilter, $parameter)
{
$getDataPD = DB::connection('smart')->select("
select
pasiendaftar_t.norec as pd_norec,
pasien_m.id as nocmfk,
pasien_m.nocm,
pasien_m.namapasien,
jeniskelamin_m.jeniskelamin,
pasien_m.tgllahir,
DATE_PART('YEAR', AGE(NOW(), pasien_m.tgllahir)) as umur_as_year,
DATE_PART('MONTH', AGE(NOW(), pasien_m.tgllahir)) as umur_as_month,
DATE_PART('DAY', AGE(NOW(), pasien_m.tgllahir)) as umur_as_day,
pasiendaftar_t.noregistrasi,
pasiendaftar_t.tglregistrasi,
ruangan_m.id as id_ruangan,
ruangan_m.namaruangan,
pegawai_m.namalengkap,
kelompokpasien_m.kelompokpasien,
(
select
antrianpasiendiperiksa_t.norec as apd_norec
from
antrianpasiendiperiksa_t
where
antrianpasiendiperiksa_t.noregistrasifk = pasiendaftar_t.norec
and antrianpasiendiperiksa_t.statusenabled is true
and antrianpasiendiperiksa_t.objectruanganfk = pasiendaftar_t.objectruanganlastfk
order by
antrianpasiendiperiksa_t.tglmasuk desc
limit 1
) as apd_norec
from
pasiendaftar_t inner join
pasien_m on pasiendaftar_t.nocmfk = pasien_m.id inner join
jeniskelamin_m on pasien_m.objectjeniskelaminfk = jeniskelamin_m.id inner join
ruangan_m on pasiendaftar_t.objectruanganlastfk = ruangan_m.id inner join
pegawai_m on pasiendaftar_t.objectpegawaifk = pegawai_m.id inner join
kelompokpasien_m on pasiendaftar_t.objectkelompokpasienlastfk = kelompokpasien_m.id
where
pasiendaftar_t.norec = ?
", array($parameter));
return $getDataPD;
}
}

View File

@ -0,0 +1,237 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/*
* Dashboard Pages Routs
*/
public function index(Request $request)
{
$assets = ['chart', 'animation'];
return view('dashboards.dashboard', compact('assets'));
}
/*
* Menu Style Routs
*/
public function horizontal(Request $request)
{
$assets = ['chart', 'animation'];
return view('menu-style.horizontal',compact('assets'));
}
public function dualhorizontal(Request $request)
{
$assets = ['chart', 'animation'];
return view('menu-style.dual-horizontal',compact('assets'));
}
public function dualcompact(Request $request)
{
$assets = ['chart', 'animation'];
return view('menu-style.dual-compact',compact('assets'));
}
public function boxed(Request $request)
{
$assets = ['chart', 'animation'];
return view('menu-style.boxed',compact('assets'));
}
public function boxedfancy(Request $request)
{
$assets = ['chart', 'animation'];
return view('menu-style.boxed-fancy',compact('assets'));
}
/*
* Pages Routs
*/
public function billing(Request $request)
{
return view('special-pages.billing');
}
public function calender(Request $request)
{
$assets = ['calender'];
return view('special-pages.calender',compact('assets'));
}
public function kanban(Request $request)
{
return view('special-pages.kanban');
}
public function pricing(Request $request)
{
return view('special-pages.pricing');
}
public function rtlsupport(Request $request)
{
return view('special-pages.rtl-support');
}
public function timeline(Request $request)
{
return view('special-pages.timeline');
}
/*
* Widget Routs
*/
public function widgetbasic(Request $request)
{
return view('widget.widget-basic');
}
public function widgetchart(Request $request)
{
$assets = ['chart'];
return view('widget.widget-chart', compact('assets'));
}
public function widgetcard(Request $request)
{
return view('widget.widget-card');
}
/*
* Maps Routs
*/
public function google(Request $request)
{
return view('maps.google');
}
public function vector(Request $request)
{
return view('maps.vector');
}
/*
* Auth Routs
*/
public function signin(Request $request)
{
return view('auth.login');
}
public function signup(Request $request)
{
return view('auth.register');
}
public function confirmmail(Request $request)
{
return view('auth.confirm-mail');
}
public function lockscreen(Request $request)
{
return view('auth.lockscreen');
}
public function recoverpw(Request $request)
{
return view('auth.recoverpw');
}
public function userprivacysetting(Request $request)
{
return view('auth.user-privacy-setting');
}
/*
* Error Page Routs
*/
public function error404(Request $request)
{
return view('errors.error404');
}
public function error500(Request $request)
{
return view('errors.error500');
}
public function maintenance(Request $request)
{
return view('errors.maintenance');
}
/*
* uisheet Page Routs
*/
public function uisheet(Request $request)
{
return view('auth.login');
}
/*
* Form Page Routs
*/
public function element(Request $request)
{
return view('forms.element');
}
public function wizard(Request $request)
{
return view('forms.wizard');
}
public function validation(Request $request)
{
return view('forms.validation');
}
/*
* Table Page Routs
*/
public function bootstraptable(Request $request)
{
return view('table.bootstraptable');
}
public function datatable(Request $request)
{
return view('table.datatable');
}
/*
* Icons Page Routs
*/
public function solid(Request $request)
{
return view('icons.solid');
}
public function outline(Request $request)
{
return view('icons.outline');
}
public function dualtone(Request $request)
{
return view('icons.dualtone');
}
public function colored(Request $request)
{
return view('icons.colored');
}
/*
* Extra Page Routs
*/
public function privacypolicy(Request $request)
{
return view('privacy-policy');
}
public function termsofuse(Request $request)
{
return view('terms-of-use');
}
// Customize By Ade
public function cppt(Request $request)
{
return view('emr.forms.cppt');
}
}

View File

@ -0,0 +1,88 @@
<?php
namespace App\Http\Controllers\Security;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Spatie\Permission\Models\Permission;
class PermissionController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//code here
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request)
{
$data = $request->all();
$view = view('role-permission.form-permission')->render();
return response()->json(['data' => $view, 'status'=> true]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//code here
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//code here
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//code here
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//code here
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//code here
}
}

View File

@ -0,0 +1,88 @@
<?php
namespace App\Http\Controllers\Security;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Spatie\Permission\Models\Role;
class RoleController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//code here
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(Request $request)
{
$data = $request->all();
$view = view('role-permission.form-role')->render();
return response()->json(['data' => $view, 'status'=> true]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//code here
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//code here
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//code here
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//code here
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//code here
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Security;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
class RolePermission extends Controller
{
public function index(Request $request)
{
$roles = Role::get();
$permissions = Permission::get();
return view('role-permission.permissions', compact('roles', 'permissions'));
}
public function store(Request $request)
{
//code here
}
}

View File

@ -0,0 +1,164 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\DataTables\UsersDataTable;
use App\Models\User;
use App\Helpers\AuthHelper;
use Spatie\Permission\Models\Role;
use App\Http\Requests\UserRequest;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(UsersDataTable $dataTable)
{
$pageTitle = trans('global-message.list_form_title',['form' => trans('users.title')] );
$auth_user = AuthHelper::authSession();
$assets = ['data-table'];
$headerAction = '<a href="'.route('users.create').'" class="btn btn-sm btn-primary" role="button">Add User</a>';
return $dataTable->render('global.datatable', compact('pageTitle','auth_user','assets', 'headerAction'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$roles = Role::where('status',1)->get()->pluck('title', 'id');
return view('users.form', compact('roles'));
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(UserRequest $request)
{
$request['password'] = bcrypt($request->password);
$request['username'] = $request->username ?? stristr($request->email, "@", true) . rand(100,1000);
$user = User::create($request->all());
storeMediaFile($user,$request->profile_image, 'profile_image');
$user->assignRole('user');
// Save user Profile data...
$user->userProfile()->create($request->userProfile);
return redirect()->route('users.index')->withSuccess(__('message.msg_added',['name' => __('users.store')]));
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$data = User::with('userProfile','roles')->findOrFail($id);
$profileImage = getSingleMedia($data, 'profile_image');
return view('users.profile', compact('data', 'profileImage'));
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data = User::with('userProfile','roles')->findOrFail($id);
$data['user_type'] = $data->roles->pluck('id')[0] ?? null;
$roles = Role::where('status',1)->get()->pluck('title', 'id');
$profileImage = getSingleMedia($data, 'profile_image');
return view('users.form', compact('data','id', 'roles', 'profileImage'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(UserRequest $request, $id)
{
// dd($request->all());
$user = User::with('userProfile')->findOrFail($id);
$role = Role::find($request->user_role);
if(env('IS_DEMO')) {
if($role->name === 'admin'&& $user->user_type === 'admin') {
return redirect()->back()->with('error', 'Permission denied');
}
}
$user->assignRole($role->name);
$request['password'] = $request->password != '' ? bcrypt($request->password) : $user->password;
// User user data...
$user->fill($request->all())->update();
// Save user image...
if (isset($request->profile_image) && $request->profile_image != null) {
$user->clearMediaCollection('profile_image');
$user->addMediaFromRequest('profile_image')->toMediaCollection('profile_image');
}
// user profile data....
$user->userProfile->fill($request->userProfile)->update();
if(auth()->check()){
return redirect()->route('users.index')->withSuccess(__('message.msg_updated',['name' => __('message.user')]));
}
return redirect()->back()->withSuccess(__('message.msg_updated',['name' => 'My Profile']));
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$user = User::findOrFail($id);
$status = 'errors';
$message= __('global-message.delete_form', ['form' => __('users.title')]);
if($user!='') {
$user->delete();
$status = 'success';
$message= __('global-message.delete_form', ['form' => __('users.title')]);
}
if(request()->ajax()) {
return response()->json(['status' => true, 'message' => $message, 'datatable_reload' => 'dataTable_wrapper']);
}
return redirect()->back()->with($status,$message);
}
}

66
app/Http/Kernel.php Normal file
View File

@ -0,0 +1,66 @@
<?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\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:api',
\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,
'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,
];
}

View 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');
}
}
}

View 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 = [
//
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null ...$guards
* @return mixed
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}

View 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',
];
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View 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|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB;
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Http\Requests\Auth;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
class LoginRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|string|email',
'password' => 'required|string',
];
}
/**
* Attempt to authenticate the request's credentials.
*
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
public function authenticate()
{
$this->ensureIsNotRateLimited();
if (! Auth::attempt($this->only('email', 'password'), $this->filled('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => __('auth.failed'),
]);
}
RateLimiter::clear($this->throttleKey());
}
/**
* Ensure the login request is not rate limited.
*
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
public function ensureIsNotRateLimited()
{
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
return;
}
event(new Lockout($this));
$seconds = RateLimiter::availableIn($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.throttle', [
'seconds' => $seconds,
'minutes' => ceil($seconds / 60),
]),
]);
}
/**
* Get the rate limiting throttle key for the request.
*
* @return string
*/
public function throttleKey()
{
return Str::lower($this->input('email')).'|'.$this->ip();
}
}

View File

@ -0,0 +1,97 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;
class UserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$method = strtolower($this->method());
$user_id = $this->route()->user;
$rules = [];
switch ($method) {
case 'post':
$rules = [
'username' => 'required|max:20',
'password' => 'required|confirmed|min:8',
'email' => 'required|max:191|email|unique:users',
'phone_number'=>'max:13',
// 'userProfile.gender' => 'required',
'userProfile.country' => 'max:191',
'userProfile.state' => 'max:191',
'userProfile.city' => 'max:191',
'userProfile.pin_code' => 'max:191',
];
break;
case 'patch':
$rules = [
'username' => 'required|max:20',
'email' => 'required|max:191|email|unique:users,email,'.$user_id,
'phone_number'=>'max:13',
'password' => 'confirmed|min:8|nullable',
// 'userProfile.gender' => 'required',
'userProfile.country' => 'max:191',
'userProfile.state' => 'max:191',
'userProfile.city' => 'max:191',
'userProfile.pin_code' => 'max:191',
];
break;
}
return $rules;
}
public function messages()
{
return [
'userProfile.gender.*' =>'Gender is required.',
'userProfile.dob.*' =>'DOB is required.',
'userProfile.country.*' =>'Country may not be greater than 191 characters.',
'userProfile.state.*' =>'State may not be greater than 191 characters.',
'userProfile.city.*' =>'City may not be greater than 191 characters.',
'userProfile.pin_code.*' =>'Pincode may not be greater than 191 characters.',
];
}
/**
* @param Validator $validator
*/
protected function failedValidation(Validator $validator){
$data = [
'status' => true,
'message' => $validator->errors()->first(),
'all_message' => $validator->errors()
];
if ($this->ajax()) {
throw new HttpResponseException(response()->json($data,422));
} else {
throw new HttpResponseException(redirect()->back()->withInput()->with('errors', $validator->errors()));
}
}
}

64
app/Models/User.php Normal file
View File

@ -0,0 +1,64 @@
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class User extends Authenticatable implements MustVerifyEmail, HasMedia
{
use HasFactory, Notifiable, HasRoles, InteractsWithMedia;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'username',
'first_name',
'last_name',
'phone_number',
'status',
'banned',
'email',
'password',
'smart_pk'
];
/**
* 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',
];
protected $appends = ['full_name'];
public function getFullNameAttribute()
{
return $this->first_name . ' ' . $this->last_name;
}
public function userProfile() {
return $this->hasOne(UserProfile::class, 'user_id', 'id');
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UserProfile extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'company_name',
'street_addr_1',
'street_addr_2',
'phone_number',
'alt_phone_number',
'country',
'state',
'city',
'pin_code',
'facebook_url',
'twitter_url',
'linkedin_url',
'instagram_url',
];
}

View 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()
{
//
}
}

View 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\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}

View 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');
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/dashboard';
/**
* The controller namespace for the application.
*
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
*/
// protected $namespace = 'App\\Http\\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class AppLayout extends Component
{
public $layout, $dir, $assets;
public function __construct($layout = '', $dir=false, $assets = [])
{
$this->layout = $layout;
$this->dir = $dir;
$this->assets = $assets;
}
/**
* Get the view / contents that represents the component.
*
* @return \Illuminate\View\View
*/
public function render()
{
switch($this->layout){
case 'horizontal':
return view('layouts.dashboard.horizontal');
break;
case 'dualhorizontal':
return view('layouts.dashboard.dual-horizontal');
break;
case 'dualcompact':
return view('layouts.dashboard.dual-compact');
break;
case 'boxed':
return view('layouts.dashboard.boxed');
break;
case 'boxedfancy':
return view('layouts.dashboard.boxed-fancy');
break;
case 'simple':
return view('layouts.dashboard.simple');
break;
default:
return view('layouts.dashboard.dashboard');
break;
}
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class BreadCrumb extends Component
{
public $title, $classname;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($title = 'Title', $classname = '')
{
$this->title = $title;
$this->classname = $classname;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.bread-crumb');
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class ChatContent extends Component
{
public $id, $img , $name, $dateTime, $title, $activeClass, $about, $nickName, $contact, $dob, $gender, $lang, $status;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($id, $img , $name, $dateTime='', $title='', $activeClass='',$about='', $nickName='', $contact='', $dob='', $gender='', $lang='', $status='')
{
$this->id = $id;
$this->img = $img;
$this->name = $name;
$this->dateTime = $dateTime;
$this->title = $title;
$this->activeClass = $activeClass;
$this->about = $about;
$this->nickName = $nickName;
$this->contact = $contact;
$this->dob = $dob;
$this->gender = $gender;
$this->lang = $lang;
$this->status = $status;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
return view('components.chat-content');
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class ChatItem extends Component
{
public $id, $img ,$msg, $name, $dateTime;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($id, $img , $msg='', $name, $dateTime='')
{
$this->id = $id;
$this->img = $img;
$this->msg= $msg;
$this->name = $name;
$this->dateTime = $dateTime;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
return view('components.chat-item');
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class GuestLayout extends Component
{
/**
* Get the view / contents that represents the component.
*
* @return \Illuminate\View\View
*/
public function render()
{
return view('layouts.dashboard.guest');
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class HeaderBreadcrumb extends Component
{
public $class , $role;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($class='' , $role='')
{
$this -> class = $class;
$this -> role = $role;
//
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.header-breadcrumb');
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class MembersCard extends Component
{
public $img, $imgClass, $id, $title, $role, $popoverdatacontent, $popovertitle, $popoverrol, $popovertrainername, $chart, $value, $value1, $value2, $value3, $value4, $value5,$rating;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($img = '', $imgClass = '', $id = '', $title = '', $role = '', $popoverdatacontent = '', $popovertitle = '', $popoverrol = '', $popovertrainername = '', $chart = '', $value = '', $value1 = '', $value2 = '', $value3 = '', $value4 = '', $value5 = '', $rating='')
{
$this->img = $img;
$this->imgClass = $imgClass;
$this->id = $id;
$this->title = $title;
$this->role = $role;
$this->popoverdatacontent = $popoverdatacontent;
$this->popovertitle = $popovertitle;
$this->popoverrol = $popoverrol;
$this->popovertrainername = $popovertrainername;
$this->chart = $chart;
$this->value = $value;
$this->value1 = $value1;
$this->value2 = $value2;
$this->value3 = $value3;
$this->value4 = $value4;
$this->value5 = $value5;
$this->rating = $rating;
//
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.members-card');
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class RatingStar extends Component
{
public $fill;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($fill=false)
{
$this->fill=$fill;
//
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.rating-star');
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class TodoBoardCard extends Component
{
public $id;
public $class;
public $title;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($id,$class = '',$title)
{
$this->id = $id;
$this->class = $class;
$this->title = $title;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
return view('components.todo-board-card');
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class TodoListCard extends Component
{
public $id;
public $class;
public $title;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($id,$class = '',$title)
{
$this->id = $id;
$this->class = $class;
$this->title = $title;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
return view('components.todo-list-card');
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class TrainersCard extends Component
{
public $cardstyle, $id, $rating, $percent, $progresssmColor, $name, $role, $img, $color, $description, $value;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($cardstyle= '', $id= '', $rating= '', $percent= '', $progresssmColor= '' ,$name= '', $role= '', $img= '',$color= '', $description= '', $value= '')
{
$this-> cardstyle=$cardstyle;
$this-> id=$id;
$this-> rating=$rating;
$this-> progresssmColor=$progresssmColor;
$this-> percent=$percent;
$this-> name=$name;
$this-> role=$role;
$this-> img=$img;
$this-> color=$color;
$this-> description=$description;
$this-> value=$value;
//
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.trainers-card');
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class authsessionstatus extends Component
{
public $status;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($status='')
{
$this -> status = $status; //
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.auth-session-status');
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class authvalidationerrors extends Component
{
public $errors;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($errors='')
{
$this -> errors = $errors; //
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.auth-validation-errors');
}
}

53
artisan Normal file
View 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
View 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
View File

@ -0,0 +1,2 @@
*
!.gitignore

72
composer.json Normal file
View File

@ -0,0 +1,72 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5",
"laravelcollective/html": "^6.2",
"spatie/laravel-medialibrary": "^9.0.0",
"spatie/laravel-permission": "^5.3",
"yajra/laravel-datatables": "^1.5",
"yajra/laravel-datatables-oracle": "~9.0"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/breeze": "^1.0",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
"config": {
"platform-check": false,
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"files": [
"app/Helpers/helper.php"
]
},
"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"
]
}
}

9562
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

236
config/app.php Normal file
View File

@ -0,0 +1,236 @@
<?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', 'Glare | Responsive Bootstrap 5 Admin Dashboard Template'),
/*
|--------------------------------------------------------------------------
| 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' => (bool) 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' => env('TIMEZONE', 'UTC'),
/*
|--------------------------------------------------------------------------
| 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',
/*
|--------------------------------------------------------------------------
| 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',
/*
|--------------------------------------------------------------------------
| 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',
/*
|--------------------------------------------------------------------------
| 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,
Spatie\Permission\PermissionServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::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\Facades\DataTables::class,
'AuthHelper' => App\Helpers\AuthHelper::class
],
];

117
config/auth.php Normal file
View 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\Models\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,
];

64
config/broadcasting.php Normal file
View File

@ -0,0 +1,64 @@
<?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,
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

106
config/cache.php Normal file
View File

@ -0,0 +1,106 @@
<?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.
|
*/
'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.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_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',
'lock_connection' => 'default',
],
'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'),
];

9
config/constant.php Normal file
View File

@ -0,0 +1,9 @@
<?php
return [
'BOOLEAN_VARIABLE' => [
'APP_DEBUG',
'USE_PERSONAL_TOKEN',
'EVANTO_LOGIN',
'APP_SETUP'
],
];

34
config/cors.php Normal file
View 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/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];

162
config/database.php Normal file
View File

@ -0,0 +1,162 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'smart' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST_SMART', '127.0.0.1'),
'port' => env('DB_PORT_SMART', '5432'),
'database' => env('DB_DATABASE_SMART', 'forge'),
'username' => env('DB_USERNAME_SMART', 'forge'),
'password' => env('DB_PASSWORD_SMART', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

View File

@ -0,0 +1,90 @@
<?php
return [
/*
* Namespaces used by the generator.
*/
'namespace' => [
/*
* Base namespace/directory to create the new file.
* This is appended on default Laravel namespace.
* Usage: php artisan datatables:make User
* Output: App\DataTables\UserDataTable
* With Model: App\User (default model)
* Export filename: users_timestamp
*/
'base' => 'DataTables',
/*
* Base namespace/directory where your model's are located.
* This is appended on default Laravel namespace.
* Usage: php artisan datatables:make Post --model
* Output: App\DataTables\PostDataTable
* With Model: App\Post
* Export filename: posts_timestamp
*/
'model' => '',
],
/*
* Set Custom stub folder
*/
//'stub' => '/resources/custom_stub',
/*
* PDF generator to be used when converting the table to pdf.
* Available generators: excel, snappy
* Snappy package: barryvdh/laravel-snappy
* Excel package: maatwebsite/excel
*/
'pdf_generator' => 'snappy',
/*
* Snappy PDF options.
*/
'snappy' => [
'options' => [
'no-outline' => true,
'margin-left' => '0',
'margin-right' => '0',
'margin-top' => '10mm',
'margin-bottom' => '10mm',
],
'orientation' => 'landscape',
],
/*
* Default html builder parameters.
*/
'parameters' => [
'dom' => 'Bfrtip',
'order' => [[0, 'desc']],
'buttons' => [
'create',
'export',
'print',
'reset',
'reload',
],
],
/*
* Generator command default options value.
*/
'generator' => [
/*
* Default columns to generate when not set.
*/
'columns' => 'id,add your columns,created_at,updated_at',
/*
* Default buttons to generate when not set.
*/
'buttons' => 'create,export,print,reset,reload',
/*
* Default DOM to generate when not set.
*/
'dom' => 'Bfrtip',
],
];

122
config/datatables.php Normal file
View 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,
],
];

72
config/filesystems.php Normal file
View File

@ -0,0 +1,72 @@
<?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', 'local'),
/*
|--------------------------------------------------------------------------
| 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'),
'endpoint' => env('AWS_ENDPOINT'),
],
],
/*
|--------------------------------------------------------------------------
| 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
View 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
View 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' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_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' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

110
config/mail.php Normal file
View File

@ -0,0 +1,110 @@
<?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'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'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'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| 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'),
],
],
];

222
config/media-library.php Normal file
View File

@ -0,0 +1,222 @@
<?php
return [
/*
* The disk on which to store added files and derived images by default. Choose
* one or more of the disks you've configured in config/filesystems.php.
*/
'disk_name' => env('MEDIA_DISK', 'public'),
/*
* The maximum file size of an item in bytes.
* Adding a larger file will result in an exception.
*/
'max_file_size' => 1024 * 1024 * 10, // 10MB
/*
* This queue will be used to generate derived and responsive images.
* Leave empty to use the default queue.
*/
'queue_name' => '',
/*
* By default all conversions will be performed on a queue.
*/
'queue_conversions_by_default' => env('QUEUE_CONVERSIONS_BY_DEFAULT', true),
/*
* The fully qualified class name of the media model.
*/
'media_model' => Spatie\MediaLibrary\MediaCollections\Models\Media::class,
/*
* The fully qualified class name of the model used for temporary uploads.
*
* This model is only used in Media Library Pro (https://medialibrary.pro)
*/
'temporary_upload_model' => Spatie\MediaLibraryPro\Models\TemporaryUpload::class,
/*
* When enabled, Media Library Pro will only process temporary uploads there were uploaded
* in the same session. You can opt to disable this for stateless usage of
* the pro components.
*/
'enable_temporary_uploads_session_affinity' => true,
/*
* When enabled, Media Library pro will generate thumbnails for uploaded file.
*/
'generate_thumbnails_for_temporary_uploads' => true,
/*
* This is the class that is responsible for naming generated files.
*/
'file_namer' => Spatie\MediaLibrary\Support\FileNamer\DefaultFileNamer::class,
/*
* The class that contains the strategy for determining a media file's path.
*/
'path_generator' => Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class,
/*
* When urls to files get generated, this class will be called. Use the default
* if your files are stored locally above the site root or on s3.
*/
'url_generator' => Spatie\MediaLibrary\Support\UrlGenerator\DefaultUrlGenerator::class,
/*
* Moves media on updating to keep path consistent. Enable it only with a custom
* PathGenerator that uses, for example, the media UUID.
*/
'moves_media_on_update' => false,
/*
* Whether to activate versioning when urls to files get generated.
* When activated, this attaches a ?v=xx query string to the URL.
*/
'version_urls' => false,
/*
* The media library will try to optimize all converted images by removing
* metadata and applying a little bit of compression. These are
* the optimizers that will be used by default.
*/
'image_optimizers' => [
Spatie\ImageOptimizer\Optimizers\Jpegoptim::class => [
'-m85', // set maximum quality to 85%
'--force', // ensure that progressive generation is always done also if a little bigger
'--strip-all', // this strips out all text information such as comments and EXIF data
'--all-progressive', // this will make sure the resulting image is a progressive one
],
Spatie\ImageOptimizer\Optimizers\Pngquant::class => [
'--force', // required parameter for this package
],
Spatie\ImageOptimizer\Optimizers\Optipng::class => [
'-i0', // this will result in a non-interlaced, progressive scanned image
'-o2', // this set the optimization level to two (multiple IDAT compression trials)
'-quiet', // required parameter for this package
],
Spatie\ImageOptimizer\Optimizers\Svgo::class => [
'--disable=cleanupIDs', // disabling because it is known to cause troubles
],
Spatie\ImageOptimizer\Optimizers\Gifsicle::class => [
'-b', // required parameter for this package
'-O3', // this produces the slowest but best results
],
Spatie\ImageOptimizer\Optimizers\Cwebp::class => [
'-m 6', // for the slowest compression method in order to get the best compression.
'-pass 10', // for maximizing the amount of analysis pass.
'-mt', // multithreading for some speed improvements.
'-q 90', //quality factor that brings the least noticeable changes.
],
],
/*
* These generators will be used to create an image of media files.
*/
'image_generators' => [
Spatie\MediaLibrary\Conversions\ImageGenerators\Image::class,
Spatie\MediaLibrary\Conversions\ImageGenerators\Webp::class,
Spatie\MediaLibrary\Conversions\ImageGenerators\Pdf::class,
Spatie\MediaLibrary\Conversions\ImageGenerators\Svg::class,
Spatie\MediaLibrary\Conversions\ImageGenerators\Video::class,
],
/*
* The path where to store temporary files while performing image conversions.
* If set to null, storage_path('media-library/temp') will be used.
*/
'temporary_directory_path' => null,
/*
* The engine that should perform the image conversions.
* Should be either `gd` or `imagick`.
*/
'image_driver' => env('IMAGE_DRIVER', 'gd'),
/*
* FFMPEG & FFProbe binaries paths, only used if you try to generate video
* thumbnails and have installed the php-ffmpeg/php-ffmpeg composer
* dependency.
*/
'ffmpeg_path' => env('FFMPEG_PATH', '/usr/bin/ffmpeg'),
'ffprobe_path' => env('FFPROBE_PATH', '/usr/bin/ffprobe'),
/*
* Here you can override the class names of the jobs used by this package. Make sure
* your custom jobs extend the ones provided by the package.
*/
'jobs' => [
'perform_conversions' => Spatie\MediaLibrary\Conversions\Jobs\PerformConversionsJob::class,
'generate_responsive_images' => Spatie\MediaLibrary\ResponsiveImages\Jobs\GenerateResponsiveImagesJob::class,
],
/*
* When using the addMediaFromUrl method you may want to replace the default downloader.
* This is particularly useful when the url of the image is behind a firewall and
* need to add additional flags, possibly using curl.
*/
'media_downloader' => Spatie\MediaLibrary\Downloaders\DefaultDownloader::class,
'remote' => [
/*
* Any extra headers that should be included when uploading media to
* a remote disk. Even though supported headers may vary between
* different drivers, a sensible default has been provided.
*
* Supported by S3: CacheControl, Expires, StorageClass,
* ServerSideEncryption, Metadata, ACL, ContentEncoding
*/
'extra_headers' => [
'CacheControl' => 'max-age=604800',
],
],
'responsive_images' => [
/*
* This class is responsible for calculating the target widths of the responsive
* images. By default we optimize for filesize and create variations that each are 20%
* smaller than the previous one. More info in the documentation.
*
* https://docs.spatie.be/laravel-medialibrary/v9/advanced-usage/generating-responsive-images
*/
'width_calculator' => Spatie\MediaLibrary\ResponsiveImages\WidthCalculator\FileSizeOptimizedWidthCalculator::class,
/*
* By default rendering media to a responsive image will add some javascript and a tiny placeholder.
* This ensures that the browser can already determine the correct layout.
*/
'use_tiny_placeholders' => true,
/*
* This class will generate the tiny placeholder used for progressive image loading. By default
* the media library will use a tiny blurred jpg image.
*/
'tiny_placeholder_generator' => Spatie\MediaLibrary\ResponsiveImages\TinyPlaceholderGenerator\Blurred::class,
],
/*
* When enabling this option, a route will be registered that will enable
* the Media Library Pro Vue and React components to move uploaded files
* in a S3 bucket to their right place.
*/
'enable_vapor_uploads' => env('ENABLE_MEDIA_LIBRARY_VAPOR_UPLOADS', false),
/*
* When converting Media instances to response the media library will add
* a `loading` attribute to the `img` tag. Here you can set the default
* value of that attribute.
*
* Possible values: 'lazy', 'eager', 'auto' or null if you don't want to set any loading instruction.
*
* More info: https://css-tricks.com/native-lazy-loading/
*/
'default_loading_attribute_value' => null,
/*
* You can specify a prefix for that is used for storing all media.
* If you set this to `/my-subdir`, all your media will be stored in a `/my-subdir` directory.
*/
'prefix' => env('MEDIA_PREFIX', ''),
];

161
config/permission.php Normal file
View File

@ -0,0 +1,161 @@
<?php
return [
'models' => [
/*
* When using the "HasPermissions" trait from this package, we need to know which
* Eloquent model should be used to retrieve your permissions. Of course, it
* is often just the "Permission" model but you may use whatever you like.
*
* The model you want to use as a Permission model needs to implement the
* `Spatie\Permission\Contracts\Permission` contract.
*/
'permission' => Spatie\Permission\Models\Permission::class,
/*
* When using the "HasRoles" trait from this package, we need to know which
* Eloquent model should be used to retrieve your roles. Of course, it
* is often just the "Role" model but you may use whatever you like.
*
* The model you want to use as a Role model needs to implement the
* `Spatie\Permission\Contracts\Role` contract.
*/
'role' => Spatie\Permission\Models\Role::class,
],
'table_names' => [
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'roles' => 'roles',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your permissions. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'permissions' => 'permissions',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your models permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_permissions' => 'model_has_permissions',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your models roles. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_roles' => 'model_has_roles',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'role_has_permissions' => 'role_has_permissions',
],
'column_names' => [
/*
* Change this if you want to name the related pivots other than defaults
*/
'role_pivot_key' => null, //default 'role_id',
'permission_pivot_key' => null, //default 'permission_id',
/*
* Change this if you want to name the related model primary key other than
* `model_id`.
*
* For example, this would be nice if your primary keys are all UUIDs. In
* that case, name this `model_uuid`.
*/
'model_morph_key' => 'model_id',
/*
* Change this if you want to use the teams feature and your related model's
* foreign key is other than `team_id`.
*/
'team_foreign_key' => 'team_id',
],
/*
* When set to true, the method for checking permissions will be registered on the gate.
* Set this to false, if you want to implement custom logic for checking permissions.
*/
'register_permission_check_method' => true,
/*
* When set to true the package implements teams using the 'team_foreign_key'. If you want
* the migrations to register the 'team_foreign_key', you must set this to true
* before doing the migration. If you already did the migration then you must make a new
* migration to also add 'team_foreign_key' to 'roles', 'model_has_roles', and
* 'model_has_permissions'(view the latest version of package's migration file)
*/
'teams' => false,
/*
* When set to true, the required permission names are added to the exception
* message. This could be considered an information leak in some contexts, so
* the default setting is false here for optimum safety.
*/
'display_permission_in_exception' => false,
/*
* When set to true, the required role names are added to the exception
* message. This could be considered an information leak in some contexts, so
* the default setting is false here for optimum safety.
*/
'display_role_in_exception' => false,
/*
* By default wildcard permission lookups are disabled.
*/
'enable_wildcard_permission' => false,
'cache' => [
/*
* By default all permissions are cached for 24 hours to speed up performance.
* When permissions or roles are updated the cache is flushed automatically.
*/
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
/*
* The cache key used to store all permissions.
*/
'key' => 'spatie.permission.cache',
/*
* You may optionally indicate a specific cache driver to use for permission and
* role caching using any of the `store` drivers listed in the cache.php config
* file. Using 'default' here means to use the `default` set in cache.php.
*/
'store' => 'default',
],
];

89
config/queue.php Normal file
View File

@ -0,0 +1,89 @@
<?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'),
'suffix' => env('SQS_SUFFIX'),
'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-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

33
config/services.php Normal file
View 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'),
],
];

201
config/session.php Normal file
View File

@ -0,0 +1,201 @@
<?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),
'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
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends 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".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'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'),
/*
|--------------------------------------------------------------------------
| 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
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];

36
config/view.php Normal file
View File

@ -0,0 +1,36 @@
<?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'))
),
];

2
database/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.sqlite
*.sqlite-journal

View File

@ -0,0 +1,55 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$fname = $this->faker->firstName;
$lname = $this->faker->lastName;
$fullname = Str::lower($fname).Str::lower($lname);
$status = $this->faker->numberBetween(0,2);
switch ($status) {
case 1:
$status = 'active';
break;
case 2:
$status = 'inactive';
break;
default:
$status = 'pending';
break;
}
return [
'username' => $fullname,
'first_name' => $fname,
'last_name' => $lname,
'phone_number' => $this->faker->phoneNumber,
'email' => $this->faker->unique()->safeEmail,
'email_verified_at' => now(),
'password' => bcrypt('password'),
'phone_number' => $this->faker->phoneNumber,
'user_type' => 'user',
'status' => $status
];
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Database\Factories;
use App\Models\UserProfile;
use Illuminate\Database\Eloquent\Factories\Factory;
class UserProfileFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = UserProfile::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
static $user_id = 1;
return [
'company_name' => $this->faker->words(2,true),
'country' => $this->faker->country,
'user_id' => $user_id++
];
}
}

View File

@ -0,0 +1,41 @@
<?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('username')->unique();
$table->string('first_name');
$table->string('last_name');
$table->string('email')->unique();
$table->string('phone_number')->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->string('user_type')->default('user');
$table->string('password');
$table->string('status')->default('pending');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@ -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');
}
}

View File

@ -0,0 +1,36 @@
<?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->string('uuid')->unique();
$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');
}
}

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserProfilesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_profiles', function (Blueprint $table) {
$table->id();
$table->string('company_name')->nullable();
$table->string('street_addr_1')->nullable();
$table->string('street_addr_2')->nullable();
$table->string('phone_number')->nullable();
$table->string('alt_phone_number')->nullable();
$table->string('country')->nullable();
$table->string('state')->nullable();
$table->string('city')->nullable();
$table->bigInteger('pin_code')->nullable();
$table->string('facebook_url')->nullable();
$table->string('instagram_url')->nullable();
$table->string('twitter_url')->nullable();
$table->string('linkdin_url')->nullable();
$table->foreignId('user_id')->cascade('delete');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_profiles');
}
}

View File

@ -0,0 +1,145 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Spatie\Permission\PermissionRegistrar;
class CreatePermissionTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$tableNames = config('permission.table_names');
$columnNames = config('permission.column_names');
$teams = config('permission.teams');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
}
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
}
Schema::create($tableNames['permissions'], function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name'); // For MySQL 8.0 use string('name', 125);
$table->string('title');
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
$table->unsignedBigInteger('parent_id')->nullable()->default(null);
$table->timestamps();
$table->unique(['name', 'guard_name']);
});
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
$table->bigIncrements('id');
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
}
$table->string('name'); // For MySQL 8.0 use string('name', 125);
$table->string('title');
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
$table->tinyInteger('status')->nullable()->default('1');
$table->timestamps();
if ($teams || config('permission.testing')) {
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
} else {
$table->unique(['name', 'guard_name']);
}
});
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
$table->foreign(PermissionRegistrar::$pivotPermission)
->references('id')
->on($tableNames['permissions'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
} else {
$table->primary([PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
}
});
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
$table->foreign(PermissionRegistrar::$pivotRole)
->references('id')
->on($tableNames['roles'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
} else {
$table->primary([PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
}
});
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
$table->foreign(PermissionRegistrar::$pivotPermission)
->references('id')
->on($tableNames['permissions'])
->onDelete('cascade');
$table->foreign(PermissionRegistrar::$pivotRole)
->references('id')
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary([PermissionRegistrar::$pivotPermission, PermissionRegistrar::$pivotRole], 'role_has_permissions_permission_id_role_id_primary');
});
app('cache')
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
->forget(config('permission.cache.key'));
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$tableNames = config('permission.table_names');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
}
Schema::drop($tableNames['role_has_permissions']);
Schema::drop($tableNames['model_has_roles']);
Schema::drop($tableNames['model_has_permissions']);
Schema::drop($tableNames['roles']);
Schema::drop($tableNames['permissions']);
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMediaTable extends Migration
{
public function up()
{
Schema::create('media', function (Blueprint $table) {
$table->bigIncrements('id');
$table->morphs('model');
$table->uuid('uuid')->nullable()->unique();
$table->string('collection_name');
$table->string('name');
$table->string('file_name');
$table->string('mime_type')->nullable();
$table->string('disk');
$table->string('conversions_disk')->nullable();
$table->unsignedBigInteger('size');
$table->json('manipulations');
$table->json('custom_properties');
$table->json('generated_conversions');
$table->json('responsive_images');
$table->unsignedInteger('order_column')->nullable();
$table->nullableTimestamps();
});
}
}

Some files were not shown because too many files have changed in this diff Show More