Compare commits

...

16 Commits

148 changed files with 15412 additions and 0 deletions

18
.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4

66
.env.example Normal file
View File

@ -0,0 +1,66 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

11
.gitattributes vendored Normal file
View File

@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

23
.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/auth.json
/.fleet
/.idea
/.nova
/.vscode
/.zed

View File

@ -0,0 +1,145 @@
<?php
namespace App\Filament\Pages;
use App\Models\TrRegistrasi;
use App\Models\TrTransaksi;
use Carbon\Carbon;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Filament\Pages\Page;
use Malzariey\FilamentDaterangepickerFilter\Fields\DateRangePicker;
use Torgodly\Html2Media\Actions\Html2MediaAction;
use Filament\Actions\Action;
class Dashboard extends \Filament\Pages\Dashboard implements HasForms, HasActions
{
use InteractsWithForms;
use InteractsWithActions;
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static string $view = 'filament.pages.dashboard';
public ?array $data = [];
public function mount(): void
{
$this->form->fill();
}
public function form(Form $form): Form
{
return $form->schema([
DateRangePicker::make('filtering_date')
->label('Rentang Tanggal')
->placeholder('dd/mm/yyyy - dd/mm/yyyy')
->format('date format')
->disabledDates(['array of Dates'])
])
->statePath('data');
}
public function filter()
{
// filtering date null return.
if ($this->data['filtering_date'] == null) {
return;
}
$this->dispatch('filter', data: $this->data['filtering_date']);
}
public function printTrendPasienAction(): Action
{
$filtering_date = $this->data['filtering_date'];
if ($this->data['filtering_date']) {
$filtering_date = explode(' - ', $this->data['filtering_date']);
$start_date = $filtering_date[0];
$end_date = $filtering_date[1];
// Format pakai Carbon
$start_date = Carbon::createFromFormat('d/m/Y', $start_date)->format('Y-m-d');
$end_date = Carbon::createFromFormat('d/m/Y', $end_date)->format('Y-m-d');
$query = TrRegistrasi::whereBetween('tgl_registrasi', [$start_date, $end_date]);
} else {
$query = TrRegistrasi::query();
}
$data =
$query->selectRaw('DATE(tgl_registrasi) as tanggal, COUNT(*) as total')
->groupBy('tanggal')
->orderBy('tanggal')
->get()
->pluck('total', 'tanggal');
return Html2MediaAction::make('printTrendPasienAction')
->label('Print')
->scale(2)
->print() // Enable print option
->preview()
->filename(function ($record) use ($filtering_date) {
return 'trends-pasien.pdf';
})
->content(function ($record) use ($data, $filtering_date) {
return view('components.pdf.trends-pasien', ['pasien' => $data, 'filtering_date' => $filtering_date]);
})
->savePdf() // Enable save as PDF option
->requiresConfirmation() // Show confirmation modal
->pagebreak('section', ['css', 'legacy'])
->orientation('portrait') // Portrait orientation
->format('a4', 'mm') // A4 format with mm units
->enableLinks() // Enable links in PDF
->margin([25, 50, 0, 50]); //
}
public function printTrendPendapatanAction(): Action
{
$filtering_date = $this->data['filtering_date'];
if ($this->data['filtering_date']) {
$filtering_date = explode(' - ', $this->data['filtering_date']);
$start_date = $filtering_date[0];
$end_date = $filtering_date[1];
$start_date = Carbon::createFromFormat('d/m/Y', $start_date)->format('Y-m-d');
$end_date = Carbon::createFromFormat('d/m/Y', $end_date)->format('Y-m-d');
$query = TrTransaksi::whereBetween('created_at', [$start_date, $end_date]);
} else {
$query = TrTransaksi::query();
}
$data = $query->where('status', 'paid')
->selectRaw('DATE(created_at) as tanggal, SUM(total_harga) as total')
->groupBy('tanggal')
->orderBy('tanggal')
->get()
->pluck('total', 'tanggal');
return Html2MediaAction::make('printTrendPendapatanAction')
->label('Print')
->scale(2)
->print()
->preview()
->filename(function ($record) use ($filtering_date) {
return 'trends-pendapatan.pdf';
})
->content(function ($record) use ($data, $filtering_date) {
return view('components.pdf.trends-pendapatan', ['pendapatans' => $data, 'filtering_date' => $filtering_date]);
})
->savePdf() // Enable save as PDF option
->requiresConfirmation() // Show confirmation modal
->pagebreak('section', ['css', 'legacy'])
->orientation('portrait') // Portrait orientation
->format('a4', 'mm') // A4 format with mm units
->enableLinks() // Enable links in PDF
->margin([25, 50, 0, 50]); //
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\MsAsuransiResource\Pages;
use App\Filament\Resources\MsAsuransiResource\RelationManagers;
use App\Models\MsAsuransi;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class MsAsuransiResource extends Resource
{
protected static ?string $model = MsAsuransi::class;
protected static ?string $pluralModelLabel = 'Master Asuransi';
protected static ?string $navigationGroup = 'Master data';
protected static ?int $navigationSort = 3;
protected static ?string $navigationLabel = "Data Asuransi";
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('id_asuransi')
->required()
->maxLength(255),
Forms\Components\TextInput::make('nama_asuransi')
->required()
->maxLength(255),
]);
}
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->searchable()
->columns([
TextColumn::make('nama_asuransi')->label('Nama Asuransi')->sortable()->searchable(),
TextColumn::make('created_at')->label('Tanggal Dibuat')->sortable()->searchable(),
TextColumn::make('updated_at')->label('Tanggal Diubah')->sortable()->searchable(),
])
->filters([
//
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListMsAsuransis::route('/'),
'create' => Pages\CreateMsAsuransi::route('/create'),
'view' => Pages\ViewMsAsuransi::route('/{record}'),
'edit' => Pages\EditMsAsuransi::route('/{record}/edit'),
];
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Filament\Resources\MsAsuransiResource\Pages;
use App\Filament\Resources\MsAsuransiResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateMsAsuransi extends CreateRecord
{
protected static string $resource = MsAsuransiResource::class;
protected static ?string $title = 'Tambah Asuransi';
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\MsAsuransiResource\Pages;
use App\Filament\Resources\MsAsuransiResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditMsAsuransi extends EditRecord
{
protected static string $resource = MsAsuransiResource::class;
protected static ?string $title = 'Edit Asuransi';
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
];
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Filament\Resources\MsAsuransiResource\Pages;
use App\Filament\Resources\MsAsuransiResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListMsAsuransis extends ListRecords
{
protected static string $resource = MsAsuransiResource::class;
protected static ?string $title = 'Daftar Asuransi';
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->label('Tambah Asuransi')
->icon('heroicon-o-plus'),
];
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\MsAsuransiResource\Pages;
use App\Filament\Resources\MsAsuransiResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewMsAsuransi extends ViewRecord
{
protected static string $resource = MsAsuransiResource::class;
protected static ?string $title = 'Detail Asuransi';
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@ -0,0 +1,105 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\MsPasienResource\Pages;
use App\Filament\Resources\MsPasienResource\RelationManagers;
use App\Models\MsPasien;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class MsPasienResource extends Resource
{
protected static ?string $model = MsPasien::class;
protected static ?string $navigationIcon = 'heroicon-c-user-group';
protected static ?string $pluralModelLabel = 'Master Pasien';
protected static ?string $navigationGroup = 'Master data';
protected static ?int $navigationSort = 1;
protected static ?string $navigationLabel = "Data Pasien";
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('nik')
->placeholder('Egs: 1234567890')
->required()
->unique()
->maxLength(10),
Forms\Components\TextInput::make('nama')
->required()
->maxLength(255),
Forms\Components\Select::make('jenis_kelamin')
->required()
->options([
'L' => 'Laki-Laki',
'P' => 'Perempuan',
]),
Forms\Components\TextInput::make('no_hp')
->maxLength(15),
Forms\Components\Textarea::make('alamat')
->maxLength(255),
Forms\Components\TextInput::make('email')
->required()
->maxLength(255),
Forms\Components\DatePicker::make('tgl_lahir')
]);
}
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->searchable()
->columns([
TextColumn::make('nik')->label('NIK')->default('-')->sortable()->searchable(),
TextColumn::make('nama')->label('Nama Pasien')->sortable()->searchable(),
TextColumn::make('jenis_kelamin')->label('Jenis Kelamin')->sortable()->searchable(),
TextColumn::make('created_at')->label('Tanggal Dibuat')->sortable()->searchable(),
TextColumn::make('updated_at')->label('Tanggal Diubah')->sortable()->searchable(),
])
->filters([
SelectFilter::make('jenis_kelamin')
->options([
'L' => 'Laki-Laki',
'P' => 'Perempuan',
]),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListMsPasiens::route('/'),
'create' => Pages\CreateMsPasien::route('/create'),
'edit' => Pages\EditMsPasien::route('/{record}/edit'),
'view' => Pages\ViewMsPasien::route('/{record}'),
];
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Filament\Resources\MsPasienResource\Pages;
use App\Filament\Resources\MsPasienResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateMsPasien extends CreateRecord
{
protected static string $resource = MsPasienResource::class;
protected static ?string $title = 'Tambah Pasien';
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\MsPasienResource\Pages;
use App\Filament\Resources\MsPasienResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditMsPasien extends EditRecord
{
protected static string $resource = MsPasienResource::class;
protected static ?string $title = 'Edit Pasien';
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\MsPasienResource\Pages;
use App\Filament\Resources\MsPasienResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListMsPasiens extends ListRecords
{
protected static string $resource = MsPasienResource::class;
protected static ?string $title = 'Daftar Pasien';
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->label('Tambah Pasien')
->icon('heroicon-o-plus'),
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\MsPasienResource\Pages;
use App\Filament\Resources\MsPasienResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewMsPasien extends ViewRecord
{
protected static string $resource = MsPasienResource::class;
protected static ?string $title = 'Detail Pasien';
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make()->label('Edit Pasien'),
Actions\DeleteAction::make()->label('Hapus Pasien'),
];
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\MsPegawaiResource\Pages;
use App\Filament\Resources\MsPegawaiResource\RelationManagers;
use App\Models\MsPegawai;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class MsPegawaiResource extends Resource
{
protected static ?string $model = MsPegawai::class;
protected static ?string $pluralModelLabel = 'Master Pegawai';
protected static ?string $navigationGroup = 'Master data';
protected static ?int $navigationSort = 2;
protected static ?string $navigationLabel = "Data Pegawai";
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('id_pegawai')->label('ID Pegawai')
->required()
->maxLength(255),
Forms\Components\TextInput::make('nama_pegawai')
->required()
->maxLength(255),
//
]);
}
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->searchable()
->columns([
TextColumn::make('id_pegawai')->label('ID Pegawai')->sortable()->searchable(),
TextColumn::make('nama_pegawai')->label('Nama Pegawai')->sortable()->searchable(),
TextColumn::make('created_at')->label('Tanggal Dibuat')->sortable()->searchable(),
TextColumn::make('updated_at')->label('Tanggal Diubah')->sortable()->searchable(),
])
->filters([
//
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListMsPegawais::route('/'),
'create' => Pages\CreateMsPegawai::route('/create'),
'view' => Pages\ViewMsPegawai::route('/{record}'),
'edit' => Pages\EditMsPegawai::route('/{record}/edit'),
];
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Filament\Resources\MsPegawaiResource\Pages;
use App\Filament\Resources\MsPegawaiResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateMsPegawai extends CreateRecord
{
protected static string $resource = MsPegawaiResource::class;
protected static ?string $title = 'Tambah Pegawai';
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\MsPegawaiResource\Pages;
use App\Filament\Resources\MsPegawaiResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditMsPegawai extends EditRecord
{
protected static string $resource = MsPegawaiResource::class;
protected static ?string $title = 'Edit Pegawai';
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
];
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Filament\Resources\MsPegawaiResource\Pages;
use App\Filament\Resources\MsPegawaiResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListMsPegawais extends ListRecords
{
protected static string $resource = MsPegawaiResource::class;
protected static ?string $title = 'Daftar Pegawai';
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->label('Tambah Pegawai')
->icon('heroicon-o-plus'),
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\MsPegawaiResource\Pages;
use App\Filament\Resources\MsPegawaiResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewMsPegawai extends ViewRecord
{
protected static string $resource = MsPegawaiResource::class;
protected static ?string $title = 'Detail Pegawai';
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make()->label('Edit Pegawai'),
Actions\DeleteAction::make()->label('Hapus Pegawai'),
];
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\MsRuangPelayananResource\Pages;
use App\Filament\Resources\MsRuangPelayananResource\RelationManagers;
use App\Models\MsRuangPelayanan;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class MsRuangPelayananResource extends Resource
{
protected static ?string $model = MsRuangPelayanan::class;
protected static ?string $pluralModelLabel = 'Master Ruang Pelayanan';
protected static ?string $navigationGroup = 'Master data';
protected static ?int $navigationSort = 4;
protected static ?string $navigationLabel = "Data Ruang Pelayanan";
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('id_ruang_pelayanan')
->required()
->maxLength(255),
Forms\Components\TextInput::make('nama_ruang_pelayanan')
->required()
->maxLength(255),
]);
}
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->searchable()
->columns([
TextColumn::make('id_ruang_pelayanan')->label('ID Ruang Pelayanan')->sortable()->searchable(),
TextColumn::make('nama_ruang_pelayanan')->label('Nama Ruang Pelayanan')->sortable()->searchable(),
TextColumn::make('created_at')->label('Tanggal Dibuat')->sortable()->searchable(),
TextColumn::make('updated_at')->label('Tanggal Diubah')->sortable()->searchable(),
])
->filters([
//
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListMsRuangPelayanans::route('/'),
'create' => Pages\CreateMsRuangPelayanan::route('/create'),
'view' => Pages\ViewMsRuangPelayanan::route('/{record}'),
'edit' => Pages\EditMsRuangPelayanan::route('/{record}/edit'),
];
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Filament\Resources\MsRuangPelayananResource\Pages;
use App\Filament\Resources\MsRuangPelayananResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateMsRuangPelayanan extends CreateRecord
{
protected static string $resource = MsRuangPelayananResource::class;
protected static ?string $title = 'Tambah Ruang Pelayanan';
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\MsRuangPelayananResource\Pages;
use App\Filament\Resources\MsRuangPelayananResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditMsRuangPelayanan extends EditRecord
{
protected static string $resource = MsRuangPelayananResource::class;
protected static ?string $title = 'Edit Ruang Pelayanan';
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
];
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Filament\Resources\MsRuangPelayananResource\Pages;
use App\Filament\Resources\MsRuangPelayananResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListMsRuangPelayanans extends ListRecords
{
protected static string $resource = MsRuangPelayananResource::class;
protected static ?string $title = 'Daftar Ruang Pelayanan';
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->label('Tambah Ruang Pelayanan')
->icon('heroicon-o-plus'),
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\MsRuangPelayananResource\Pages;
use App\Filament\Resources\MsRuangPelayananResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewMsRuangPelayanan extends ViewRecord
{
protected static string $resource = MsRuangPelayananResource::class;
protected static ?string $title = 'Detail Ruang Pelayanan';
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@ -0,0 +1,94 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\MsTindakanResource\Pages;
use App\Filament\Resources\MsTindakanResource\RelationManagers;
use App\Models\MsTindakan;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Support\RawJs;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class MsTindakanResource extends Resource
{
protected static ?string $model = MsTindakan::class;
protected static ?string $pluralModelLabel = 'Master Tindakan';
protected static ?string $navigationGroup = 'Master data';
protected static ?int $navigationSort = 5;
protected static ?string $navigationLabel = "Data Tindakan";
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('id_tindakan')
->label('ID Tindakan')
->required()
->maxLength(255),
Forms\Components\TextInput::make('nama_tindakan')
->required()
->maxLength(255),
Forms\Components\TextInput::make('tarif_tindakan')
->mask(RawJs::make('$money($input)'))
->stripCharacters(',')
->numeric()
->required()
->prefix('Rp'),
]);
}
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->searchable()
->columns([
TextColumn::make('id_tindakan')->label('ID Tindakan')->sortable()->searchable(),
TextColumn::make('nama_tindakan')->label('Nama Tindakan')->sortable()->searchable(),
TextColumn::make('tarif_tindakan')->label('Tarif Tindakan')
->money('IDR')
->sortable(),
TextColumn::make('created_at')->label('Tanggal Dibuat')->sortable()->searchable(),
TextColumn::make('updated_at')->label('Tanggal Diubah')->sortable()->searchable(),
])
->filters([
//
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListMsTindakans::route('/'),
'create' => Pages\CreateMsTindakan::route('/create'),
'view' => Pages\ViewMsTindakan::route('/{record}'),
'edit' => Pages\EditMsTindakan::route('/{record}/edit'),
];
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Filament\Resources\MsTindakanResource\Pages;
use App\Filament\Resources\MsTindakanResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateMsTindakan extends CreateRecord
{
protected static string $resource = MsTindakanResource::class;
protected static ?string $title = 'Tambah Tindakan';
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Filament\Resources\MsTindakanResource\Pages;
use App\Filament\Resources\MsTindakanResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditMsTindakan extends EditRecord
{
protected static string $resource = MsTindakanResource::class;
protected static ?string $title = 'Edit Tindakan';
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\MsTindakanResource\Pages;
use App\Filament\Resources\MsTindakanResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListMsTindakans extends ListRecords
{
protected static string $resource = MsTindakanResource::class;
protected static ?string $title = 'Daftar Tindakan';
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->label('Tambah Tindakan')
->icon('heroicon-o-plus'),
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\MsTindakanResource\Pages;
use App\Filament\Resources\MsTindakanResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewMsTindakan extends ViewRecord
{
protected static string $resource = MsTindakanResource::class;
protected static ?string $title = 'Detail Tindakan';
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@ -0,0 +1,122 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\TrRegistrasiResource\Pages;
use App\Filament\Resources\TrRegistrasiResource\RelationManagers;
use App\Models\MsAsuransi;
use App\Models\MsPasien;
use App\Models\MsPegawai;
use App\Models\MsRuangPelayanan;
use App\Models\TrRegistrasi;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class TrRegistrasiResource extends Resource
{
protected static ?string $model = TrRegistrasi::class;
protected static ?string $pluralModelLabel = 'Transaksi Registrasi';
protected static ?string $navigationGroup = 'Transaksi';
protected static ?int $navigationSort = 1;
protected static ?string $navigationLabel = "Registrasi";
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\DatePicker::make('tgl_registrasi'),
Forms\Components\TextInput::make('nomor_kartu_asuransi')
->label('Nomor Kartu Asuransi')
->nullable(),
Forms\Components\Select::make('mr_pasien')
->label('Pasien')
->options(MsPasien::all()->pluck('nama', 'mr_pasien'))
->searchable()
->required(),
Forms\Components\Select::make('id_asuransi')
->label('Asuransi')
->options(MsAsuransi::all()->pluck('nama_asuransi', 'id_asuransi'))
->searchable()
->nullable(),
Forms\Components\Select::make('id_pegawai')
->label('Pegawai')
->options(MsPegawai::all()->pluck('nama_pegawai', 'id_pegawai'))
->searchable()
->required(),
Forms\Components\Select::make('id_ruang_pelayanan')
->label('Ruang Pelayanan')
->options(MsRuangPelayanan::all()->pluck('nama_ruang_pelayanan', 'id_ruang_pelayanan'))
->searchable()
->required(),
Forms\Components\Textarea::make('keterangan')
->label('Keterangan')
->nullable(),
]);
}
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->searchable()
->columns([
TextColumn::make('id_registrasi')->label('ID Registrasi')->sortable()->searchable(),
TextColumn::make('tgl_registrasi')->label('Tanggal Registrasi')->sortable()->searchable(),
TextColumn::make('pasien.nama')->label('Pasien')->sortable()->searchable(),
TextColumn::make('asuransi.nama_asuransi')->label('Asuransi')->default('-')->sortable()->searchable(),
TextColumn::make('pegawai.nama_pegawai')->label('Pegawai')->sortable()->searchable(),
TextColumn::make('ruangPelayanan.nama_ruang_pelayanan')->label('Ruang Pelayanan')->sortable()->searchable(),
// id transaksi if has
// url
TextColumn::make('transaksi.id_transaksi')->label('ID Transaksi')
->url(
function ($record) {
// check if nullable dont create a link
if ($record->transaksi) {
return TrTransaksiResource::getUrl('view', ['record' => $record->transaksi->id_transaksi]);
}
}
)
->default('Belum Ada Transaksi')
->openUrlInNewTab(),
])
->filters([])
->actions([
Tables\Actions\ViewAction::make(),
// Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListTrRegistrasis::route('/'),
'create' => Pages\CreateTrRegistrasi::route('/create'),
'view' => Pages\ViewTrRegistrasi::route('/{record}'),
// 'edit' => Pages\EditTrRegistrasi::route('/{record}/edit'),
];
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Filament\Resources\TrRegistrasiResource\Pages;
use App\Filament\Resources\TrRegistrasiResource;
use App\Filament\Resources\TrTransaksiResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateTrRegistrasi extends CreateRecord
{
protected static string $resource = TrRegistrasiResource::class;
protected static ?string $title = 'Tambah Registrasi';
// redirect to trTransaksi
protected function getRedirectUrl(): string
{
return TrTransaksiResource::getUrl('create');
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\TrRegistrasiResource\Pages;
use App\Filament\Resources\TrRegistrasiResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditTrRegistrasi extends EditRecord
{
protected static string $resource = TrRegistrasiResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\TrRegistrasiResource\Pages;
use App\Filament\Resources\TrRegistrasiResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListTrRegistrasis extends ListRecords
{
protected static string $resource = TrRegistrasiResource::class;
protected static ?string $title = 'Daftar Registrasi';
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->label('Tambah Registrasi')
->icon('heroicon-o-plus'),
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\TrRegistrasiResource\Pages;
use App\Filament\Resources\TrRegistrasiResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewTrRegistrasi extends ViewRecord
{
protected static string $resource = TrRegistrasiResource::class;
protected static ?string $title = 'Detail Registrasi';
protected function getHeaderActions(): array
{
return [
// Actions\EditAction::make(),
];
}
}

View File

@ -0,0 +1,191 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\TrTransaksiResource\Pages;
use App\Filament\Resources\TrTransaksiResource\RelationManagers;
use App\Models\MsPegawai;
use App\Models\MsTindakan;
use App\Models\TrRegistrasi;
use App\Models\TrTransaksi;
use Filament\Forms;
use Filament\Forms\Components\Placeholder;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Resources\Resource;
use Filament\Support\RawJs;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class TrTransaksiResource extends Resource
{
protected static ?string $model = TrTransaksi::class;
protected static ?string $pluralModelLabel = 'Transaksi Tindakan';
protected static ?string $navigationGroup = 'Transaksi';
protected static ?int $navigationSort = 2;
protected static ?string $navigationLabel = "Transaksi Tindakan";
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('id_registrasi')
->label('Registrasi')
->getSearchResultsUsing(function (string $search) {
return TrRegistrasi::query()
->whereRaw('LOWER(id_registrasi) like ?', ['%' . strtolower($search) . '%'])
->limit(50)
->orderBy('created_at', 'desc')
->get()
->mapWithKeys(function ($registrasi) {
return [
$registrasi->id_registrasi => "{$registrasi->id_registrasi} - {$registrasi->pasien->nama} - {$registrasi->pegawai->nama_pegawai} - {$registrasi->tgl_registrasi}",
];
})
->toArray();
})
->getOptionLabelUsing(function ($value): ?string {
$registrasi = TrRegistrasi::find($value);
return $registrasi
? "{$registrasi->id_registrasi} - {$registrasi->pasien->nama} - {$registrasi->pegawai->nama_pegawai} - {$registrasi->tgl_registrasi}"
: null;
})
->searchable()
->live()
->required(),
Forms\Components\Select::make('id_tindakan')
->label('Tindakan')
->options(MsTindakan::all()->pluck('nama_tindakan', 'id_tindakan'))
->searchable()
->multiple()
->required()
->live(),
Forms\Components\Select::make('id_pegawai')
->label('Pegawai')
->options(MsPegawai::all()->pluck('nama_pegawai', 'id_pegawai'))
->searchable()
->required(),
Forms\Components\Select::make('status')
->label('Status')
->options([
'pending' => 'Pending',
'paid' => 'Paid',
'cancelled' => 'Cancelled',
])
->required(),
Section::make('Detail Tindakan')
->schema([
Placeholder::make('')
->content(function (Get $get) {
// get registrasi by id_registrasi
$registrasi = TrRegistrasi::find($get('id_registrasi'));
// get tindakan by id_tindakan
$tindakan = MsTindakan::find($get('id_tindakan'));
return view('components.transactions.invoice-info', ['data' => $tindakan, 'registrasi' => $registrasi]);
})
])
->visible(function (Get $get) {
// if id_registrasi and id_tindakan is not empty
if ($get('id_registrasi') != "" && count($get('id_tindakan')) > 0) {
return true;
}
return false;
}),
//
]);
}
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->searchable()
->columns([
TextColumn::make('id_transaksi')->label('ID Transaksi')
->sortable()
->searchable(),
TextColumn::make('id_registrasi')->label('Registrasi')
->url(fn($record) => TrRegistrasiResource::getUrl('view', ['record' => $record->id_registrasi]))
->openUrlInNewTab()
->searchable()
->sortable(),
TextColumn::make('id_tindakan')->label('Tindakan')
->wrap()
->searchable(),
TextColumn::make('total_harga')->label('Total Harga')
->money('IDR')
->sortable(),
TextColumn::make('status')->label('Status')
->badge()
->color(fn($state) => match ($state) {
'pending' => 'warning',
'paid' => 'success',
'cancelled' => 'danger',
})
->sortable(),
TextColumn::make('id_pegawai')->label('Pegawai')
->url(fn($record) => MsPegawaiResource::getUrl('view', ['record' => $record->id_pegawai]))
->openUrlInNewTab()
->sortable(),
TextColumn::make('created_at')->label('Tanggal Dibuat')
->sortable(),
])
->filters([
SelectFilter::make('status')
->label('Status')
->options([
'pending' => 'Pending',
'paid' => 'Paid',
'cancelled' => 'Cancelled',
])
])
->actions([
Tables\Actions\ViewAction::make(),
// Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
// mark as paid
Tables\Actions\Action::make('markAsPaid')
->requiresConfirmation()
->label('Tandai Sebagai Lunas')
->icon('heroicon-o-check-circle')
->color('success')
->action(function ($record) {
$record->status = 'paid';
$record->save();
})->visible(function ($record) {
return $record->status == 'pending';
}),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListTrTransaksis::route('/'),
'create' => Pages\CreateTrTransaksi::route('/create'),
'view' => Pages\ViewTrTransaksi::route('/{record}'),
// 'edit' => Pages\EditTrTransaksi::route('/{record}/edit'),
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Filament\Resources\TrTransaksiResource\Pages;
use App\Filament\Resources\TrTransaksiResource;
use App\Models\MsTindakan;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateTrTransaksi extends CreateRecord
{
protected static string $resource = TrTransaksiResource::class;
protected static ?string $title = 'Tambah Transaksi';
// mutate form data before create
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['total_harga'] = 0;
foreach ($data['id_tindakan'] as $tindakan) {
// find tindakan by id
$tindakan = MsTindakan::find($tindakan);
// add total harga to data
$data['total_harga'] += $tindakan->tarif_tindakan;
}
return $data;
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\TrTransaksiResource\Pages;
use App\Filament\Resources\TrTransaksiResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditTrTransaksi extends EditRecord
{
protected static string $resource = TrTransaksiResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
];
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\TrTransaksiResource\Pages;
use App\Filament\Resources\TrTransaksiResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListTrTransaksis extends ListRecords
{
protected static string $resource = TrTransaksiResource::class;
protected static ?string $title = 'Daftar Transaksi';
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->label('Tambah Transaksi')
->icon('heroicon-o-plus'),
];
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace App\Filament\Resources\TrTransaksiResource\Pages;
use App\Filament\Resources\TrTransaksiResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
use Torgodly\Html2Media\Actions\Html2MediaAction;
class ViewTrTransaksi extends ViewRecord
{
protected static string $resource = TrTransaksiResource::class;
protected static ?string $title = 'Detail Transaksi';
protected function getHeaderActions(): array
{
return [
// Actions\EditAction::make(),
Actions\Action::make('markAsPaid')
->requiresConfirmation()
->label('Tandai Sebagai Lunas')
->icon('heroicon-o-check-circle')
->color('success')
->action(function ($record) {
$record->status = 'paid';
$record->save();
})->visible(function ($record) {
return $record->status == 'pending';
}),
Html2MediaAction::make('print')
->scale(2)
->print() // Enable print option
->preview()
->filename(function ($record) {
return 'invoice-' . $record->id_transaksi . '.pdf';
})
->content(function ($record) {
return view('components.pdf.invoice-detail', ['record' => $record]);
})
->savePdf() // Enable save as PDF option
->requiresConfirmation() // Show confirmation modal
->pagebreak('section', ['css', 'legacy'])
->orientation('portrait') // Portrait orientation
->format('a4', 'mm') // A4 format with mm units
->enableLinks() // Enable links in PDF
->margin([25, 50, 0, 50]) //
];
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace App\Filament\Widgets;
use App\Filament\Resources\TrRegistrasiResource;
use App\Filament\Resources\TrTransaksiResource;
use App\Models\TrRegistrasi;
use App\Models\TrTransaksi;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;
use Illuminate\Support\HtmlString;
class StatsOverview extends BaseWidget
{
protected function getStats(): array
{
return [
// total pasien hari ini, deskripsi jumlah keseluruhan pasien dengan link ke halaman pasien
Stat::make('Total Pasien Hari Ini', TrRegistrasi::whereDate('tgl_registrasi', now()->toDateString())->count())
->description(new HtmlString(
'Jumlah keseluruhan ' . TrRegistrasi::count() . ' pasien'
. '<br/><a class="underline" href="' . TrRegistrasiResource::getUrl('index') . '"> Lihat Semua Pasien</a>'
)),
// total pasien bulan ini, deskripsi jumlah keseluruhan pasien dengan link ke halaman pasien
Stat::make('Total Pasien Bulan Ini', TrRegistrasi::whereMonth('tgl_registrasi', now()->month)->count())
->description(new HtmlString(
// ini bulan lalu
'Jumlah keseluruhan ' . TrRegistrasi::whereMonth('tgl_registrasi', now()->subMonth()->month)->count() . ' pasien bulan lalu'
. '<br/><a class="underline" href="' . TrRegistrasiResource::getUrl('index') . '"> Lihat Semua Pasien</a>'
)),
// total tagihan, deskripsi jumlah keseluruhan tagihan dengan link ke halaman tagihan
Stat::make('Total Pendapatan Hari Ini', 'Rp ' . number_format(TrTransaksi::whereDate('created_at', now()->toDateString())->where('status', 'paid')->sum('total_harga'), 0, ',', '.'))
->description(new HtmlString(
'Jumlah keseluruhan <strong>Rp.' . number_format(TrTransaksi::where('status', 'paid')->sum('total_harga'), 0, ',', '.') . '</strong> tagihan'
. '<br/><a class="underline" href="' . TrTransaksiResource::getUrl('index') . '"> Lihat Semua Tagihan</a>'
)),
// total tagihan bulan ini, deskripsi jumlah keseluruhan tagihan dengan link ke halaman tagihan
Stat::make('Total Pendapatan Bulan Ini', 'Rp ' . number_format(TrTransaksi::whereMonth('created_at', now()->month)->where('status', 'paid')->sum('total_harga'), 0, ',', '.'))
->description(new HtmlString(
// ini bulan lalu
'Jumlah keseluruhan <strong>Rp.' . number_format(TrTransaksi::whereMonth('created_at', now()->subMonth()->month)->where('status', 'paid')->sum('total_harga'), 0, ',', '.') . '</strong> tagihan bulan lalu'
. '<br/><a class="underline" href="' . TrTransaksiResource::getUrl('index') . '"> Lihat Semua Tagihan</a>'
)),
];
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace App\Filament\Widgets;
use App\Models\TrRegistrasi;
use Carbon\Carbon;
use Filament\Widgets\ChartWidget;
use Livewire\Attributes\On;
class StatsPasienTrends extends ChartWidget
{
protected static ?string $heading = 'Trends Registrasi Pasien';
public $filtering_date;
#[On('filter')]
public function filter($data)
{
$this->filtering_date = $data;
}
protected function getData(): array
{
// filtering date return string: 27/04/2025 - 27/05/2025
if ($this->filtering_date) {
$filtering_date = explode(' - ', $this->filtering_date);
$start_date = $filtering_date[0];
$end_date = $filtering_date[1];
// format using carbon
$start_date = Carbon::createFromFormat('d/m/Y', $start_date)->format('Y-m-d');
$end_date = Carbon::createFromFormat('d/m/Y', $end_date)->format('Y-m-d');
$data = TrRegistrasi::whereBetween('tgl_registrasi', [$start_date, $end_date])->orderBy('tgl_registrasi', 'asc')->get();
} else {
$data = TrRegistrasi::orderBy('tgl_registrasi', 'asc')->get();
}
$data = $data->groupBy('tgl_registrasi')->map(function ($item) {
return $item->count();
});
return [
'datasets' => [
[
'label' => 'Jumlah Pasien',
'data' => $data->values(),
],
],
'labels' => $data->keys(),
];
}
protected function getType(): string
{
return 'line';
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace App\Filament\Widgets;
use App\Models\TrRegistrasi;
use App\Models\TrTransaksi;
use Carbon\Carbon;
use Filament\Widgets\ChartWidget;
use Livewire\Attributes\On;
class StatsPendapatanTrends extends ChartWidget
{
protected static ?string $heading = 'Trends Pendapatan';
public $filtering_date;
#[On('filter')]
public function filter($data)
{
$this->filtering_date = $data;
}
protected function getData(): array
{
if ($this->filtering_date) {
$filtering_date = explode(' - ', $this->filtering_date);
$start_date = $filtering_date[0];
$end_date = $filtering_date[1];
// Format pakai Carbon
$start_date = Carbon::createFromFormat('d/m/Y', $start_date)->format('Y-m-d');
$end_date = Carbon::createFromFormat('d/m/Y', $end_date)->format('Y-m-d');
$query = TrTransaksi::whereBetween('created_at', [$start_date, $end_date]);
} else {
$query = TrTransaksi::query();
}
$data = $query->where('status', 'paid')
->selectRaw('DATE(created_at) as tanggal, SUM(total_harga) as total')
->groupBy('tanggal')
->orderBy('tanggal')
->get()
->pluck('total', 'tanggal');
return [
'datasets' => [
[
'label' => 'Pendapatan',
'data' => $data->values(),
'borderColor' => '#4f46e5',
'backgroundColor' => '#c7d2fe',
],
],
'labels' => $data->keys(),
];
}
protected function getType(): string
{
return 'line';
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

12
app/Models/MsAsuransi.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MsAsuransi extends Model
{
protected $table = 'ms_asuransi';
protected $primaryKey = 'id_asuransi';
protected $guarded = [];
}

12
app/Models/MsPasien.php Normal file
View File

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MsPasien extends Model
{
protected $table = 'ms_pasien';
protected $primaryKey = 'mr_pasien';
protected $guarded = [];
}

13
app/Models/MsPegawai.php Normal file
View File

@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MsPegawai extends Model
{
protected $table = 'ms_pegawai';
protected $primaryKey = 'id_pegawai';
protected $keyType = 'string';
protected $guarded = [];
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MsRuangPelayanan extends Model
{
protected $table = 'ms_ruang_pelayanan';
protected $primaryKey = 'id_ruang_pelayanan';
protected $keyType = 'string';
protected $guarded = [];
}

13
app/Models/MsTindakan.php Normal file
View File

@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MsTindakan extends Model
{
protected $table = 'ms_tindakan';
protected $primaryKey = 'id_tindakan';
protected $keyType = 'string';
protected $guarded = [];
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class TrPembayaran extends Model
{
protected $table = 'tr_pembayaran';
protected $primaryKey = 'id_pembayaran';
protected $guarded = [];
}

View File

@ -0,0 +1,54 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class TrRegistrasi extends Model
{
protected $table = 'tr_registrasi';
protected $primaryKey = 'id_registrasi';
protected $keyType = 'string';
protected $guarded = [];
protected static function booted()
{
static::creating(function ($model) {
if (empty($model->id_registrasi)) {
$model->id_registrasi = 'REG-' . strtoupper(Str::random(6));
}
});
}
public function pasien()
{
return $this->belongsTo(MsPasien::class, 'mr_pasien', 'mr_pasien');
}
public function asuransi()
{
return $this->belongsTo(MsAsuransi::class, 'id_asuransi', 'id_asuransi');
}
public function pegawai()
{
return $this->belongsTo(MsPegawai::class, 'id_pegawai', 'id_pegawai');
}
public function ruangPelayanan()
{
return $this->belongsTo(MsRuangPelayanan::class, 'id_ruang_pelayanan', 'id_ruang_pelayanan');
}
public function tindakan()
{
return $this->belongsTo(MsTindakan::class, 'id_tindakan', 'id_tindakan');
}
public function transaksi()
{
return $this->hasOne(TrTransaksi::class, 'id_registrasi', 'id_registrasi');
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class TrTransaksi extends Model
{
protected $table = 'tr_transaksi';
protected $primaryKey = 'id_transaksi';
protected $keyType = 'string';
protected $guarded = [];
protected $casts = [
'id_tindakan' => 'array',
];
protected static function booted()
{
static::creating(function ($model) {
if (empty($model->id_transaksi)) {
$model->id_transaksi = 'TRX-' . strtoupper(Str::random(6));
}
});
}
public function registrasi()
{
return $this->belongsTo(TrRegistrasi::class, 'id_registrasi', 'id_registrasi');
}
public function tindakan()
{
return $this->belongsTo(MsTindakan::class, 'id_tindakan', 'id_tindakan');
}
public function pegawai()
{
return $this->belongsTo(MsPegawai::class, 'id_pegawai', 'id_pegawai');
}
public function getPasienAttribute()
{
return $this->registrasi->pasien;
}
}

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

@ -0,0 +1,48 @@
<?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;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Providers\Filament;
use App\Filament\Widgets\StatsOverview;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\AuthenticateSession;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Pages;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Widgets;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login()
->colors([
'primary' => Color::Amber,
])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->pages([
// <Pages></Pages>\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
// StatsOverview::class,
// Widgets\AccountWidget::class,
// Widgets\FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
}

15
artisan Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
$status = (require_once __DIR__.'/bootstrap/app.php')
->handleCommand(new ArgvInput);
exit($status);

18
bootstrap/app.php Normal file
View File

@ -0,0 +1,18 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();

2
bootstrap/cache/.gitignore vendored Normal file
View File

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

6
bootstrap/providers.php Normal file
View File

@ -0,0 +1,6 @@
<?php
return [
App\Providers\AppServiceProvider::class,
App\Providers\Filament\AdminPanelProvider::class,
];

75
composer.json Normal file
View File

@ -0,0 +1,75 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"filament/filament": "^3.3",
"laravel/framework": "^11.31",
"laravel/tinker": "^2.9",
"malzariey/filament-daterangepicker-filter": "^3.3",
"torgodly/html2media": "^1.1"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.1",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^11.0.1"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi",
"@php artisan filament:upgrade"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

9882
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

126
config/app.php Normal file
View File

@ -0,0 +1,126 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (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
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => env('APP_TIMEZONE', 'UTC'),
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];

115
config/auth.php Normal file
View File

@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

108
config/cache.php Normal file
View File

@ -0,0 +1,108 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| 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: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_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' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_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'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

173
config/database.php Normal file
View File

@ -0,0 +1,173 @@
<?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 database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_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'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_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('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| 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 on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| 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 Memcached. You may define your connection settings here.
|
*/
'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'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

80
config/filesystems.php Normal file
View File

@ -0,0 +1,80 @@
<?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 for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
'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'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| 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'),
],
];

132
config/logging.php Normal file
View File

@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

116
config/mail.php Normal file
View File

@ -0,0 +1,116 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| 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 that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails 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 emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
];

112
config/queue.php Normal file
View File

@ -0,0 +1,112 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'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', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];

38
config/services.php Normal file
View File

@ -0,0 +1,38 @@
<?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.
|
*/
'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'),
],
'resend' => [
'key' => env('RESEND_KEY'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
];

217
config/session.php Normal file
View File

@ -0,0 +1,217 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| 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 expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'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'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| 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 session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'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're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain and all subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| 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 when it can't 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. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_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" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
];

1
database/.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
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.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ms_pasien', function (Blueprint $table) {
$table->id('mr_pasien');
$table->string('nama');
$table->string('nik')->unique();
$table->string('no_hp');
$table->string('alamat');
$table->string('email');
$table->date('tgl_lahir');
$table->enum('jenis_kelamin', ['L', 'P']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ms_pasien');
}
};

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ms_asuransi', function (Blueprint $table) {
$table->id('id_asuransi');
$table->string('nama_asuransi');
$table->string('keterangan')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ms_asuransi');
}
};

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ms_pegawai', function (Blueprint $table) {
$table->string('id_pegawai')->primary();
$table->string('nama_pegawai');
$table->string('no_hp');
$table->string('email');
$table->string('alamat');
$table->string('jabatan');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ms_pegawai');
}
};

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ms_ruang_pelayanan', function (Blueprint $table) {
$table->string('id_ruang_pelayanan')->primary();
$table->string('nama_ruang_pelayanan');
$table->string('keterangan')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ms_ruang_pelayanan');
}
};

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ms_tindakan', function (Blueprint $table) {
$table->string('id_tindakan')->primary();
$table->string('nama_tindakan');
$table->decimal('tarif_tindakan', 12, 2);
$table->string('keterangan')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ms_tindakan');
}
};

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tr_registrasi', function (Blueprint $table) {
$table->string('id_registrasi')->primary();
$table->date('tgl_registrasi');
$table->unsignedBigInteger('mr_pasien');
$table->unsignedBigInteger('id_asuransi')->nullable();
$table->string('id_pegawai');
$table->string('id_ruang_pelayanan');
$table->string('nomor_kartu_asuransi')->nullable();
$table->text('keterangan')->nullable();
$table->timestamps();
$table->foreign('mr_pasien')->references('mr_pasien')->on('ms_pasien');
$table->foreign('id_asuransi')->references('id_asuransi')->on('ms_asuransi');
$table->foreign('id_pegawai')->references('id_pegawai')->on('ms_pegawai');
$table->foreign('id_ruang_pelayanan')->references('id_ruang_pelayanan')->on('ms_ruang_pelayanan');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tr_registrasi');
}
};

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tr_transaksi', function (Blueprint $table) {
$table->string('id_transaksi')->primary();
$table->string('id_registrasi');
// id tindakan as array cause has multiple tindakan
$table->json('id_tindakan');
$table->string('id_pegawai');
$table->decimal('total_harga', 15, 2);
$table->enum('status', ['pending', 'paid', 'cancelled'])->default('pending');
$table->string('keterangan')->nullable();
$table->timestamps();
$table->foreign('id_registrasi')->references('id_registrasi')->on('tr_registrasi');
$table->foreign('id_pegawai')->references('id_pegawai')->on('ms_pegawai');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tr_transaksi');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tr_pembayaran', function (Blueprint $table) {
$table->id('id_pembayaran');
$table->string('id_registrasi');
$table->date('tgl_pembayaran');
$table->decimal('total_tagihan', 12, 2);
$table->decimal('jumlah_bayar', 12, 2);
$table->enum('metode_pembayaran', ['cash', 'asuransi', 'transfer']);
$table->text('keterangan')->nullable();
$table->timestamps();
$table->foreign('id_registrasi')->references('id_registrasi')->on('tr_registrasi');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tr_pembayaran');
}
};

View File

@ -0,0 +1,27 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class AsuransiSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$faker = \Faker\Factory::create();
foreach (range(1, 10) as $i) {
DB::table('ms_asuransi')->insert([
'nama_asuransi' => 'Asuransi ' . $faker->word,
'keterangan' => $faker->sentence,
'created_at' => now(),
'updated_at' => now(),
]);
}
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace Database\Seeders;
use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'User',
'email' => 'user@example.com',
'password' => Hash::make('Password123'),
]);
$this->call([
PasienSeeder::class,
AsuransiSeeder::class,
PegawaiSeeder::class,
RuangPelayananSeeder::class,
TindakanSeeder::class,
RegisterSeeder::class,
TransaksiSeed::class,
]);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class PasienSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$faker = \Faker\Factory::create();
foreach (range(1, 10) as $i) {
DB::table('ms_pasien')->insert([
'nama' => $faker->name,
'nik' => $faker->unique()->randomNumber(8),
'no_hp' => $faker->phoneNumber,
'alamat' => $faker->address,
'email' => $faker->email,
'tgl_lahir' => $faker->date('Y-m-d', '-18 years'), // minimal 18 tahun
'jenis_kelamin' => $faker->randomElement(['L', 'P']),
'created_at' => now(),
'updated_at' => now(),
]);
}
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class PegawaiSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$faker = \Faker\Factory::create();
foreach (range(1, 10) as $i) {
DB::table('ms_pegawai')->insert([
'id_pegawai' => 'PGW-' . $faker->unique()->randomNumber(8),
'nama_pegawai' => $faker->name,
'no_hp' => $faker->phoneNumber,
'email' => $faker->email,
'alamat' => $faker->address,
'jabatan' => $faker->jobTitle,
'created_at' => now(),
'updated_at' => now(),
]);
}
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace Database\Seeders;
use App\Models\MsPasien;
use App\Models\MsAsuransi;
use App\Models\MsPegawai;
use App\Models\MsRuangPelayanan;
use App\Models\TrRegistrasi;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class RegisterSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$faker = \Faker\Factory::create();
for ($i = 0; $i < 10; $i++) {
TrRegistrasi::create([
'id_registrasi' => 'REG-' . $faker->unique()->randomNumber(8),
'tgl_registrasi' => $faker->date(),
'mr_pasien' => MsPasien::all()->random()->mr_pasien,
'id_asuransi' => MsAsuransi::all()->random()->id_asuransi,
'id_pegawai' => MsPegawai::all()->random()->id_pegawai,
'id_ruang_pelayanan' => MsRuangPelayanan::all()->random()->id_ruang_pelayanan,
'nomor_kartu_asuransi' => $faker->randomNumber(5),
]);
}
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class RuangPelayananSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$faker = \Faker\Factory::create();
foreach (range(1, 10) as $i) {
DB::table('ms_ruang_pelayanan')->insert([
'id_ruang_pelayanan' => 'RPL-' . $faker->unique()->randomNumber(8),
'nama_ruang_pelayanan' => 'Ruang ' . $faker->word,
'keterangan' => $faker->sentence,
'created_at' => now(),
'updated_at' => now(),
]);
}
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class TindakanSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$faker = \Faker\Factory::create();
foreach (range(1, 10) as $i) {
DB::table('ms_tindakan')->insert([
'id_tindakan' => 'TIN-' . $faker->unique()->randomNumber(8),
'nama_tindakan' => 'Tindakan ' . $faker->word,
'tarif_tindakan' => $faker->randomFloat(2, 50000, 500000),
'keterangan' => $faker->sentence,
'created_at' => now(),
'updated_at' => now(),
]);
}
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace Database\Seeders;
use App\Models\MsAsuransi;
use App\Models\MsPasien;
use App\Models\MsPegawai;
use App\Models\MsRuangPelayanan;
use App\Models\MsTindakan;
use App\Models\TrRegistrasi;
use App\Models\TrTransaksi;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class TransaksiSeed extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
$faker = \Faker\Factory::create();
// random id tindakan return array of id tindakan, 1-4
$id_tindakan = MsTindakan::all()->pluck('id_tindakan')->toArray();
// make sure id_tindakan more than 1
$id_tindakan = array_map(function ($id) {
return [$id];
}, $id_tindakan);
foreach (range(1, 10) as $i) {
TrTransaksi::create([
'id_transaksi' => 'TRX-' . $faker->unique()->randomNumber(8),
'id_registrasi' => TrRegistrasi::all()->random()->id_registrasi,
'id_tindakan' => $id_tindakan[array_rand($id_tindakan)],
'id_pegawai' => MsPegawai::all()->random()->id_pegawai,
'total_harga' => $faker->randomFloat(2, 50000, 500000),
'status' => 'pending',
'keterangan' => $faker->sentence,
'created_at' => now(),
'updated_at' => now(),
]);
}
}
}

17
package.json Normal file
View File

@ -0,0 +1,17 @@
{
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"autoprefixer": "^10.4.20",
"axios": "^1.7.4",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^1.2.0",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.13",
"vite": "^6.0.11"
}
}

33
phpunit.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_STORE" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>

6
postcss.config.js Normal file
View File

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

25
public/.htaccess Normal file
View File

@ -0,0 +1,25 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Handle X-XSRF-Token Header
RewriteCond %{HTTP:x-xsrf-token} .
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
.fi-pagination-items,.fi-pagination-overview,.fi-pagination-records-per-page-select:not(.fi-compact){display:none}@supports (container-type:inline-size){.fi-pagination{container-type:inline-size}@container (min-width: 28rem){.fi-pagination-records-per-page-select.fi-compact{display:none}.fi-pagination-records-per-page-select:not(.fi-compact){display:inline}}@container (min-width: 56rem){.fi-pagination:not(.fi-simple)>.fi-pagination-previous-btn{display:none}.fi-pagination-overview{display:inline}.fi-pagination:not(.fi-simple)>.fi-pagination-next-btn{display:none}.fi-pagination-items{display:flex}}}@supports not (container-type:inline-size){@media (min-width:640px){.fi-pagination-records-per-page-select.fi-compact{display:none}.fi-pagination-records-per-page-select:not(.fi-compact){display:inline}}@media (min-width:768px){.fi-pagination:not(.fi-simple)>.fi-pagination-previous-btn{display:none}.fi-pagination-overview{display:inline}.fi-pagination:not(.fi-simple)>.fi-pagination-next-btn{display:none}.fi-pagination-items{display:flex}}}.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{background-color:#333;border-radius:4px;color:#fff;font-size:14px;line-height:1.4;outline:0;position:relative;transition-property:transform,visibility,opacity;white-space:normal}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{border-top-color:initial;border-width:8px 8px 0;bottom:-7px;left:0;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:initial;border-width:0 8px 8px;left:0;top:-7px;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-left-color:initial;border-width:8px 0 8px 8px;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{border-right-color:initial;border-width:8px 8px 8px 0;left:-7px;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{color:#333;height:16px;width:16px}.tippy-arrow:before{border-color:transparent;border-style:solid;content:"";position:absolute}.tippy-content{padding:5px 9px;position:relative;z-index:1}.tippy-box[data-theme~=light]{background-color:#fff;box-shadow:0 0 20px 4px #9aa1b126,0 4px 80px -8px #24282f40,0 4px 4px -2px #5b5e6926;color:#26323d}.tippy-box[data-theme~=light][data-placement^=top]>.tippy-arrow:before{border-top-color:#fff}.tippy-box[data-theme~=light][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#fff}.tippy-box[data-theme~=light][data-placement^=left]>.tippy-arrow:before{border-left-color:#fff}.tippy-box[data-theme~=light][data-placement^=right]>.tippy-arrow:before{border-right-color:#fff}.tippy-box[data-theme~=light]>.tippy-backdrop{background-color:#fff}.tippy-box[data-theme~=light]>.tippy-svg-arrow{fill:#fff}.fi-sortable-ghost{opacity:.3}

File diff suppressed because one or more lines are too long

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