Initial commit - lms-v2 + CLAUDE.md
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Filesystem\FilesystemAdapter;
|
||||
use League\Flysystem\Filesystem;
|
||||
use League\Flysystem\WebDAV\WebDAVAdapter;
|
||||
use Sabre\DAV\Client;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// Mencatat setiap kali user Login
|
||||
Event::listen(function (Login $event) {
|
||||
activity('autentikasi')
|
||||
->causedBy($event->user)
|
||||
->log('User berhasil login ke dalam sistem');
|
||||
});
|
||||
|
||||
// Mencatat setiap kali user Logout
|
||||
Event::listen(function (Logout $event) {
|
||||
activity('autentikasi')
|
||||
->causedBy($event->user)
|
||||
->log('User keluar (logout) dari sistem');
|
||||
});
|
||||
|
||||
// Mendaftarkan Custom Driver Nextcloud (WebDAV)
|
||||
Storage::extend('webdav', function ($app, $config) {
|
||||
$client = new Client([
|
||||
'baseUri' => $config['baseUri'],
|
||||
'userName' => $config['userName'],
|
||||
'password' => $config['password'],
|
||||
]);
|
||||
|
||||
$adapter = new WebDAVAdapter($client, $config['pathPrefix'] ?? '');
|
||||
$driver = new Filesystem($adapter);
|
||||
|
||||
return new FilesystemAdapter($driver, $adapter, $config);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user