Initial commit
This commit is contained in:
commit
043116fbc9
|
|
@ -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
|
||||||
|
|
||||||
|
[compose.yaml]
|
||||||
|
indent_size = 4
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
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}"
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
*.log
|
||||||
|
.DS_Store
|
||||||
|
.env
|
||||||
|
.env.backup
|
||||||
|
.env.production
|
||||||
|
.phpactor.json
|
||||||
|
.phpunit.result.cache
|
||||||
|
/.fleet
|
||||||
|
/.idea
|
||||||
|
/.nova
|
||||||
|
/.phpunit.cache
|
||||||
|
/.vscode
|
||||||
|
/.zed
|
||||||
|
/auth.json
|
||||||
|
/node_modules
|
||||||
|
/public/build
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/storage/*.key
|
||||||
|
/storage/pail
|
||||||
|
/vendor
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
Thumbs.db
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||||
|
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||||
|
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||||
|
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## About Laravel
|
||||||
|
|
||||||
|
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||||
|
|
||||||
|
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||||
|
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||||
|
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||||
|
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||||
|
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||||
|
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||||
|
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||||
|
|
||||||
|
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||||
|
|
||||||
|
## Learning Laravel
|
||||||
|
|
||||||
|
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. You can also check out [Laravel Learn](https://laravel.com/learn), where you will be guided through building a modern Laravel application.
|
||||||
|
|
||||||
|
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||||
|
|
||||||
|
## Laravel Sponsors
|
||||||
|
|
||||||
|
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
|
||||||
|
|
||||||
|
### Premium Partners
|
||||||
|
|
||||||
|
- **[Vehikl](https://vehikl.com)**
|
||||||
|
- **[Tighten Co.](https://tighten.co)**
|
||||||
|
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||||
|
- **[64 Robots](https://64robots.com)**
|
||||||
|
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
|
||||||
|
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
|
||||||
|
- **[Redberry](https://redberry.international/laravel-development)**
|
||||||
|
- **[Active Logic](https://activelogic.com)**
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||||
|
|
||||||
|
## Code of Conduct
|
||||||
|
|
||||||
|
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||||
|
|
||||||
|
## Security Vulnerabilities
|
||||||
|
|
||||||
|
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Auth\LoginRequest;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class AuthenticatedSessionController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the login view.
|
||||||
|
*/
|
||||||
|
public function create(): View
|
||||||
|
{
|
||||||
|
return view('auth.login');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming authentication request.
|
||||||
|
*/
|
||||||
|
public function store(LoginRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->authenticate();
|
||||||
|
|
||||||
|
$request->session()->regenerate();
|
||||||
|
|
||||||
|
return redirect()->intended(route('beranda', absolute: false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy an authenticated session.
|
||||||
|
*/
|
||||||
|
public function destroy(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
Auth::guard('web')->logout();
|
||||||
|
|
||||||
|
$request->session()->invalidate();
|
||||||
|
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
|
return redirect('/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class ConfirmablePasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the confirm password view.
|
||||||
|
*/
|
||||||
|
public function show(): View
|
||||||
|
{
|
||||||
|
return view('auth.confirm-password');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirm the user's password.
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if (! Auth::guard('web')->validate([
|
||||||
|
'email' => $request->user()->email,
|
||||||
|
'password' => $request->password,
|
||||||
|
])) {
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'password' => __('auth.password'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->session()->put('auth.password_confirmed_at', time());
|
||||||
|
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class EmailVerificationNotificationController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Send a new email verification notification.
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false));
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->user()->sendEmailVerificationNotification();
|
||||||
|
|
||||||
|
return back()->with('status', 'verification-link-sent');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class EmailVerificationPromptController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the email verification prompt.
|
||||||
|
*/
|
||||||
|
public function __invoke(Request $request): RedirectResponse|View
|
||||||
|
{
|
||||||
|
return $request->user()->hasVerifiedEmail()
|
||||||
|
? redirect()->intended(route('dashboard', absolute: false))
|
||||||
|
: view('auth.verify-email');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Auth\Events\PasswordReset;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\Rules;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class NewPasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the password reset view.
|
||||||
|
*/
|
||||||
|
public function create(Request $request): View
|
||||||
|
{
|
||||||
|
return view('auth.reset-password', ['request' => $request]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming new password request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'token' => ['required'],
|
||||||
|
'email' => ['required', 'email'],
|
||||||
|
'password' => ['required', 'confirmed', 'min:6', 'max:20'],
|
||||||
|
], [
|
||||||
|
'email.required' => 'Email wajib diisi.',
|
||||||
|
'email.email' => 'Format email tidak valid.',
|
||||||
|
|
||||||
|
'password.required' => 'Kata sandi wajib diisi.',
|
||||||
|
'password.confirmed' => 'Konfirmasi kata sandi tidak cocok.',
|
||||||
|
'password.min' => 'Kata sandi minimal 6 karakter.',
|
||||||
|
'password.max' => 'Kata sandi maksimal 20 karakter.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$status = Password::reset(
|
||||||
|
$request->only('email', 'password', 'password_confirmation', 'token'),
|
||||||
|
function (User $user) use ($request) {
|
||||||
|
$user->forceFill([
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
'remember_token' => Str::random(60),
|
||||||
|
])->save();
|
||||||
|
|
||||||
|
event(new PasswordReset($user));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $status == Password::PASSWORD_RESET
|
||||||
|
? redirect()->route('login')->with('status', 'Kata sandi berhasil diperbarui. Silakan login.')
|
||||||
|
: back()->withInput($request->only('email'))
|
||||||
|
->withErrors(['email' => 'Token reset tidak valid atau sudah kedaluwarsa.']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Validation\Rules\Password;
|
||||||
|
|
||||||
|
class PasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Update the user's password.
|
||||||
|
*/
|
||||||
|
public function update(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validateWithBag('updatePassword', [
|
||||||
|
'current_password' => ['required', 'current_password'],
|
||||||
|
'password' => ['required', Password::defaults(), 'confirmed'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$request->user()->update([
|
||||||
|
'password' => Hash::make($validated['password']),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return back()->with('status', 'password-updated');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class PasswordResetLinkController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the password reset link request view.
|
||||||
|
*/
|
||||||
|
public function create(): View
|
||||||
|
{
|
||||||
|
return view('auth.forgot-password');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming password reset link request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'email' => ['required', 'email'],
|
||||||
|
], [
|
||||||
|
'email.required' => 'Email wajib diisi.',
|
||||||
|
'email.email' => 'Format email tidak valid.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$status = Password::sendResetLink(
|
||||||
|
$request->only('email')
|
||||||
|
);
|
||||||
|
|
||||||
|
return $status == Password::RESET_LINK_SENT
|
||||||
|
? back()->with('status', 'Link reset kata sandi berhasil dikirim ke email Anda.')
|
||||||
|
: back()->withInput($request->only('email'))
|
||||||
|
->withErrors(['email' => 'Email tidak ditemukan dalam sistem.']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Validation\Rules;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class RegisteredUserController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the registration view.
|
||||||
|
*/
|
||||||
|
public function create(): View
|
||||||
|
{
|
||||||
|
return view('auth.register');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming registration request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => ['required', 'string', 'max:255'],
|
||||||
|
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class],
|
||||||
|
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $request->name,
|
||||||
|
'email' => $request->email,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
]);
|
||||||
|
|
||||||
|
event(new Registered($user));
|
||||||
|
|
||||||
|
Auth::login($user);
|
||||||
|
|
||||||
|
return redirect(route('dashboard', absolute: false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Auth\Events\Verified;
|
||||||
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
|
||||||
|
class VerifyEmailController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Mark the authenticated user's email address as verified.
|
||||||
|
*/
|
||||||
|
public function __invoke(EmailVerificationRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->user()->markEmailAsVerified()) {
|
||||||
|
event(new Verified($request->user()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,288 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\MutasiAyam;
|
||||||
|
use App\Models\Kandang;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
|
class AyamController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$query = MutasiAyam::with('kandang');
|
||||||
|
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
$query->where('user_id', $user->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->search) {
|
||||||
|
$query->where(function ($q) use ($request) {
|
||||||
|
$q->whereHas('kandang', function ($k) use ($request) {
|
||||||
|
$k->where('nama_kandang', 'like', '%' . $request->search . '%');
|
||||||
|
})->orWhere('keterangan', 'like', '%' . $request->search . '%');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->kandang) $query->where('kandang_id', $request->kandang);
|
||||||
|
if ($request->bulan) $query->whereMonth('tanggal', $request->bulan);
|
||||||
|
if ($request->tahun) $query->whereYear('tanggal', $request->tahun);
|
||||||
|
|
||||||
|
$perPage = $request->perPage ?? 10;
|
||||||
|
$data = $query
|
||||||
|
->orderBy('tanggal', 'desc') // tanggal terbaru dulu
|
||||||
|
->orderBy('id', 'desc') // jika tanggal sama, yang terakhir ditambah tetap di atas
|
||||||
|
->paginate($perPage)
|
||||||
|
->withQueryString();
|
||||||
|
|
||||||
|
// jumlah ayam terakhir per kandang
|
||||||
|
$kandang = Kandang::query()
|
||||||
|
->select('id', 'nama_kandang')
|
||||||
|
->selectSub(function ($q) {
|
||||||
|
$q->from('mutasi_ayam')
|
||||||
|
->whereColumn('mutasi_ayam.kandang_id', 'kandang.id')
|
||||||
|
->selectRaw("
|
||||||
|
COALESCE(SUM(
|
||||||
|
CASE
|
||||||
|
WHEN jenis_mutasi = 'masuk' THEN jumlah
|
||||||
|
WHEN jenis_mutasi IN ('mati','afkir','pindah') THEN -jumlah
|
||||||
|
ELSE 0
|
||||||
|
END
|
||||||
|
), 0)
|
||||||
|
");
|
||||||
|
}, 'jumlah_ayam_terakhir')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('inventori-ayam', compact('data', 'kandang'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'jenis_mutasi' => 'required|in:masuk,mati,afkir,pindah',
|
||||||
|
'jumlah' => 'required|integer|min:1|max:9999',
|
||||||
|
'tanggal' => 'required|date|before_or_equal:today',
|
||||||
|
], [
|
||||||
|
'jenis_mutasi.required' => 'Jenis mutasi wajib dipilih.',
|
||||||
|
'jenis_mutasi.in' => 'Jenis mutasi tidak valid.',
|
||||||
|
|
||||||
|
'jumlah.required' => 'Jumlah ayam wajib diisi.',
|
||||||
|
'jumlah.integer' => 'Jumlah ayam harus berupa angka.',
|
||||||
|
'jumlah.min' => 'Jumlah ayam minimal 1 ekor.',
|
||||||
|
|
||||||
|
'tanggal.required' => 'Tanggal wajib diisi.',
|
||||||
|
'tanggal.date' => 'Format tanggal tidak valid.',
|
||||||
|
'tanggal.before_or_equal' => 'Tanggal tidak boleh melebihi hari ini.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::transaction(function () use ($request) {
|
||||||
|
|
||||||
|
// PINDAH
|
||||||
|
if ($request->jenis_mutasi === 'pindah') {
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'kandang_asal_id' => 'required|exists:kandang,id|different:kandang_tujuan_id',
|
||||||
|
'kandang_tujuan_id' => 'required|exists:kandang,id',
|
||||||
|
], [
|
||||||
|
'kandang_asal_id.required' => 'Kandang asal wajib dipilih.',
|
||||||
|
'kandang_asal_id.different' => 'Kandang asal dan tujuan tidak boleh sama.',
|
||||||
|
'kandang_tujuan_id.required' => 'Kandang tujuan wajib dipilih.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$kandangAsal = Kandang::findOrFail($request->kandang_asal_id);
|
||||||
|
$kandangTujuan = Kandang::findOrFail($request->kandang_tujuan_id);
|
||||||
|
|
||||||
|
$stokAsal = $kandangAsal->mutasiAyam()
|
||||||
|
->selectRaw("
|
||||||
|
COALESCE(SUM(
|
||||||
|
CASE
|
||||||
|
WHEN jenis_mutasi='masuk' THEN jumlah
|
||||||
|
WHEN jenis_mutasi IN ('mati','afkir','pindah') THEN -jumlah
|
||||||
|
ELSE 0 END
|
||||||
|
),0) as stok
|
||||||
|
")->value('stok');
|
||||||
|
|
||||||
|
if ($stokAsal <= 0) {
|
||||||
|
throw \Illuminate\Validation\ValidationException::withMessages([
|
||||||
|
'jumlah' => 'Stok kandang asal sudah habis.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->jumlah > $stokAsal) {
|
||||||
|
throw \Illuminate\Validation\ValidationException::withMessages([
|
||||||
|
'jumlah' => "Stok kandang asal hanya $stokAsal ekor."
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
MutasiAyam::create([
|
||||||
|
'kandang_id' => $request->kandang_asal_id,
|
||||||
|
'user_id' => Auth::id(),
|
||||||
|
'jenis_mutasi' => 'pindah',
|
||||||
|
'jumlah' => $request->jumlah,
|
||||||
|
'tanggal' => $request->tanggal,
|
||||||
|
'keterangan' => 'Pindah ke ' . $kandangTujuan->nama_kandang,
|
||||||
|
]);
|
||||||
|
|
||||||
|
MutasiAyam::create([
|
||||||
|
'kandang_id' => $request->kandang_tujuan_id,
|
||||||
|
'user_id' => Auth::id(),
|
||||||
|
'jenis_mutasi' => 'masuk',
|
||||||
|
'jumlah' => $request->jumlah,
|
||||||
|
'tanggal' => $request->tanggal,
|
||||||
|
'keterangan' => 'Pindahan dari ' . $kandangAsal->nama_kandang,
|
||||||
|
]);}
|
||||||
|
|
||||||
|
// MUTASI BIASA
|
||||||
|
else {
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'kandang_id' => 'required|exists:kandang,id',
|
||||||
|
], [
|
||||||
|
'kandang_id.required' => 'Nama kandang wajib dipilih.',
|
||||||
|
'kandang_id.exists' => 'Kandang tidak ditemukan.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$kandang = Kandang::findOrFail($request->kandang_id);
|
||||||
|
|
||||||
|
$stok = $kandang->mutasiAyam()->selectRaw("
|
||||||
|
COALESCE(SUM(
|
||||||
|
CASE
|
||||||
|
WHEN jenis_mutasi='masuk' THEN jumlah
|
||||||
|
WHEN jenis_mutasi IN ('mati','afkir','pindah') THEN -jumlah
|
||||||
|
ELSE 0 END
|
||||||
|
),0) as stok
|
||||||
|
")->value('stok');
|
||||||
|
|
||||||
|
// Kalau mutasi keluar/mati/afkir → cek stok
|
||||||
|
if (in_array($request->jenis_mutasi, ['mati', 'afkir'])) {
|
||||||
|
|
||||||
|
if ($stok <= 0) {
|
||||||
|
throw \Illuminate\Validation\ValidationException::withMessages([
|
||||||
|
'jumlah' => 'Stok ayam di kandang ini sudah habis.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->jumlah > $stok) {
|
||||||
|
throw \Illuminate\Validation\ValidationException::withMessages([
|
||||||
|
'jumlah' => "Stok hanya tersisa $stok ekor."
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MutasiAyam::create([
|
||||||
|
'kandang_id' => $request->kandang_id,
|
||||||
|
'user_id' => Auth::id(),
|
||||||
|
'jenis_mutasi' => $request->jenis_mutasi,
|
||||||
|
'jumlah' => $request->jumlah,
|
||||||
|
'tanggal' => $request->tanggal,
|
||||||
|
'keterangan' => $request->keterangan,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return redirect()->route('ayam')
|
||||||
|
->with('success', 'Data mutasi berhasil disimpan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$mutasi = MutasiAyam::findOrFail($id);
|
||||||
|
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if ($user->isKaryawan() && $mutasi->user_id !== $user->id) {
|
||||||
|
abort(403, 'Tidak diizinkan mengedit data ini.');
|
||||||
|
}
|
||||||
|
// VALIDASI MANUAL
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'kandang_id' => 'required|exists:kandang,id',
|
||||||
|
'jenis_mutasi' => 'required|in:masuk,mati,afkir',
|
||||||
|
'jumlah' => 'required|integer|min:1',
|
||||||
|
'tanggal' => 'required|date|before_or_equal:today',
|
||||||
|
], [
|
||||||
|
'kandang_id.required' => 'Nama kandang wajib dipilih.',
|
||||||
|
'kandang_id.exists' => 'Kandang tidak ditemukan.',
|
||||||
|
'jenis_mutasi.required' => 'Jenis mutasi wajib dipilih.',
|
||||||
|
'jenis_mutasi.in' => 'Jenis mutasi tidak valid.',
|
||||||
|
'jumlah.required' => 'Jumlah ayam wajib diisi.',
|
||||||
|
'jumlah.integer' => 'Jumlah ayam harus berupa angka.',
|
||||||
|
'jumlah.min' => 'Jumlah ayam minimal 1 ekor.',
|
||||||
|
'tanggal.required' => 'Tanggal wajib diisi.',
|
||||||
|
'tanggal.date' => 'Format tanggal tidak valid.',
|
||||||
|
'tanggal.before_or_equal' => 'Tanggal tidak boleh melebihi hari ini.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return back()
|
||||||
|
->withErrors($validator)
|
||||||
|
->withInput()
|
||||||
|
->with('edit_id', $mutasi->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// HITUNG STOK
|
||||||
|
$kandang = Kandang::findOrFail($request->kandang_id);
|
||||||
|
|
||||||
|
$stok = $kandang->mutasiAyam()
|
||||||
|
->where('id', '!=', $mutasi->id)
|
||||||
|
->selectRaw("
|
||||||
|
COALESCE(SUM(
|
||||||
|
CASE
|
||||||
|
WHEN jenis_mutasi='masuk' THEN jumlah
|
||||||
|
WHEN jenis_mutasi IN ('mati','afkir','pindah') THEN -jumlah
|
||||||
|
ELSE 0 END
|
||||||
|
),0) as stok
|
||||||
|
")->value('stok');
|
||||||
|
|
||||||
|
// kembalikan stok lama jika mutasi lama adalah pengurang
|
||||||
|
if (in_array($mutasi->jenis_mutasi, ['mati', 'afkir', 'pindah'])) {
|
||||||
|
$stok += $mutasi->jumlah;
|
||||||
|
}
|
||||||
|
// CEK STOK
|
||||||
|
if (in_array($request->jenis_mutasi, ['mati', 'afkir'])) {
|
||||||
|
|
||||||
|
if ($stok <= 0) {
|
||||||
|
throw \Illuminate\Validation\ValidationException::withMessages([
|
||||||
|
'jumlah' => 'Stok ayam di kandang ini sudah habis.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->jumlah > $stok) {
|
||||||
|
throw \Illuminate\Validation\ValidationException::withMessages([
|
||||||
|
'jumlah' => "Stok hanya tersisa $stok ekor."
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UPDATE DATA
|
||||||
|
$mutasi->update([
|
||||||
|
'kandang_id' => $request->kandang_id,
|
||||||
|
'jenis_mutasi' => $request->jenis_mutasi,
|
||||||
|
'jumlah' => $request->jumlah,
|
||||||
|
'tanggal' => $request->tanggal,
|
||||||
|
'keterangan' => $request->keterangan,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('ayam')
|
||||||
|
->with('success', 'Data berhasil diperbarui.');
|
||||||
|
}
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
abort(403, 'Karyawan tidak boleh menghapus data.');
|
||||||
|
}
|
||||||
|
|
||||||
|
MutasiAyam::findOrFail($id)->delete();
|
||||||
|
|
||||||
|
return redirect()->route('ayam')
|
||||||
|
->with('success', 'Data berhasil dihapus.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
abstract class Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\GajiKaryawan;
|
||||||
|
use App\Models\Karyawan;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class GajiController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$perPage = $request->perPage ?? 10;
|
||||||
|
|
||||||
|
$query = GajiKaryawan::with('karyawan');
|
||||||
|
|
||||||
|
// SEARCH GLOBAL
|
||||||
|
if ($request->search) {
|
||||||
|
|
||||||
|
$search = $request->search;
|
||||||
|
|
||||||
|
$query->where(function ($q) use ($search) {
|
||||||
|
|
||||||
|
// Cari nama karyawan
|
||||||
|
$q->whereHas('karyawan', function ($sub) use ($search) {
|
||||||
|
$sub->where('nama_karyawan', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
|
||||||
|
// Cari bulan
|
||||||
|
->orWhere('bulan', 'like', '%' . $search . '%')
|
||||||
|
// Cari tahun
|
||||||
|
->orWhere('tahun', 'like', '%' . $search . '%')
|
||||||
|
// Cari gaji
|
||||||
|
->orWhere('gaji_pokok', 'like', '%' . $search . '%')
|
||||||
|
// Cari tanggal bayar
|
||||||
|
->orWhere('tanggal_bayar', 'like', '%' . $search . '%');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FILTER BULAN
|
||||||
|
if ($request->bulan) {
|
||||||
|
$query->where('bulan', $request->bulan);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILTER TAHUN
|
||||||
|
if ($request->tahun) {
|
||||||
|
$query->where('tahun', $request->tahun);
|
||||||
|
}
|
||||||
|
|
||||||
|
$gaji = $query
|
||||||
|
->orderByDesc('id')
|
||||||
|
->paginate($perPage)
|
||||||
|
->withQueryString();
|
||||||
|
|
||||||
|
$karyawan = Karyawan::where('status_karyawan', 'aktif')
|
||||||
|
->orderBy('nama_karyawan')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('gaji', compact('gaji', 'karyawan', 'perPage'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
// Bersihkan format rupiah dulu sebelum validasi
|
||||||
|
$request->merge([
|
||||||
|
'gaji_pokok' => preg_replace('/[^0-9]/', '', $request->gaji_pokok)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Validasi
|
||||||
|
$request->validate(
|
||||||
|
[
|
||||||
|
'karyawan_id' => 'required|exists:karyawan,id',
|
||||||
|
'bulan' => 'required|integer|min:1|max:12',
|
||||||
|
'tahun' => 'required|integer|min:2000|max:' . date('Y'),
|
||||||
|
'gaji_pokok' => 'required|numeric|min:100000|max:9999999',
|
||||||
|
'tanggal_bayar' => 'required|date|before_or_equal:today'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'karyawan_id.required' => 'Karyawan wajib dipilih',
|
||||||
|
'karyawan_id.exists' => 'Karyawan tidak valid',
|
||||||
|
|
||||||
|
'bulan.required' => 'Bulan wajib dipilih',
|
||||||
|
'bulan.min' => 'Bulan tidak valid',
|
||||||
|
'bulan.max' => 'Bulan tidak valid',
|
||||||
|
|
||||||
|
'tahun.required' => 'Tahun wajib diisi',
|
||||||
|
'tahun.integer' => 'Tahun harus berupa angka',
|
||||||
|
'tahun.max' => 'Tahun tidak boleh melebihi tahun sekarang',
|
||||||
|
'tahun.min' => 'Tahun tidak valid',
|
||||||
|
|
||||||
|
'gaji_pokok.required' => 'Gaji pokok wajib diisi',
|
||||||
|
'gaji_pokok.numeric' => 'Gaji pokok harus berupa angka',
|
||||||
|
'gaji_pokok.max' => 'Gaji pokok maksimal Rp 9.999.999',
|
||||||
|
'gaji_pokok.min' => 'Gaji pokok minimal Rp 100.000',
|
||||||
|
|
||||||
|
'tanggal_bayar.required' => 'Tanggal pembayaran wajib diisi',
|
||||||
|
'tanggal_bayar.date' => 'Format tanggal tidak valid',
|
||||||
|
'tanggal_bayar.before_or_equal' => 'Tanggal pembayaran tidak boleh melebihi hari ini.',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Cegah gaji dobel
|
||||||
|
$cek = GajiKaryawan::where('karyawan_id', $request->karyawan_id)
|
||||||
|
->where('bulan', $request->bulan)
|
||||||
|
->where('tahun', $request->tahun)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($cek) {
|
||||||
|
return back()
|
||||||
|
->withErrors([
|
||||||
|
'bulan' => 'Gaji untuk bulan dan tahun ini sudah dicatat'
|
||||||
|
])
|
||||||
|
->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simpan
|
||||||
|
GajiKaryawan::create([
|
||||||
|
'karyawan_id' => $request->karyawan_id,
|
||||||
|
'bulan' => $request->bulan,
|
||||||
|
'tahun' => $request->tahun,
|
||||||
|
'gaji_pokok' => $request->gaji_pokok,
|
||||||
|
'tanggal_bayar' => $request->tanggal_bayar,
|
||||||
|
'status_bayar' => 'dibayar',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('gaji')
|
||||||
|
->with('success', 'Pembayaran gaji berhasil dicatat');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,183 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ProduksiTelur;
|
||||||
|
use App\Models\Kandang;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class HasilController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$query = ProduksiTelur::with('kandang')
|
||||||
|
->whereHas(
|
||||||
|
'kandang',
|
||||||
|
fn($q) =>
|
||||||
|
$q->where('jenis_kandang', 'Produksi')
|
||||||
|
);
|
||||||
|
|
||||||
|
/** @var User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
// FILTER ROLE
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
$query->where('user_id', $user->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// SEARCH GLOBAL
|
||||||
|
if ($request->search) {
|
||||||
|
|
||||||
|
$search = $request->search;
|
||||||
|
|
||||||
|
$query->where(function ($q) use ($search) {
|
||||||
|
|
||||||
|
$q->whereHas('kandang', function ($sub) use ($search) {
|
||||||
|
$sub->where('nama_kandang', 'like', '%' . $search . '%');
|
||||||
|
})
|
||||||
|
->orWhere('shift', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('tanggal_produksi', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('berat_telur_layak', 'like', '%' . $search . '%')
|
||||||
|
->orWhere('berat_telur_rusak', 'like', '%' . $search . '%')
|
||||||
|
->orWhereRaw("CAST(berat_telur_total AS CHAR) LIKE ?", ["%$search%"]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->kandang) {
|
||||||
|
$query->where('kandang_id', $request->kandang);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->bulan) {
|
||||||
|
$query->whereMonth('tanggal_produksi', $request->bulan);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->tahun) {
|
||||||
|
$query->whereYear('tanggal_produksi', $request->tahun);
|
||||||
|
}
|
||||||
|
$perPage = $request->perPage ?? 10;
|
||||||
|
|
||||||
|
|
||||||
|
$data = $query
|
||||||
|
->orderByDesc('tanggal_produksi')
|
||||||
|
->orderByDesc('created_at')
|
||||||
|
->paginate($perPage)
|
||||||
|
->withQueryString();
|
||||||
|
|
||||||
|
|
||||||
|
$kandang = Kandang::where('jenis_kandang', 'Produksi')->get();
|
||||||
|
$tahunList = ProduksiTelur::selectRaw('YEAR(tanggal_produksi) as tahun')
|
||||||
|
->distinct()
|
||||||
|
->orderBy('tahun', 'desc')
|
||||||
|
->pluck('tahun');
|
||||||
|
|
||||||
|
return view('produksi-hasil', compact('data', 'kandang', 'tahunList'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'kandang_id' => 'required|exists:kandang,id',
|
||||||
|
'shift' => 'required|in:pagi,sore',
|
||||||
|
'berat_telur_layak' => 'required|regex:/^\d{1,6}(\.\d{1,2})?$/',
|
||||||
|
'berat_telur_rusak' => 'required|regex:/^\d{1,6}(\.\d{1,2})?$/',
|
||||||
|
'tanggal_produksi' => [
|
||||||
|
'required',
|
||||||
|
'date_format:Y-m-d',
|
||||||
|
'after_or_equal:2000-01-01',
|
||||||
|
'before_or_equal:today',
|
||||||
|
],
|
||||||
|
], [
|
||||||
|
'kandang_id.required' => 'Kandang wajib dipilih.',
|
||||||
|
'shift.required' => 'Shift wajib dipilih.',
|
||||||
|
'berat_telur_layak.required' => 'Berat telur layak wajib diisi.',
|
||||||
|
'berat_telur_layak.regex' => 'Berat telur layak maksimal 6 digit dan hanya boleh angka desimal.',
|
||||||
|
'berat_telur_rusak.required' => 'Berat telur rusak wajib diisi.',
|
||||||
|
'berat_telur_rusak.regex' => 'Berat telur rusak maksimal 6 digit dan hanya boleh angka desimal.',
|
||||||
|
'tanggal_produksi.required' => 'Tanggal produksi wajib diisi.',
|
||||||
|
'tanggal_produksi.date_format' => 'Format tanggal harus YYYY-MM-DD.',
|
||||||
|
'tanggal_produksi.after_or_equal' => 'Tanggal terlalu lama dan tidak valid.',
|
||||||
|
'tanggal_produksi.before_or_equal' => 'Tanggal tidak boleh melebihi hari ini.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
$total = $request->berat_telur_layak + $request->berat_telur_rusak;
|
||||||
|
|
||||||
|
ProduksiTelur::create([
|
||||||
|
'kandang_id' => $request->kandang_id,
|
||||||
|
'user_id' => Auth::id(),
|
||||||
|
'shift' => $request->shift,
|
||||||
|
'berat_telur_layak' => $request->berat_telur_layak,
|
||||||
|
'berat_telur_rusak' => $request->berat_telur_rusak,
|
||||||
|
'berat_telur_total' => $total,
|
||||||
|
'tanggal_produksi' => $request->tanggal_produksi,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('hasil')
|
||||||
|
->with('success', 'Data produksi berhasil ditambahkan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'kandang_id' => 'required|exists:kandang,id',
|
||||||
|
'shift' => 'required|in:pagi,sore',
|
||||||
|
'berat_telur_layak' => 'required|regex:/^\d{1,6}(\.\d{1,2})?$/',
|
||||||
|
'berat_telur_rusak' => 'required|regex:/^\d{1,6}(\.\d{1,2})?$/',
|
||||||
|
'tanggal_produksi' => [
|
||||||
|
'required',
|
||||||
|
'date_format:Y-m-d',
|
||||||
|
'after_or_equal:2000-01-01',
|
||||||
|
'before_or_equal:today',
|
||||||
|
],
|
||||||
|
], [
|
||||||
|
'kandang_id.required' => 'Kandang wajib dipilih.',
|
||||||
|
'kandang_id.exists' => 'Kandang tidak ditemukan.',
|
||||||
|
'shift.required' => 'Shift wajib dipilih.',
|
||||||
|
'shift.in' => 'Shift harus pagi atau sore.',
|
||||||
|
'berat_telur_layak.required' => 'Berat telur layak wajib diisi.',
|
||||||
|
'berat_telur_layak.regex' => 'Berat telur layak maksimal 6 digit dan hanya boleh angka desimal.',
|
||||||
|
'berat_telur_rusak.required' => 'Berat telur rusak wajib diisi.',
|
||||||
|
'berat_telur_rusak.regex' => 'Berat telur rusak maksimal 6 digit dan hanya boleh angka desimal.',
|
||||||
|
'tanggal_produksi.required' => 'Tanggal produksi wajib diisi.',
|
||||||
|
'tanggal_produksi.date' => 'Tanggal produksi tidak valid.',
|
||||||
|
'tanggal_produksi.date_format' => 'Format tanggal harus YYYY-MM-DD.',
|
||||||
|
'tanggal_produksi.after_or_equal' => 'Tanggal terlalu lama dan tidak valid.',
|
||||||
|
'tanggal_produksi.before_or_equal' => 'Tanggal tidak boleh melebihi hari ini.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
$total = $request->berat_telur_layak + $request->berat_telur_rusak;
|
||||||
|
|
||||||
|
ProduksiTelur::findOrFail($id)->update([
|
||||||
|
'kandang_id' => $request->kandang_id,
|
||||||
|
'shift' => $request->shift,
|
||||||
|
'berat_telur_layak' => $request->berat_telur_layak,
|
||||||
|
'berat_telur_rusak' => $request->berat_telur_rusak,
|
||||||
|
'berat_telur_total' => $total,
|
||||||
|
'tanggal_produksi' => $request->tanggal_produksi,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('hasil')
|
||||||
|
->with('success', 'Data produksi berhasil diperbarui.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
/** @var User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
abort(403, 'Anda tidak memiliki izin menghapus data.');
|
||||||
|
}
|
||||||
|
|
||||||
|
ProduksiTelur::findOrFail($id)->delete();
|
||||||
|
|
||||||
|
return back()->with('success', 'Data produksi berhasil dihapus.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,165 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use App\Models\ProduksiTelur;
|
||||||
|
use App\Models\InventoriKandang;
|
||||||
|
use App\Models\Penjualan;
|
||||||
|
use App\Models\MutasiAyam;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
|
||||||
|
class HomeController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
$today = Carbon::today();
|
||||||
|
|
||||||
|
/* STAT UMUM */
|
||||||
|
|
||||||
|
$jumlahMasuk = MutasiAyam::where('jenis_mutasi', 'masuk')->sum('jumlah');
|
||||||
|
$jumlahKeluar = MutasiAyam::whereIn('jenis_mutasi', ['keluar', 'mati', 'afkir', 'pindah'])->sum('jumlah');
|
||||||
|
$jumlahAyam = $jumlahMasuk - $jumlahKeluar;
|
||||||
|
|
||||||
|
$produksiHariIni = ProduksiTelur::whereDate('tanggal_produksi', $today)
|
||||||
|
->sum(DB::raw('berat_telur_layak + berat_telur_rusak'));
|
||||||
|
|
||||||
|
// total stok pakan global (yang lama)
|
||||||
|
$stokPakan = InventoriKandang::where('jenis_transaksi', 'masuk')->sum('jumlah')
|
||||||
|
- InventoriKandang::where('jenis_transaksi', 'keluar')->sum('jumlah');
|
||||||
|
|
||||||
|
// stok per barang + deteksi stok menipis
|
||||||
|
$stok = InventoriKandang::selectRaw("
|
||||||
|
nama_barang,
|
||||||
|
SUM(CASE WHEN jenis_transaksi = 'masuk' THEN jumlah ELSE 0 END)
|
||||||
|
-
|
||||||
|
SUM(CASE WHEN jenis_transaksi = 'keluar' THEN jumlah ELSE 0 END)
|
||||||
|
AS stok
|
||||||
|
")
|
||||||
|
->groupBy('nama_barang')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$batasMinimum = [
|
||||||
|
'Jagung' => 5,
|
||||||
|
'Katul' => 5,
|
||||||
|
'Konsentrat' => 5,
|
||||||
|
'Pakan Layer' => 5,
|
||||||
|
'Pakan Starter' => 5,
|
||||||
|
];
|
||||||
|
|
||||||
|
$stokMenipis = $stok->filter(function ($item) use ($batasMinimum) {
|
||||||
|
$min = $batasMinimum[$item->nama_barang] ?? 5;
|
||||||
|
return $item->stok <= $min;
|
||||||
|
});
|
||||||
|
// untuk Admin & Karyawan
|
||||||
|
$pendapatanHariIni = Penjualan::whereDate('tanggal_penjualan', $today)
|
||||||
|
->sum('total_penjualan');
|
||||||
|
$bulan = request('bulan', now()->month);
|
||||||
|
$minggu = request('minggu', ceil(now()->day / 7));
|
||||||
|
$tahun = request('tahun', now()->year);
|
||||||
|
|
||||||
|
$query = ProduksiTelur::select(
|
||||||
|
DB::raw('DATE(tanggal_produksi) as tanggal'),
|
||||||
|
DB::raw('SUM(berat_telur_layak + berat_telur_rusak) as total')
|
||||||
|
)
|
||||||
|
->whereYear('tanggal_produksi', $tahun)
|
||||||
|
->whereMonth('tanggal_produksi', $bulan);
|
||||||
|
|
||||||
|
if ($minggu) {
|
||||||
|
$query->whereRaw('CEIL(DAY(tanggal_produksi) / 7) = ?', [$minggu]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$produksiMingguan = $query
|
||||||
|
->groupBy('tanggal')
|
||||||
|
->orderBy('tanggal')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$chartProduksiLabels = $produksiMingguan->pluck('tanggal')
|
||||||
|
->map(fn($tgl) => Carbon::parse($tgl)->format('d M'));
|
||||||
|
|
||||||
|
$chartProduksiData = $produksiMingguan->pluck('total');
|
||||||
|
|
||||||
|
|
||||||
|
/* CHART KEUANGAN (ADMIN ONLY)*/
|
||||||
|
if ($user->isAdmin()) {
|
||||||
|
|
||||||
|
$finance = DB::table('penjualan')
|
||||||
|
->selectRaw('
|
||||||
|
CEIL(DAY(tanggal_penjualan)/7) as minggu,
|
||||||
|
SUM(total_penjualan) as pemasukan
|
||||||
|
')
|
||||||
|
->whereYear('tanggal_penjualan', $tahun)
|
||||||
|
->whereMonth('tanggal_penjualan', $bulan)
|
||||||
|
->groupBy('minggu')
|
||||||
|
->orderBy('minggu')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
|
||||||
|
/* PENGELUARAN INVENTORI */
|
||||||
|
$pengeluaranInventori = DB::table('inventori_kandang')
|
||||||
|
->selectRaw('
|
||||||
|
CEIL(DAY(created_at)/7) as minggu,
|
||||||
|
SUM(total_harga) as total
|
||||||
|
')
|
||||||
|
->whereYear('created_at', $tahun)
|
||||||
|
->whereMonth('created_at', $bulan)
|
||||||
|
->where('jenis_transaksi', 'masuk')
|
||||||
|
->groupBy('minggu')
|
||||||
|
->pluck('total', 'minggu');
|
||||||
|
|
||||||
|
|
||||||
|
/* GAJI KARYAWAN (dibagi rata per minggu) */
|
||||||
|
$gajiBulanan = DB::table('gaji_karyawan')
|
||||||
|
->where('tahun', $tahun)
|
||||||
|
->where('bulan', $bulan)
|
||||||
|
->sum('gaji_pokok');
|
||||||
|
|
||||||
|
$gajiMingguan = $gajiBulanan / 4;
|
||||||
|
|
||||||
|
|
||||||
|
$chartFinanceLabels = [];
|
||||||
|
$chartFinancePemasukan = [];
|
||||||
|
$chartFinancePengeluaran = [];
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($finance as $row) {
|
||||||
|
|
||||||
|
$minggu = $row->minggu;
|
||||||
|
|
||||||
|
$chartFinanceLabels[] = 'Minggu ' . $minggu;
|
||||||
|
|
||||||
|
$chartFinancePemasukan[] = $row->pemasukan;
|
||||||
|
|
||||||
|
$pengeluaranInventoriMinggu = $pengeluaranInventori[$minggu] ?? 0;
|
||||||
|
|
||||||
|
$chartFinancePengeluaran[] =
|
||||||
|
$pengeluaranInventoriMinggu + $gajiMingguan;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$chartFinanceLabels = [];
|
||||||
|
$chartFinancePemasukan = [];
|
||||||
|
$chartFinancePengeluaran = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return view('home', compact(
|
||||||
|
'jumlahAyam',
|
||||||
|
'produksiHariIni',
|
||||||
|
'stokPakan',
|
||||||
|
'stokMenipis',
|
||||||
|
|
||||||
|
'pendapatanHariIni',
|
||||||
|
'chartProduksiLabels',
|
||||||
|
'chartProduksiData',
|
||||||
|
'chartFinanceLabels',
|
||||||
|
'chartFinancePemasukan',
|
||||||
|
'chartFinancePengeluaran'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,184 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Karyawan;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class KaryawanController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$query = Karyawan::with('user');
|
||||||
|
|
||||||
|
// SEARCH NAMA / HP / ALAMAT
|
||||||
|
if ($request->search) {
|
||||||
|
$query->where(function ($q) use ($request) {
|
||||||
|
$q->where('nama_karyawan', 'like', '%' . $request->search . '%')
|
||||||
|
->orWhere('no_hp', 'like', '%' . $request->search . '%')
|
||||||
|
->orWhere('alamat', 'like', '%' . $request->search . '%'); // ✅ TAMBAHAN
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILTER STATUS
|
||||||
|
if ($request->status) {
|
||||||
|
$query->where('status_karyawan', $request->status);
|
||||||
|
}
|
||||||
|
|
||||||
|
$perPage = in_array($request->perPage, [10, 25, 50]) ? $request->perPage : 10;
|
||||||
|
|
||||||
|
$data = $query
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->paginate($perPage)
|
||||||
|
->withQueryString();
|
||||||
|
|
||||||
|
return view('karyawan', compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate(
|
||||||
|
[
|
||||||
|
'nama_karyawan' => 'required|string|min:3|max:100',
|
||||||
|
'no_hp' => ['required', 'regex:/^08[0-9]{8,11}$/'],
|
||||||
|
'alamat' => 'required|string|max:255',
|
||||||
|
'status_karyawan' => 'required|in:aktif,nonaktif',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nama_karyawan.required' => 'Nama karyawan wajib diisi',
|
||||||
|
'nama_karyawan.string' => 'Nama karyawan harus berupa teks',
|
||||||
|
'nama_karyawan.min' => 'Nama karyawan minimal 3 karakter',
|
||||||
|
'nama_karyawan.max' => 'Nama karyawan maksimal 100 karakter',
|
||||||
|
|
||||||
|
'no_hp.required' => 'Nomor HP wajib diisi',
|
||||||
|
'no_hp.regex' => 'Nomor HP harus 10–13 digit, diawali 08, dan hanya angka.',
|
||||||
|
|
||||||
|
'alamat.required' => 'Alamat wajib diisi',
|
||||||
|
'alamat.string' => 'Alamat harus berupa teks',
|
||||||
|
'alamat.max' => 'Alamat maksimal 255 karakter',
|
||||||
|
|
||||||
|
'status_karyawan.required' => 'Status karyawan wajib dipilih',
|
||||||
|
'status_karyawan.in' => 'Status karyawan tidak valid',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$userId = null;
|
||||||
|
|
||||||
|
if ($request->has_login) {
|
||||||
|
$request->validate(
|
||||||
|
[
|
||||||
|
'email' => 'required|email|unique:users,email',
|
||||||
|
'password' => 'required|string|min:6|max:20',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'email.required' => 'Email wajib diisi',
|
||||||
|
'email.email' => 'Format email tidak valid',
|
||||||
|
'email.unique' => 'Email sudah terdaftar',
|
||||||
|
|
||||||
|
'password.required' => 'Password wajib diisi',
|
||||||
|
'password.string' => 'Password harus berupa teks',
|
||||||
|
'password.min' => 'Password minimal 6 karakter',
|
||||||
|
'password.max' => 'Password maksimal 20 karakter',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $request->nama_karyawan,
|
||||||
|
'email' => $request->email,
|
||||||
|
'no_hp' => $request->no_hp,
|
||||||
|
'alamat' => $request->alamat,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
'is_active' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$userId = $user->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
Karyawan::create([
|
||||||
|
'user_id' => $userId,
|
||||||
|
'nama_karyawan' => $request->nama_karyawan,
|
||||||
|
'no_hp' => $request->no_hp,
|
||||||
|
'alamat' => $request->alamat,
|
||||||
|
'status_karyawan' => $request->status_karyawan,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('karyawan')
|
||||||
|
->with('success', 'Karyawan berhasil ditambahkan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$request->validate(
|
||||||
|
[
|
||||||
|
'nama_karyawan' => 'required|string|min:3|max:100',
|
||||||
|
'no_hp' => ['required', 'regex:/^08[0-9]{8,11}$/'],
|
||||||
|
'alamat' => 'required|string|max:255',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'nama_karyawan.required' => 'Nama karyawan wajib diisi',
|
||||||
|
'nama_karyawan.string' => 'Nama karyawan harus berupa teks',
|
||||||
|
'nama_karyawan.min' => 'Nama karyawan minimal 3 karakter',
|
||||||
|
'nama_karyawan.max' => 'Nama karyawan maksimal 100 karakter',
|
||||||
|
|
||||||
|
'no_hp.required' => 'Nomor HP wajib diisi',
|
||||||
|
'no_hp.regex' => 'Nomor HP harus 10–13 digit, diawali 08, dan hanya angka.',
|
||||||
|
|
||||||
|
'alamat.required' => 'Alamat wajib diisi',
|
||||||
|
'alamat.string' => 'Alamat harus berupa teks',
|
||||||
|
'alamat.max' => 'Alamat maksimal 255 karakter',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$karyawan = Karyawan::findOrFail($id);
|
||||||
|
|
||||||
|
$karyawan->update([
|
||||||
|
'nama_karyawan' => $request->nama_karyawan,
|
||||||
|
'no_hp' => $request->no_hp,
|
||||||
|
'alamat' => $request->alamat,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('karyawan')
|
||||||
|
->with('success', 'Data karyawan berhasil diperbarui');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function nonaktifkan($id)
|
||||||
|
{
|
||||||
|
$karyawan = Karyawan::with('user')->findOrFail($id);
|
||||||
|
|
||||||
|
$karyawan->update([
|
||||||
|
'status_karyawan' => 'nonaktif'
|
||||||
|
]);
|
||||||
|
|
||||||
|
// OPTIONAL: kalau punya akun, sekalian matikan akses login
|
||||||
|
if ($karyawan->user) {
|
||||||
|
$karyawan->user->update([
|
||||||
|
'is_active' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('karyawan')
|
||||||
|
->with('success', 'Karyawan berhasil dinonaktifkan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function aktifkan($id)
|
||||||
|
{
|
||||||
|
$karyawan = Karyawan::with('user')->findOrFail($id);
|
||||||
|
|
||||||
|
$karyawan->update([
|
||||||
|
'status_karyawan' => 'aktif'
|
||||||
|
]);
|
||||||
|
|
||||||
|
// OPTIONAL
|
||||||
|
if ($karyawan->user) {
|
||||||
|
$karyawan->user->update([
|
||||||
|
'is_active' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route('karyawan')
|
||||||
|
->with('success', 'Karyawan berhasil diaktifkan kembali');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,154 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Penjualan;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
|
||||||
|
class KeuanganController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
// $query = Penjualan::orderBy('tanggal_penjualan', 'desc');
|
||||||
|
$query = Penjualan::orderByDesc('tanggal_penjualan')
|
||||||
|
->orderByDesc('created_at');
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
$query->where('user_id', $user->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILTER PRODUK AKTIF
|
||||||
|
if ($request->produk) {
|
||||||
|
$query->where('jenis_produk', $request->produk);
|
||||||
|
}
|
||||||
|
|
||||||
|
// SEARCH GLOBAL
|
||||||
|
if ($request->search) {
|
||||||
|
|
||||||
|
$s = $request->search;
|
||||||
|
|
||||||
|
$query->where(function ($q) use ($s) {
|
||||||
|
|
||||||
|
// cari jenis produk (telur / afkir)
|
||||||
|
$q->where('jenis_produk', 'like', "%$s%")
|
||||||
|
->orWhere('berat_terjual', 'like', "%$s%")
|
||||||
|
->orWhere('harga_satuan', 'like', "%$s%")
|
||||||
|
->orWhere('total_penjualan', 'like', "%$s%")
|
||||||
|
->orWhere('tanggal_penjualan', 'like', "%$s%")
|
||||||
|
->orWhereRaw("DATE_FORMAT(tanggal_penjualan, '%Y-%m-%d') like ?", ["%$s%"]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($request->bulan) {
|
||||||
|
$query->whereMonth('tanggal_penjualan', $request->bulan);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->tahun) {
|
||||||
|
$query->whereYear('tanggal_penjualan', $request->tahun);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('produksi-keuangan', [
|
||||||
|
'penjualans' => $query->paginate($request->perPage ?? 10)->withQueryString(),
|
||||||
|
'produks' => [
|
||||||
|
'telur' => 'Telur Ayam',
|
||||||
|
'afkir' => 'Ayam Afkir',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$request->validate(
|
||||||
|
[
|
||||||
|
'tanggal' => 'required|date|before_or_equal:today',
|
||||||
|
'jenis_produk' => 'required|in:telur,afkir',
|
||||||
|
'jumlah' => 'required|numeric|min:0.1|max:9999',
|
||||||
|
'harga_satuan' => 'required|numeric|min:1|max:99999999',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tanggal.required' => 'Tanggal penjualan wajib diisi.',
|
||||||
|
'tanggal.date' => 'Tanggal penjualan tidak valid.',
|
||||||
|
'jenis_produk.required' => 'Jenis produk wajib diisi.',
|
||||||
|
'jumlah.required' => 'Jumlah penjualan wajib diisi.',
|
||||||
|
'jumlah.numeric' => 'Jumlah harus berupa angka.',
|
||||||
|
'jumlah.min' => 'Jumlah minimal 0,1 Kg.',
|
||||||
|
'harga_satuan.required' => 'Harga satuan wajib diisi.',
|
||||||
|
'harga_satuan.numeric' => 'Harga satuan harus berupa angka.',
|
||||||
|
'harga_satuan.min' => 'Harga satuan minimal Rp 1.',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Penjualan::create([
|
||||||
|
'user_id' => Auth::id(),
|
||||||
|
'jenis_produk' => $request->jenis_produk,
|
||||||
|
'berat_terjual' => $request->jumlah,
|
||||||
|
'harga_satuan' => $request->harga_satuan,
|
||||||
|
'total_penjualan' => $request->jumlah * $request->harga_satuan,
|
||||||
|
'tanggal_penjualan' => $request->tanggal,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return back()->with('success', 'Penjualan berhasil ditambahkan.');
|
||||||
|
}
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$penjualan = Penjualan::findOrFail($id);
|
||||||
|
|
||||||
|
$validated = $request->validate(
|
||||||
|
[
|
||||||
|
'tanggal' => 'required|date|before_or_equal:today',
|
||||||
|
'jenis_produk' => 'required|in:telur,afkir',
|
||||||
|
'jumlah' => 'required|numeric|min:0.1',
|
||||||
|
'harga_satuan' => 'required|numeric|min:1',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tanggal.required' => 'Tanggal penjualan wajib diisi.',
|
||||||
|
'tanggal.date' => 'Tanggal penjualan tidak valid.',
|
||||||
|
'jenis_produk.required' => 'Jenis produk wajib diisi.',
|
||||||
|
'jumlah.required' => 'Jumlah penjualan wajib diisi.',
|
||||||
|
'jumlah.numeric' => 'Jumlah harus berupa angka.',
|
||||||
|
'jumlah.min' => 'Jumlah minimal 0,1 Kg.',
|
||||||
|
'harga_satuan.required' => 'Harga satuan wajib diisi.',
|
||||||
|
'harga_satuan.numeric' => 'Harga satuan harus berupa angka.',
|
||||||
|
'harga_satuan.min' => 'Harga satuan minimal Rp 1.',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$penjualan->update([
|
||||||
|
'berat_terjual' => $validated['jumlah'],
|
||||||
|
'jenis_produk' => $validated['jenis_produk'],
|
||||||
|
'harga_satuan' => $validated['harga_satuan'],
|
||||||
|
'total_penjualan' => $validated['jumlah'] * $validated['harga_satuan'],
|
||||||
|
'tanggal_penjualan' => $validated['tanggal'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->back()->with('success', 'Penjualan berhasil diupdate.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
Penjualan::findOrFail($id)->delete();
|
||||||
|
|
||||||
|
return back()->with('success', 'Penjualan berhasil dihapus');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use App\Services\LaporanExportService;
|
||||||
|
|
||||||
|
|
||||||
|
class LaporanController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$tahun = $request->get('tahun', now()->year);
|
||||||
|
|
||||||
|
return view('laporan', [
|
||||||
|
'tahun' => $tahun,
|
||||||
|
'produksi' => $this->laporanProduksi($tahun),
|
||||||
|
'inventori' => $this->laporanInventori($tahun),
|
||||||
|
'keuangan' => $this->laporanKeuangan($tahun),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function laporanProduksi(int $tahun)
|
||||||
|
{
|
||||||
|
return DB::table('produksi_telur')
|
||||||
|
->selectRaw('
|
||||||
|
MONTH(tanggal_produksi) AS bulan,
|
||||||
|
CEIL(DAY(tanggal_produksi) / 7) AS minggu,
|
||||||
|
SUM(berat_telur_total) AS total_produksi
|
||||||
|
')
|
||||||
|
->whereYear('tanggal_produksi', $tahun)
|
||||||
|
->groupBy('bulan', 'minggu')
|
||||||
|
->orderBy('bulan')
|
||||||
|
->orderBy('minggu')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function laporanInventori(int $tahun)
|
||||||
|
{
|
||||||
|
return DB::table('inventori_kandang')
|
||||||
|
->selectRaw('
|
||||||
|
MONTH(created_at) AS bulan,
|
||||||
|
CEIL(DAY(created_at) / 7) AS minggu,
|
||||||
|
SUM(CASE WHEN jenis_transaksi = "masuk" THEN jumlah ELSE 0 END) AS masuk,
|
||||||
|
SUM(CASE WHEN jenis_transaksi = "keluar" THEN jumlah ELSE 0 END) AS keluar
|
||||||
|
')
|
||||||
|
->whereYear('created_at', $tahun)
|
||||||
|
->groupBy('bulan', 'minggu')
|
||||||
|
->orderBy('bulan')
|
||||||
|
->orderBy('minggu')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LAPORAN KEUANGAN (BULANAN)
|
||||||
|
*/
|
||||||
|
private function laporanKeuangan(int $tahun)
|
||||||
|
{
|
||||||
|
// PEMASUKAN (PENJUALAN)
|
||||||
|
// sumber: tabel penjualan
|
||||||
|
$pemasukan = DB::table('penjualan')
|
||||||
|
->selectRaw('
|
||||||
|
MONTH(tanggal_penjualan) AS bulan,
|
||||||
|
SUM(total_penjualan) AS total
|
||||||
|
')
|
||||||
|
->whereYear('tanggal_penjualan', $tahun)
|
||||||
|
->groupBy('bulan')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// PENGELUARAN INVENTORI
|
||||||
|
$pengeluaranInventori = DB::table('inventori_kandang')
|
||||||
|
->selectRaw('
|
||||||
|
MONTH(created_at) AS bulan,
|
||||||
|
SUM(total_harga) AS total
|
||||||
|
')
|
||||||
|
->whereYear('created_at', $tahun)
|
||||||
|
->where('jenis_transaksi', 'masuk')
|
||||||
|
->groupBy('bulan')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// GAJI KARYAWAN
|
||||||
|
$gaji = DB::table('gaji_karyawan')
|
||||||
|
->selectRaw('bulan, SUM(gaji_pokok) AS total')
|
||||||
|
->where('tahun', $tahun)
|
||||||
|
->groupBy('bulan')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'pemasukan' => $pemasukan,
|
||||||
|
'inventori' => $pengeluaranInventori,
|
||||||
|
'gaji' => $gaji,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function export(Request $request)
|
||||||
|
{
|
||||||
|
$tahun = $request->get('tahun', now()->year);
|
||||||
|
return app(LaporanExportService::class)->export($tahun);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
// TIDAK DIPAKAI
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||||
|
|
||||||
|
// contoh model, sesuaikan
|
||||||
|
use App\Models\ProduksiTelur;
|
||||||
|
|
||||||
|
class LaporanExportController extends Controller
|
||||||
|
{
|
||||||
|
public function export(Request $request)
|
||||||
|
{
|
||||||
|
$bulan = $request->bulan;
|
||||||
|
$tahun = $request->tahun;
|
||||||
|
|
||||||
|
// ambil data (contoh)
|
||||||
|
$data = ProduksiTelur::whereYear('tanggal', $tahun)
|
||||||
|
->whereMonth('tanggal', $bulan)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
// HEADER
|
||||||
|
$sheet->setCellValue('A1', 'Tanggal');
|
||||||
|
$sheet->setCellValue('B1', 'Kandang');
|
||||||
|
$sheet->setCellValue('C1', 'Jumlah Telur');
|
||||||
|
|
||||||
|
$row = 2;
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$sheet->setCellValue('A' . $row, $item->tanggal);
|
||||||
|
$sheet->setCellValue('B' . $row, $item->kandang->nama ?? '-');
|
||||||
|
$sheet->setCellValue('C' . $row, $item->jumlah);
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = "laporan-{$bulan}-{$tahun}.xlsx";
|
||||||
|
|
||||||
|
return new StreamedResponse(function () use ($spreadsheet) {
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save('php://output');
|
||||||
|
}, 200, [
|
||||||
|
"Content-Type" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
|
"Content-Disposition" => "attachment; filename=\"$filename\"",
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,308 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\InventoriKandang;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class PakanController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$query = InventoriKandang::query();
|
||||||
|
|
||||||
|
/** @var User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
// FILTER ROLE
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
$query->where('user_id', $user->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SEARCH */
|
||||||
|
if ($request->search) {
|
||||||
|
$s = $request->search;
|
||||||
|
$query->where(function ($q) use ($s) {
|
||||||
|
$q->where('nama_barang', 'like', "%$s%")
|
||||||
|
->orWhere('jenis_transaksi', 'like', "%$s%")
|
||||||
|
->orWhereRaw("CAST(jumlah AS CHAR) LIKE ?", ["%$s%"]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FILTER */
|
||||||
|
if ($request->jenis) {
|
||||||
|
$query->where('jenis_transaksi', $request->jenis);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->bulan) {
|
||||||
|
$query->whereMonth('tanggal', $request->bulan);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->tahun) {
|
||||||
|
$query->whereYear('tanggal', $request->tahun);
|
||||||
|
}
|
||||||
|
|
||||||
|
$perPage = $request->perPage ?? 10;
|
||||||
|
|
||||||
|
// DATA TABEL
|
||||||
|
$data = $query
|
||||||
|
->orderBy('tanggal', 'desc')
|
||||||
|
->orderBy('id', 'desc')
|
||||||
|
->paginate($perPage)
|
||||||
|
->withQueryString();
|
||||||
|
|
||||||
|
// HITUNG STOK (GLOBAL)
|
||||||
|
$stok = InventoriKandang::selectRaw("
|
||||||
|
nama_barang,
|
||||||
|
SUM(CASE WHEN jenis_transaksi = 'masuk' THEN jumlah ELSE 0 END)
|
||||||
|
-
|
||||||
|
SUM(CASE WHEN jenis_transaksi = 'keluar' THEN jumlah ELSE 0 END)
|
||||||
|
AS stok
|
||||||
|
")
|
||||||
|
->groupBy('nama_barang')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// BATAS MINIMUM
|
||||||
|
$batasMinimum = [
|
||||||
|
'Jagung' => 5,
|
||||||
|
'Katul' => 5,
|
||||||
|
'Konsentrat' => 5,
|
||||||
|
'Pakan Layer' => 5,
|
||||||
|
'Pakan Starter' => 5,
|
||||||
|
];
|
||||||
|
|
||||||
|
$stokMenipis = $stok->filter(function ($item) use ($batasMinimum) {
|
||||||
|
$min = $batasMinimum[$item->nama_barang] ?? 5;
|
||||||
|
return $item->stok <= $min;
|
||||||
|
});
|
||||||
|
|
||||||
|
return view('inventori-pakan', compact('data', 'stokMenipis'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
/** @var User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
$request->merge([
|
||||||
|
'harga_satuan' => str_replace('.', '', $request->harga_satuan)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// karyawan TIDAK BOLEH input barang masuk
|
||||||
|
if ($user->isKaryawan() && $request->jenis_transaksi === 'masuk') {
|
||||||
|
abort(403, 'Karyawan tidak diizinkan mencatat barang masuk.');
|
||||||
|
}
|
||||||
|
$namaBarang = ucfirst(strtolower(trim($request->nama_barang)));
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'tanggal' => 'required|date|before_or_equal:today',
|
||||||
|
'nama_barang' => 'required|string|max:100',
|
||||||
|
'jenis_transaksi' => 'required|in:masuk,keluar',
|
||||||
|
'jumlah' => 'required|numeric|min:1|max:999999',
|
||||||
|
// 'satuan' => 'required|string|max:50|in:karung',
|
||||||
|
'harga_satuan' => $request->jenis_transaksi === 'masuk'
|
||||||
|
? 'required|numeric|min:1|max:999999999'
|
||||||
|
: 'nullable',
|
||||||
|
], [
|
||||||
|
'tanggal.required' => 'Tanggal wajib diisi.',
|
||||||
|
'tanggal.date' => 'Format tanggal tidak valid.',
|
||||||
|
|
||||||
|
'nama_barang.required' => 'Nama barang wajib diisi.',
|
||||||
|
'nama_barang.string' => 'Nama barang harus berupa teks.',
|
||||||
|
'nama_barang.max' => 'Nama barang maksimal 100 karakter.',
|
||||||
|
|
||||||
|
'jenis_transaksi.required' => 'Jenis transaksi wajib dipilih.',
|
||||||
|
'jenis_transaksi.in' => 'Jenis transaksi tidak valid.',
|
||||||
|
|
||||||
|
'jumlah.required' => 'Jumlah wajib diisi.',
|
||||||
|
'jumlah.numeric' => 'Jumlah harus berupa angka.',
|
||||||
|
'jumlah.min' => 'Jumlah minimal 1.',
|
||||||
|
'jumlah.max' => 'Jumlah terlalu besar.',
|
||||||
|
|
||||||
|
// 'satuan.required' => 'Satuan wajib diisi.',
|
||||||
|
// 'satuan.string' => 'Satuan harus berupa teks.',
|
||||||
|
// 'satuan.max' => 'Satuan maksimal 50 karakter.',
|
||||||
|
|
||||||
|
'harga_satuan.required' => 'Harga satuan wajib diisi untuk transaksi masuk.',
|
||||||
|
'harga_satuan.numeric' => 'Harga satuan harus berupa angka.',
|
||||||
|
'harga_satuan.min' => 'Harga satuan minimal 1.',
|
||||||
|
'harga_satuan.max' => 'Harga satuan terlalu besar.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
$total = null;
|
||||||
|
|
||||||
|
if ($request->jenis_transaksi === 'masuk') {
|
||||||
|
$total = $request->jumlah * $request->harga_satuan;
|
||||||
|
}
|
||||||
|
// CEK STOK JIKA BARANG KELUAR
|
||||||
|
if ($request->jenis_transaksi === 'keluar') {
|
||||||
|
|
||||||
|
$stokSekarang = InventoriKandang::where('nama_barang', $namaBarang)
|
||||||
|
->selectRaw("
|
||||||
|
SUM(CASE WHEN jenis_transaksi = 'masuk' THEN jumlah ELSE 0 END)
|
||||||
|
-
|
||||||
|
SUM(CASE WHEN jenis_transaksi = 'keluar' THEN jumlah ELSE 0 END)
|
||||||
|
AS stok
|
||||||
|
")
|
||||||
|
->value('stok') ?? 0;
|
||||||
|
|
||||||
|
if ($request->jumlah > $stokSekarang) {
|
||||||
|
return back()->withErrors([
|
||||||
|
'jumlah' => 'Stok ' . $namaBarang . ' tidak mencukupi. Sisa stok: ' . $stokSekarang
|
||||||
|
])->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InventoriKandang::create([
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'tanggal' => $request->tanggal,
|
||||||
|
'nama_barang' => $namaBarang,
|
||||||
|
'jenis_transaksi' => $request->jenis_transaksi,
|
||||||
|
'jumlah' => $request->jumlah,
|
||||||
|
'satuan' => 'karung',
|
||||||
|
'harga_satuan' => $request->jenis_transaksi === 'masuk' ? $request->harga_satuan : null,
|
||||||
|
'total_harga' => $total,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('pakan')->with('success', 'Transaksi berhasil disimpan');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
/** @var User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
$request->merge([
|
||||||
|
'harga_satuan' => str_replace('.', '', $request->harga_satuan)
|
||||||
|
]);
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
abort(403, 'Anda tidak memiliki izin mengedit data.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$namaBarang = ucfirst(strtolower(trim($request->nama_barang)));
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'tanggal' => 'required|date|before_or_equal:today',
|
||||||
|
'nama_barang' => 'required|string|max:100',
|
||||||
|
'jenis_transaksi' => 'required|in:masuk,keluar',
|
||||||
|
'jumlah' => 'required|numeric|min:1|max:999999',
|
||||||
|
// 'satuan' => 'required|string|max:50|in:karung',
|
||||||
|
'harga_satuan' => $request->jenis_transaksi === 'masuk'
|
||||||
|
? 'required|numeric|min:1|max:999999999'
|
||||||
|
: 'nullable',
|
||||||
|
], [
|
||||||
|
'tanggal.required' => 'Tanggal wajib diisi.',
|
||||||
|
'tanggal.date' => 'Format tanggal tidak valid.',
|
||||||
|
|
||||||
|
'nama_barang.required' => 'Nama barang wajib diisi.',
|
||||||
|
'nama_barang.string' => 'Nama barang harus berupa teks.',
|
||||||
|
'nama_barang.max' => 'Nama barang maksimal 100 karakter.',
|
||||||
|
|
||||||
|
'jenis_transaksi.required' => 'Jenis transaksi wajib dipilih.',
|
||||||
|
'jenis_transaksi.in' => 'Jenis transaksi tidak valid.',
|
||||||
|
|
||||||
|
'jumlah.required' => 'Jumlah wajib diisi.',
|
||||||
|
'jumlah.numeric' => 'Jumlah harus berupa angka.',
|
||||||
|
'jumlah.min' => 'Jumlah minimal 1.',
|
||||||
|
'jumlah.max' => 'Jumlah terlalu besar.',
|
||||||
|
|
||||||
|
// 'satuan.required' => 'Satuan wajib diisi.',
|
||||||
|
// 'satuan.string' => 'Satuan harus berupa teks.',
|
||||||
|
// 'satuan.max' => 'Satuan maksimal 50 karakter.',
|
||||||
|
|
||||||
|
'harga_satuan.required' => 'Harga satuan wajib diisi untuk transaksi masuk.',
|
||||||
|
'harga_satuan.numeric' => 'Harga satuan harus berupa angka.',
|
||||||
|
'harga_satuan.min' => 'Harga satuan minimal 1.',
|
||||||
|
'harga_satuan.max' => 'Harga satuan terlalu besar.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$item = InventoriKandang::findOrFail($id);
|
||||||
|
|
||||||
|
$total = null;
|
||||||
|
|
||||||
|
if ($request->jenis_transaksi === 'masuk') {
|
||||||
|
$total = $request->jumlah * $request->harga_satuan;
|
||||||
|
}
|
||||||
|
|
||||||
|
// CEK STOK JIKA KELUAR
|
||||||
|
if ($request->jenis_transaksi === 'keluar') {
|
||||||
|
|
||||||
|
$stokSekarang = InventoriKandang::where('nama_barang', $namaBarang)
|
||||||
|
->where('id', '!=', $id)
|
||||||
|
->selectRaw("
|
||||||
|
SUM(CASE WHEN jenis_transaksi = 'masuk' THEN jumlah ELSE 0 END)
|
||||||
|
-
|
||||||
|
SUM(CASE WHEN jenis_transaksi = 'keluar' THEN jumlah ELSE 0 END)
|
||||||
|
AS stok
|
||||||
|
")
|
||||||
|
->value('stok') ?? 0;
|
||||||
|
|
||||||
|
if ($request->jumlah > $stokSekarang) {
|
||||||
|
return back()->withErrors([
|
||||||
|
'jumlah' => 'Stok tidak mencukupi. Sisa stok: ' . $stokSekarang
|
||||||
|
])->withInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->update([
|
||||||
|
'tanggal' => $request->tanggal,
|
||||||
|
'nama_barang' => $namaBarang,
|
||||||
|
'jenis_transaksi' => $request->jenis_transaksi,
|
||||||
|
'jumlah' => $request->jumlah,
|
||||||
|
'satuan' => 'karung',
|
||||||
|
'harga_satuan' => $request->jenis_transaksi === 'masuk'
|
||||||
|
? $request->harga_satuan
|
||||||
|
: null,
|
||||||
|
'total_harga' => $total,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('pakan')->with('success', 'Transaksi berhasil diupdate');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
// hanya admin boleh hapus
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
abort(403, 'Anda tidak memiliki izin menghapus data.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$item = InventoriKandang::findOrFail($id);
|
||||||
|
|
||||||
|
// Cek jika yang dihapus adalah transaksi masuk
|
||||||
|
if ($item->jenis_transaksi === 'masuk') {
|
||||||
|
|
||||||
|
$stokSekarang = InventoriKandang::where('nama_barang', $item->nama_barang)
|
||||||
|
->selectRaw("
|
||||||
|
SUM(CASE WHEN jenis_transaksi = 'masuk' THEN jumlah ELSE 0 END)
|
||||||
|
-
|
||||||
|
SUM(CASE WHEN jenis_transaksi = 'keluar' THEN jumlah ELSE 0 END)
|
||||||
|
AS stok
|
||||||
|
")
|
||||||
|
->value('stok') ?? 0;
|
||||||
|
|
||||||
|
// jika setelah dihapus stok jadi minus
|
||||||
|
if (($stokSekarang - $item->jumlah) < 0) {
|
||||||
|
return redirect()
|
||||||
|
->route('pakan')
|
||||||
|
->withErrors([
|
||||||
|
'delete' => 'Transaksi tidak bisa dihapus karena akan menyebabkan stok menjadi minus.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->delete();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('pakan')
|
||||||
|
->with('success', 'Transaksi berhasil dihapus');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Karyawan;
|
||||||
|
|
||||||
|
class ProfilController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
$karyawan = $user->isKaryawan() ? $user->karyawan : null;
|
||||||
|
|
||||||
|
return view('profil', compact('user', 'karyawan'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
$user = Auth::user();
|
||||||
|
$request->session()->flash('active_tab', 'editProfil');
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'name' => ['required', 'string', 'min:3', 'max:100'],
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
$rules['no_hp'] = ['required', 'regex:/^08[0-9]{8,11}$/'];
|
||||||
|
$rules['alamat'] = [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'min:5',
|
||||||
|
'max:255',
|
||||||
|
'regex:/[A-Za-z]/'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$messages = [
|
||||||
|
'name.required' => 'Nama lengkap wajib diisi.',
|
||||||
|
'name.string' => 'Nama lengkap harus berupa teks.',
|
||||||
|
'name.min' => 'Nama lengkap minimal 3 karakter.',
|
||||||
|
'name.max' => 'Nama lengkap maksimal 100 karakter.',
|
||||||
|
|
||||||
|
'email.required' => 'Alamat email wajib diisi.',
|
||||||
|
'email.email' => 'Format alamat email tidak valid.',
|
||||||
|
'email.max' => 'Alamat email maksimal 100 karakter.',
|
||||||
|
'email.unique' => 'Alamat email sudah digunakan oleh pengguna lain.',
|
||||||
|
|
||||||
|
'no_hp.required' => 'Nomor telepon wajib diisi.',
|
||||||
|
'no_hp.regex' => 'Nomor telepon harus diawali dengan 08 dan terdiri dari 10 sampai 13 digit angka.',
|
||||||
|
|
||||||
|
'alamat.required' => 'Alamat wajib diisi.',
|
||||||
|
'alamat.string' => 'Alamat harus berupa teks.',
|
||||||
|
'alamat.max' => 'Alamat maksimal 255 karakter.',
|
||||||
|
'alamat.min' => 'Alamat minimal 5 karakter.',
|
||||||
|
'alamat.regex' => 'Alamat harus mengandung huruf (tidak boleh angka saja).',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
$validated = $request->validate($rules, $messages);
|
||||||
|
|
||||||
|
$user->update([
|
||||||
|
'name' => $validated['name'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($user->isKaryawan()) {
|
||||||
|
$user->karyawan()->updateOrCreate(
|
||||||
|
['user_id' => $user->id],
|
||||||
|
[
|
||||||
|
'nama_karyawan' => $validated['name'],
|
||||||
|
'no_hp' => $validated['no_hp'],
|
||||||
|
'alamat' => $validated['alamat'] ?? null,
|
||||||
|
'status_karyawan' => 'aktif',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return back()->with('success', 'Profil berhasil diperbarui.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updatePassword(Request $request)
|
||||||
|
{
|
||||||
|
$request->session()->flash('active_tab', 'ubahPassword');
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'current_password' => ['required', 'current_password'],
|
||||||
|
'password' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'min:8',
|
||||||
|
'max:20',
|
||||||
|
'confirmed',
|
||||||
|
'regex:/^(?=.*[A-Za-z])(?=.*\d).+$/'
|
||||||
|
],
|
||||||
|
], [
|
||||||
|
'current_password.required' => 'Password lama wajib diisi.',
|
||||||
|
'current_password.current_password' => 'Password lama yang Anda masukkan tidak sesuai.',
|
||||||
|
|
||||||
|
'password.required' => 'Password baru wajib diisi.',
|
||||||
|
'password.string' => 'Password baru harus berupa teks.',
|
||||||
|
'password.min' => 'Password baru minimal terdiri dari 8 karakter.',
|
||||||
|
'password.max' => 'Password baru maksimal terdiri dari 20 karakter.',
|
||||||
|
'password.confirmed' => 'Konfirmasi password baru tidak cocok.',
|
||||||
|
'password.regex' => 'Password baru harus mengandung minimal satu huruf dan satu angka.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$request->user()->update([
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return back()->with('success', 'Password berhasil diperbarui.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Requests\ProfileUpdateRequest;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class ProfileController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the user's profile form.
|
||||||
|
*/
|
||||||
|
public function edit(Request $request): View
|
||||||
|
{
|
||||||
|
return view('profile.edit', [
|
||||||
|
'user' => $request->user(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the user's profile information.
|
||||||
|
*/
|
||||||
|
public function update(ProfileUpdateRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->user()->fill($request->validated());
|
||||||
|
|
||||||
|
if ($request->user()->isDirty('email')) {
|
||||||
|
$request->user()->email_verified_at = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->user()->save();
|
||||||
|
|
||||||
|
return Redirect::route('profile.edit')->with('status', 'profile-updated');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the user's account.
|
||||||
|
*/
|
||||||
|
public function destroy(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validateWithBag('userDeletion', [
|
||||||
|
'password' => ['required', 'current_password'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = $request->user();
|
||||||
|
|
||||||
|
Auth::logout();
|
||||||
|
|
||||||
|
$user->delete();
|
||||||
|
|
||||||
|
$request->session()->invalidate();
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
|
return Redirect::to('/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class CheckRole
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next, ...$roles)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
if (!$user || !in_array($user->role, $roles)) {
|
||||||
|
abort(403, 'Unauthorized.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class LoginRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email' => ['required', 'email'],
|
||||||
|
'password' => ['required', 'string', 'min:6', 'max:20'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function messages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email.required' => 'Email wajib diisi.',
|
||||||
|
'email.email' => 'Format email tidak valid.',
|
||||||
|
|
||||||
|
'password.required' => 'Kata sandi wajib diisi.',
|
||||||
|
'password.min' => 'Kata sandi minimal 6 karakter.',
|
||||||
|
'password.max' => 'Kata sandi maksimal 20 karakter.',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function authenticate(): void
|
||||||
|
{
|
||||||
|
if (! Auth::attempt([
|
||||||
|
'email' => $this->email,
|
||||||
|
'password' => $this->password,
|
||||||
|
'is_active' => 1
|
||||||
|
], $this->boolean('remember'))) {
|
||||||
|
|
||||||
|
throw \Illuminate\Validation\ValidationException::withMessages([
|
||||||
|
'email' => 'Email, kata sandi salah atau akun sudah dinonaktifkan oleh admin.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class ProfileUpdateRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => ['required', 'string', 'max:255'],
|
||||||
|
'email' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'lowercase',
|
||||||
|
'email',
|
||||||
|
'max:255',
|
||||||
|
Rule::unique(User::class)->ignore($this->user()->id),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class GajiKaryawan extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'gaji_karyawan';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'karyawan_id',
|
||||||
|
'bulan',
|
||||||
|
'tahun',
|
||||||
|
'gaji_pokok',
|
||||||
|
'tanggal_bayar',
|
||||||
|
'status_bayar'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function karyawan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Karyawan::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class InventoriKandang extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'inventori_kandang';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'tanggal',
|
||||||
|
'nama_barang',
|
||||||
|
'jenis_transaksi',
|
||||||
|
'jumlah',
|
||||||
|
'satuan',
|
||||||
|
'harga_satuan',
|
||||||
|
'total_harga'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Kandang extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'kandang';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama_kandang',
|
||||||
|
'jenis_kandang'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function mutasiAyam()
|
||||||
|
{
|
||||||
|
return $this->hasMany(MutasiAyam::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function produksiTelur()
|
||||||
|
{
|
||||||
|
return $this->hasMany(ProduksiTelur::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
|
class Karyawan extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'karyawan';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'nama_karyawan',
|
||||||
|
'no_hp',
|
||||||
|
'alamat',
|
||||||
|
'status_karyawan'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* RELASI */
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function gaji()
|
||||||
|
{
|
||||||
|
return $this->hasMany(GajiKaryawan::class);
|
||||||
|
}
|
||||||
|
public function isAktif()
|
||||||
|
{
|
||||||
|
return $this->status_karyawan === 'aktif';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class MutasiAyam extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'mutasi_ayam';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'kandang_id',
|
||||||
|
'user_id',
|
||||||
|
'jenis_mutasi',
|
||||||
|
'jumlah',
|
||||||
|
'tanggal',
|
||||||
|
'keterangan',
|
||||||
|
];
|
||||||
|
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
// Relasi ke Kandang
|
||||||
|
public function kandang()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Kandang::class, 'kandang_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Relasi ke User
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'user_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Penjualan extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'penjualan';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'jenis_produk',
|
||||||
|
'berat_terjual',
|
||||||
|
'harga_satuan',
|
||||||
|
'total_penjualan',
|
||||||
|
'tanggal_penjualan',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Relasi ke User (penjual)
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ProduksiTelur extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'produksi_telur';
|
||||||
|
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'kandang_id',
|
||||||
|
'user_id',
|
||||||
|
'shift',
|
||||||
|
'berat_telur_layak',
|
||||||
|
'berat_telur_rusak',
|
||||||
|
'berat_telur_total',
|
||||||
|
'tanggal_produksi',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function kandang()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Kandang::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use App\Notifications\ResetPasswordNotification;
|
||||||
|
|
||||||
|
|
||||||
|
class User extends Authenticatable
|
||||||
|
{
|
||||||
|
use HasFactory, Notifiable;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'email',
|
||||||
|
'password',
|
||||||
|
'role',
|
||||||
|
'is_active',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $hidden = [
|
||||||
|
'password',
|
||||||
|
'remember_token',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'email_verified_at' => 'datetime',
|
||||||
|
'is_active' => 'boolean',
|
||||||
|
];
|
||||||
|
|
||||||
|
/* ========== ROLE CHECK ========== */
|
||||||
|
public function isAdmin(): bool
|
||||||
|
{
|
||||||
|
return $this->role === 'admin';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isKaryawan(): bool
|
||||||
|
{
|
||||||
|
return $this->role === 'karyawan';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* RELASI */
|
||||||
|
public function inventoriKandang()
|
||||||
|
{
|
||||||
|
return $this->hasMany(InventoriKandang::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function penjualan()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Penjualan::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function karyawan()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Karyawan::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function mutasiAyam()
|
||||||
|
{
|
||||||
|
return $this->hasMany(MutasiAyam::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function produksiTelur()
|
||||||
|
{
|
||||||
|
return $this->hasMany(ProduksiTelur::class);
|
||||||
|
}
|
||||||
|
public function sendPasswordResetNotification($token)
|
||||||
|
{
|
||||||
|
$this->notify(new ResetPasswordNotification($token));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Notifications\ResetPassword;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
|
class ResetPasswordNotification extends ResetPassword
|
||||||
|
{
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
$url = url(route('password.reset', [
|
||||||
|
'token' => $this->token,
|
||||||
|
'email' => $notifiable->getEmailForPasswordReset(),
|
||||||
|
], false));
|
||||||
|
|
||||||
|
return (new MailMessage)
|
||||||
|
->subject('Reset Kata Sandi Akun Anda')
|
||||||
|
->greeting('Halo!')
|
||||||
|
->line('Anda menerima email ini karena kami menerima permintaan reset kata sandi untuk akun Anda.')
|
||||||
|
->action('Reset Kata Sandi', $url)
|
||||||
|
->line('Link reset kata sandi ini akan kedaluwarsa dalam 60 menit.')
|
||||||
|
->line('Jika Anda tidak merasa meminta reset kata sandi, abaikan email ini.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Pagination\Paginator;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register any application services.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
Paginator::useBootstrap();
|
||||||
|
|
||||||
|
// SET BAHASA INDONESIA UNTUK TANGGAL
|
||||||
|
Carbon::setLocale('id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,213 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||||
|
|
||||||
|
class LaporanExportService
|
||||||
|
{
|
||||||
|
public function export(int $tahun): StreamedResponse
|
||||||
|
{
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
|
||||||
|
/*
|
||||||
|
| SHEET 1 — PRODUKSI (MINGGUAN)
|
||||||
|
*/
|
||||||
|
$sheetProduksi = $spreadsheet->getActiveSheet();
|
||||||
|
$sheetProduksi->setTitle('Produksi');
|
||||||
|
|
||||||
|
$sheetProduksi->setCellValue('A1', 'LAPORAN PETERNAKAN AYAM PETELUR PAK HARI');
|
||||||
|
$sheetProduksi->setCellValue('A2', 'TAHUN ' . $tahun);
|
||||||
|
|
||||||
|
$sheetProduksi->setCellValue('A4', 'Bulan');
|
||||||
|
$sheetProduksi->setCellValue('B4', 'Minggu');
|
||||||
|
$sheetProduksi->setCellValue('C4', 'Total Produksi (Kg)');
|
||||||
|
|
||||||
|
$produksi = DB::table('produksi_telur')
|
||||||
|
->selectRaw('
|
||||||
|
MONTH(tanggal_produksi) AS bulan,
|
||||||
|
CEIL(DAY(tanggal_produksi) / 7) AS minggu,
|
||||||
|
SUM(berat_telur_total) AS total
|
||||||
|
')
|
||||||
|
->whereYear('tanggal_produksi', $tahun)
|
||||||
|
->groupBy('bulan', 'minggu')
|
||||||
|
->orderBy('bulan')
|
||||||
|
->orderBy('minggu')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$row = 5;
|
||||||
|
foreach ($produksi as $item) {
|
||||||
|
$sheetProduksi->setCellValue(
|
||||||
|
"A{$row}",
|
||||||
|
\Carbon\Carbon::createFromDate(null, $item->bulan, 1)
|
||||||
|
->locale('id')
|
||||||
|
->translatedFormat('F')
|
||||||
|
);
|
||||||
|
$sheetProduksi->setCellValue("B{$row}", 'Minggu ' . $item->minggu);
|
||||||
|
$sheetProduksi->setCellValue("C{$row}", $item->total);
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalProduksi = $produksi->sum('total');
|
||||||
|
$jumlahMinggu = $produksi->count();
|
||||||
|
$rataProduksi = $jumlahMinggu > 0 ? $totalProduksi / $jumlahMinggu : 0;
|
||||||
|
|
||||||
|
$sheetProduksi->setCellValue("A{$row}", 'TOTAL PRODUKSI TAHUNAN');
|
||||||
|
$sheetProduksi->setCellValue("C{$row}", $totalProduksi);
|
||||||
|
$row++;
|
||||||
|
|
||||||
|
$sheetProduksi->setCellValue("A{$row}", 'RATA-RATA PRODUKSI MINGGUAN');
|
||||||
|
$sheetProduksi->setCellValue("C{$row}", round($rataProduksi, 1));
|
||||||
|
$row++;
|
||||||
|
|
||||||
|
$this->autoSize($sheetProduksi);
|
||||||
|
|
||||||
|
/*
|
||||||
|
| SHEET 2 — INVENTORI (MINGGUAN)
|
||||||
|
*/
|
||||||
|
$sheetInventori = $spreadsheet->createSheet();
|
||||||
|
$sheetInventori->setTitle('Pakan');
|
||||||
|
|
||||||
|
$sheetInventori->setCellValue('A1', 'LAPORAN PETERNAKAN AYAM PETELUR PAK HARI');
|
||||||
|
$sheetInventori->setCellValue('A2', 'TAHUN ' . $tahun);
|
||||||
|
|
||||||
|
$sheetInventori->setCellValue('A4', 'Bulan');
|
||||||
|
$sheetInventori->setCellValue('B4', 'Minggu');
|
||||||
|
$sheetInventori->setCellValue('C4', 'Pakan Masuk (Kg)');
|
||||||
|
$sheetInventori->setCellValue('D4', 'Pakan Keluar (Kg)');
|
||||||
|
|
||||||
|
$inventori = DB::table('inventori_kandang')
|
||||||
|
->selectRaw('
|
||||||
|
MONTH(created_at) AS bulan,
|
||||||
|
CEIL(DAY(created_at) / 7) AS minggu,
|
||||||
|
SUM(CASE WHEN jenis_transaksi = "masuk" THEN jumlah ELSE 0 END) AS masuk,
|
||||||
|
SUM(CASE WHEN jenis_transaksi = "keluar" THEN jumlah ELSE 0 END) AS keluar
|
||||||
|
')
|
||||||
|
->whereYear('created_at', $tahun)
|
||||||
|
->groupBy('bulan', 'minggu')
|
||||||
|
->orderBy('bulan')
|
||||||
|
->orderBy('minggu')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$row = 5;
|
||||||
|
foreach ($inventori as $item) {
|
||||||
|
$sheetInventori->setCellValue(
|
||||||
|
"A{$row}",
|
||||||
|
\Carbon\Carbon::createFromDate(null, $item->bulan, 1)
|
||||||
|
->locale('id')
|
||||||
|
->translatedFormat('F')
|
||||||
|
);
|
||||||
|
$sheetInventori->setCellValue("B{$row}", 'Minggu ' . $item->minggu);
|
||||||
|
$sheetInventori->setCellValue("C{$row}", $item->masuk);
|
||||||
|
$sheetInventori->setCellValue("D{$row}", $item->keluar);
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalMasuk = $inventori->sum('masuk');
|
||||||
|
$totalKeluar = $inventori->sum('keluar');
|
||||||
|
|
||||||
|
$sheetInventori->setCellValue("A{$row}", 'TOTAL MASUK PAKAN TAHUNAN');
|
||||||
|
$sheetInventori->setCellValue("C{$row}", $totalMasuk);
|
||||||
|
$row++;
|
||||||
|
|
||||||
|
$sheetInventori->setCellValue("A{$row}", 'TOTAL KELUAR PAKAN TAHUNAN');
|
||||||
|
$sheetInventori->setCellValue("D{$row}", $totalKeluar);
|
||||||
|
$row++;
|
||||||
|
|
||||||
|
$this->autoSize($sheetInventori);
|
||||||
|
|
||||||
|
/*
|
||||||
|
| SHEET 3 — KEUANGAN (BULANAN)
|
||||||
|
*/
|
||||||
|
$sheetKeuangan = $spreadsheet->createSheet();
|
||||||
|
$sheetKeuangan->setTitle('Keuangan');
|
||||||
|
|
||||||
|
$sheetKeuangan->setCellValue('A1', 'LAPORAN PETERNAKAN AYAM PETELUR PAK HARI');
|
||||||
|
$sheetKeuangan->setCellValue('A2', 'TAHUN ' . $tahun);
|
||||||
|
|
||||||
|
$sheetKeuangan->setCellValue('A4', 'Bulan');
|
||||||
|
$sheetKeuangan->setCellValue('B4', 'Pemasukan');
|
||||||
|
$sheetKeuangan->setCellValue('C4', 'Pembelian Pakan');
|
||||||
|
$sheetKeuangan->setCellValue('D4', 'Gaji');
|
||||||
|
$sheetKeuangan->setCellValue('E4', 'Laba / Rugi');
|
||||||
|
|
||||||
|
$pemasukan = DB::table('penjualan')
|
||||||
|
->selectRaw('
|
||||||
|
MONTH(tanggal_penjualan) AS bulan,
|
||||||
|
SUM(total_penjualan) AS total
|
||||||
|
')
|
||||||
|
->whereYear('tanggal_penjualan', $tahun)
|
||||||
|
->groupBy('bulan')
|
||||||
|
->get()
|
||||||
|
->keyBy('bulan');
|
||||||
|
|
||||||
|
|
||||||
|
$inventoriMasuk = DB::table('inventori_kandang')
|
||||||
|
->selectRaw('MONTH(created_at) AS bulan, SUM(total_harga) AS total')
|
||||||
|
->whereYear('created_at', $tahun)
|
||||||
|
->where('jenis_transaksi', 'masuk')
|
||||||
|
->groupBy('bulan')
|
||||||
|
->get()
|
||||||
|
->keyBy('bulan');
|
||||||
|
|
||||||
|
$gaji = DB::table('gaji_karyawan')
|
||||||
|
->selectRaw('bulan, SUM(gaji_pokok) AS total')
|
||||||
|
->where('tahun', $tahun)
|
||||||
|
->groupBy('bulan')
|
||||||
|
->get()
|
||||||
|
->keyBy('bulan');
|
||||||
|
|
||||||
|
$row = 5;
|
||||||
|
for ($bulan = 1; $bulan <= 12; $bulan++) {
|
||||||
|
$p = $pemasukan[$bulan]->total ?? 0;
|
||||||
|
$i = $inventoriMasuk[$bulan]->total ?? 0;
|
||||||
|
$g = $gaji[$bulan]->total ?? 0;
|
||||||
|
$laba = $p - ($i + $g);
|
||||||
|
|
||||||
|
$sheetKeuangan->setCellValue(
|
||||||
|
"A{$row}",
|
||||||
|
\Carbon\Carbon::createFromDate(null, $bulan, 1)
|
||||||
|
->locale('id')
|
||||||
|
->translatedFormat('F')
|
||||||
|
);
|
||||||
|
$sheetKeuangan->setCellValue("B{$row}", $p);
|
||||||
|
$sheetKeuangan->setCellValue("C{$row}", $i);
|
||||||
|
$sheetKeuangan->setCellValue("D{$row}", $g);
|
||||||
|
$sheetKeuangan->setCellValue("E{$row}", $laba);
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalPemasukan = $pemasukan->sum('total');
|
||||||
|
$totalInventori = $inventoriMasuk->sum('total');
|
||||||
|
$totalGaji = $gaji->sum('total');
|
||||||
|
$labaTahunan = $totalPemasukan - ($totalInventori + $totalGaji);
|
||||||
|
|
||||||
|
$sheetKeuangan->setCellValue("A{$row}", 'LABA BERSIH TAHUNAN');
|
||||||
|
$sheetKeuangan->setCellValue("E{$row}", $labaTahunan);
|
||||||
|
|
||||||
|
$this->autoSize($sheetKeuangan);
|
||||||
|
|
||||||
|
/*
|
||||||
|
| DOWNLOAD
|
||||||
|
*/
|
||||||
|
$filename = "Laporan-Tahunan-{$tahun}.xlsx";
|
||||||
|
|
||||||
|
return new StreamedResponse(function () use ($spreadsheet) {
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save('php://output');
|
||||||
|
}, 200, [
|
||||||
|
'Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
'Content-Disposition' => "attachment; filename=\"{$filename}\"",
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function autoSize($sheet): void
|
||||||
|
{
|
||||||
|
foreach (range('A', $sheet->getHighestColumn()) as $col) {
|
||||||
|
$sheet->getColumnDimension($col)->setAutoSize(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class AppLayout extends Component
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represents the component.
|
||||||
|
*/
|
||||||
|
public function render(): View
|
||||||
|
{
|
||||||
|
return view('layouts.app');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class GuestLayout extends Component
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represents the component.
|
||||||
|
*/
|
||||||
|
public function render(): View
|
||||||
|
{
|
||||||
|
return view('layouts.guest');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Application;
|
||||||
|
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...
|
||||||
|
/** @var Application $app */
|
||||||
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
|
$status = $app->handleCommand(new ArgvInput);
|
||||||
|
|
||||||
|
exit($status);
|
||||||
|
|
@ -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): void {
|
||||||
|
//
|
||||||
|
})
|
||||||
|
->withExceptions(function (Exceptions $exceptions): void {
|
||||||
|
//
|
||||||
|
})->create();
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
App\Providers\AppServiceProvider::class,
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
{
|
||||||
|
"$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",
|
||||||
|
"doctrine/dbal": "^4.4",
|
||||||
|
"laravel/framework": "^12.0",
|
||||||
|
"laravel/tinker": "^2.10.1",
|
||||||
|
"phpoffice/phpspreadsheet": "^5.4"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fakerphp/faker": "^1.23",
|
||||||
|
"laravel/breeze": "^2.3",
|
||||||
|
"laravel/pail": "^1.2.2",
|
||||||
|
"laravel/pint": "^1.24",
|
||||||
|
"laravel/sail": "^1.41",
|
||||||
|
"mockery/mockery": "^1.6",
|
||||||
|
"nunomaduro/collision": "^8.6",
|
||||||
|
"phpunit/phpunit": "^11.5.3"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/",
|
||||||
|
"Database\\Factories\\": "database/factories/",
|
||||||
|
"Database\\Seeders\\": "database/seeders/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"setup": [
|
||||||
|
"composer install",
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
|
||||||
|
"@php artisan key:generate",
|
||||||
|
"@php artisan migrate --force",
|
||||||
|
"npm install",
|
||||||
|
"npm run build"
|
||||||
|
],
|
||||||
|
"dev": [
|
||||||
|
"Composer\\Config::disableProcessTimeout",
|
||||||
|
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
|
||||||
|
],
|
||||||
|
"test": [
|
||||||
|
"@php artisan config:clear --ansi",
|
||||||
|
"@php artisan test"
|
||||||
|
],
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi"
|
||||||
|
],
|
||||||
|
"post-update-cmd": [
|
||||||
|
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||||
|
],
|
||||||
|
"post-root-package-install": [
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
|
],
|
||||||
|
"post-create-project-cmd": [
|
||||||
|
"@php artisan key:generate --ansi",
|
||||||
|
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||||
|
"@php artisan migrate --graceful --ansi"
|
||||||
|
],
|
||||||
|
"pre-package-uninstall": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"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
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -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' => '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(',', (string) 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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -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 number 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),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
<?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",
|
||||||
|
| "failover", "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',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'driver' => 'failover',
|
||||||
|
'stores' => [
|
||||||
|
'database',
|
||||||
|
'array',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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((string) env('APP_NAME', 'laravel')).'-cache-'),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,183 @@
|
||||||
|
<?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,
|
||||||
|
'transaction_mode' => 'DEFERRED',
|
||||||
|
],
|
||||||
|
|
||||||
|
'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([
|
||||||
|
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \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([
|
||||||
|
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \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' => env('DB_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((string) env('APP_NAME', 'laravel')).'-database-'),
|
||||||
|
'persistent' => env('REDIS_PERSISTENT', false),
|
||||||
|
],
|
||||||
|
|
||||||
|
'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'),
|
||||||
|
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||||
|
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||||
|
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||||
|
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||||
|
],
|
||||||
|
|
||||||
|
'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'),
|
||||||
|
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||||
|
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||||
|
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||||
|
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -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' => rtrim(env('APP_URL', 'http://localhost'), '/').'/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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -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(',', (string) 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,
|
||||||
|
'handler_with' => [
|
||||||
|
'stream' => 'php://stderr',
|
||||||
|
],
|
||||||
|
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||||
|
'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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
<?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((string) 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',
|
||||||
|
],
|
||||||
|
'retry_after' => 60,
|
||||||
|
],
|
||||||
|
|
||||||
|
'roundrobin' => [
|
||||||
|
'transport' => 'roundrobin',
|
||||||
|
'mailers' => [
|
||||||
|
'ses',
|
||||||
|
'postmark',
|
||||||
|
],
|
||||||
|
'retry_after' => 60,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
<?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",
|
||||||
|
| "deferred", "background", "failover", "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,
|
||||||
|
],
|
||||||
|
|
||||||
|
'deferred' => [
|
||||||
|
'driver' => 'deferred',
|
||||||
|
],
|
||||||
|
|
||||||
|
'background' => [
|
||||||
|
'driver' => 'background',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'driver' => 'failover',
|
||||||
|
'connections' => [
|
||||||
|
'database',
|
||||||
|
'deferred',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -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' => [
|
||||||
|
'key' => env('POSTMARK_API_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'resend' => [
|
||||||
|
'key' => env('RESEND_API_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'notifications' => [
|
||||||
|
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||||
|
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -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", "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: "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((string) 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 without 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),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
*.sqlite*
|
||||||
|
|
@ -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,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('users', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('email')->unique(); // WAJIB UNIQUE
|
||||||
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
|
|
||||||
|
$table->string('password');
|
||||||
|
|
||||||
|
$table->enum('role', ['admin', 'karyawan'])->default('karyawan');
|
||||||
|
$table->boolean('is_active')->default(true); // kontrol login
|
||||||
|
|
||||||
|
$table->rememberToken();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('users');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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')->index();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('cache_locks', function (Blueprint $table) {
|
||||||
|
$table->string('key')->primary();
|
||||||
|
$table->string('owner');
|
||||||
|
$table->integer('expiration')->index();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('cache');
|
||||||
|
Schema::dropIfExists('cache_locks');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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('karyawan', function (Blueprint $table) {
|
||||||
|
$table->id(); // id primary key auto increment
|
||||||
|
$table->foreignId('user_id')->nullable()->constrained()->onDelete('cascade'); // jika relasi ke user ada
|
||||||
|
$table->string('nama_karyawan');
|
||||||
|
$table->string('no_hp');
|
||||||
|
$table->string('alamat')->nullable();
|
||||||
|
$table->enum('status_karyawan', ['aktif', 'nonaktif']);
|
||||||
|
$table->timestamps(); // created_at & updated_at
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('karyawan');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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('kandang', function (Blueprint $table) {
|
||||||
|
$table->id(); // id primary key auto increment
|
||||||
|
$table->string('nama_kandang');
|
||||||
|
$table->string('jenis_kandang');
|
||||||
|
$table->timestamps(); // created_at & updated_at
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('kandang');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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('produk', function (Blueprint $table) {
|
||||||
|
$table->id(); // id primary key auto increment
|
||||||
|
$table->string('nama_produk');
|
||||||
|
$table->string('jenis_produk');
|
||||||
|
$table->string('satuan');
|
||||||
|
$table->timestamps(); // created_at & updated_at
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('produk');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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('populasi_ayam', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('kandang_id')->constrained('kandang'); // foreign key ke tabel kandang
|
||||||
|
$table->foreignId('user_id')->nullable()->constrained('users'); // foreign key ke users, nullable
|
||||||
|
$table->integer('jumlah_ayam');
|
||||||
|
$table->date('tanggal');
|
||||||
|
$table->text('keterangan')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('populasi_ayam');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?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('produksi_telur', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('kandang_id')->constrained('kandang'); // FK ke tabel kandang
|
||||||
|
$table->foreignId('user_id')->nullable()->constrained('users'); // FK ke users, nullable
|
||||||
|
$table->enum('shift', ['pagi', 'sore']);
|
||||||
|
$table->decimal('berat_telur_layak', 8, 2);
|
||||||
|
$table->decimal('berat_telur_rusak', 8, 2);
|
||||||
|
$table->decimal('berat_telur_total', 8, 2);
|
||||||
|
$table->date('tanggal_produksi');
|
||||||
|
$table->timestamps(); // created_at & updated_at
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('produksi_telur');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?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('inventori_kandang', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('user_id')->constrained('users'); // FK ke users
|
||||||
|
$table->string('nama_barang');
|
||||||
|
$table->enum('jenis_transaksi', ['masuk', 'keluar']);
|
||||||
|
$table->decimal('jumlah', 10, 2);
|
||||||
|
$table->string('satuan');
|
||||||
|
$table->decimal('harga_satuan', 12, 2)->nullable();
|
||||||
|
$table->decimal('total_harga', 14, 2)->nullable();
|
||||||
|
$table->timestamps(); // created_at & updated_at
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('inventori_kandang');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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('penjualan', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('user_id')->constrained('users'); // FK ke users
|
||||||
|
$table->decimal('total_penjualan', 14, 2);
|
||||||
|
$table->timestamps(); // created_at & updated_at
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('penjualan');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?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('detail_penjualan', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('penjualan_id')->constrained('penjualan')->cascadeOnDelete();
|
||||||
|
$table->foreignId('produk_id')->constrained('produk')->cascadeOnDelete();
|
||||||
|
$table->decimal('jumlah', 10, 2);
|
||||||
|
$table->decimal('harga_satuan', 12, 2);
|
||||||
|
$table->timestamps(); // created_at & updated_at
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('detail_penjualan');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?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('gaji_karyawan', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('karyawan_id')->constrained('karyawan')->cascadeOnDelete();
|
||||||
|
$table->integer('bulan');
|
||||||
|
$table->integer('tahun');
|
||||||
|
$table->decimal('gaji_pokok', 12, 2);
|
||||||
|
$table->date('tanggal_bayar');
|
||||||
|
$table->enum('status_bayar', ['dibayar', 'belum']);
|
||||||
|
$table->timestamps(); // created_at & updated_at
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('gaji_karyawan');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?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('password_resets', function (Blueprint $table) {
|
||||||
|
$table->string('email')->index();
|
||||||
|
$table->string('token');
|
||||||
|
$table->timestamp('created_at')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('password_resets');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('penjualan', function (Blueprint $table) {
|
||||||
|
// berat_terjual sudah ada → skip kalau perlu
|
||||||
|
if (!Schema::hasColumn('penjualan', 'berat_terjual')) {
|
||||||
|
$table->decimal('berat_terjual', 8, 2)->after('user_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// harga_satuan belum ada → tambah
|
||||||
|
if (!Schema::hasColumn('penjualan', 'harga_satuan')) {
|
||||||
|
$table->decimal('harga_satuan', 12, 2)->after('berat_terjual');
|
||||||
|
}
|
||||||
|
|
||||||
|
// total_penjualan sudah ada → lewati
|
||||||
|
|
||||||
|
// tanggal_penjualan baru → gunakan nullable supaya data lama aman
|
||||||
|
if (!Schema::hasColumn('penjualan', 'tanggal_penjualan')) {
|
||||||
|
$table->date('tanggal_penjualan')->nullable()->after('total_penjualan');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('penjualan', function (Blueprint $table) {
|
||||||
|
if (Schema::hasColumn('penjualan', 'berat_terjual')) {
|
||||||
|
$table->dropColumn('berat_terjual');
|
||||||
|
}
|
||||||
|
if (Schema::hasColumn('penjualan', 'harga_satuan')) {
|
||||||
|
$table->dropColumn('harga_satuan');
|
||||||
|
}
|
||||||
|
if (Schema::hasColumn('penjualan', 'tanggal_penjualan')) {
|
||||||
|
$table->dropColumn('tanggal_penjualan');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('detail_penjualan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::create('detail_penjualan', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('penjualan_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->string('produk_id'); // sesuaikan dengan kolom lama
|
||||||
|
$table->integer('jumlah');
|
||||||
|
$table->decimal('harga_satuan', 12, 2);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
// Hapus tabel produk
|
||||||
|
Schema::dropIfExists('produk');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
// Kembalikan tabel produk jika rollback
|
||||||
|
Schema::create('produk', function (Blueprint $table) {
|
||||||
|
$table->id(); // id primary key auto increment
|
||||||
|
$table->string('nama_produk');
|
||||||
|
$table->string('jenis_produk');
|
||||||
|
$table->string('satuan');
|
||||||
|
$table->timestamps(); // created_at & updated_at
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('populasi_ayam');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::create('populasi_ayam', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('kandang_id')->constrained('kandang');
|
||||||
|
$table->foreignId('user_id')->nullable()->constrained('users');
|
||||||
|
$table->integer('jumlah_ayam');
|
||||||
|
$table->date('tanggal');
|
||||||
|
$table->text('keterangan')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('mutasi_ayam', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
|
||||||
|
// kolom foreign key ke kandang
|
||||||
|
$table->unsignedBigInteger('kandang_id');
|
||||||
|
$table->foreign('kandang_id')->references('id')->on('kandang')->cascadeOnDelete();
|
||||||
|
|
||||||
|
// kolom foreign key ke users
|
||||||
|
$table->unsignedBigInteger('user_id');
|
||||||
|
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
|
||||||
|
|
||||||
|
// kolom lainnya
|
||||||
|
$table->enum('jenis_mutasi', ['masuk','keluar','mati','afkir','pindah']);
|
||||||
|
$table->integer('jumlah');
|
||||||
|
$table->date('tanggal');
|
||||||
|
$table->text('keterangan')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('mutasi_ayam');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('produksi_telur', function (Blueprint $table) {
|
||||||
|
$table->decimal('berat_telur_layak', 8, 2)->change();
|
||||||
|
$table->decimal('berat_telur_rusak', 8, 2)->change();
|
||||||
|
$table->decimal('berat_telur_total', 8, 2)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('produksi_telur', function (Blueprint $table) {
|
||||||
|
$table->integer('berat_telur_layak')->change();
|
||||||
|
$table->integer('berat_telur_rusak')->change();
|
||||||
|
$table->integer('berat_telur_total')->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::rename('password_resets', 'password_reset_tokens');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::rename('password_reset_tokens', 'password_resets');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('penjualan', function (Blueprint $table) {
|
||||||
|
|
||||||
|
if (!Schema::hasColumn('penjualan', 'jenis_produk')) {
|
||||||
|
$table->enum('jenis_produk', ['telur', 'afkir'])
|
||||||
|
->after('user_id');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('penjualan', function (Blueprint $table) {
|
||||||
|
|
||||||
|
if (Schema::hasColumn('penjualan', 'jenis_produk')) {
|
||||||
|
$table->dropColumn('jenis_produk');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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::table('inventori_kandang', function (Blueprint $table) {
|
||||||
|
$table->date('tanggal')
|
||||||
|
->default(now())
|
||||||
|
->after('user_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('inventori_kandang', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('tanggal');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$this->call([
|
||||||
|
UserSeeder::class,
|
||||||
|
KandangSeeder::class,
|
||||||
|
KaryawanSeeder::class,
|
||||||
|
GajiKaryawanSeeder::class,
|
||||||
|
InventoriKandangSeeder::class,
|
||||||
|
MutasiAyamSeeder::class,
|
||||||
|
ProduksiTelurSeeder::class,
|
||||||
|
PenjualanSeeder::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use App\Models\GajiKaryawan;
|
||||||
|
|
||||||
|
class GajiKaryawanSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
GajiKaryawan::create([
|
||||||
|
'karyawan_id' => 1,
|
||||||
|
'bulan' => 1,
|
||||||
|
'tahun' => 2026,
|
||||||
|
'gaji_pokok' => 2500000,
|
||||||
|
'tanggal_bayar' => '2026-01-31',
|
||||||
|
'status_bayar' => 'dibayar'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\InventoriKandang;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class InventoriKandangSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
// Transaksi Masuk
|
||||||
|
InventoriKandang::create([
|
||||||
|
'user_id' => 1,
|
||||||
|
'tanggal' => now(),
|
||||||
|
'nama_barang' => 'Konsentrat',
|
||||||
|
'jenis_transaksi' => 'masuk',
|
||||||
|
'jumlah' => 15,
|
||||||
|
'satuan' => 'karung',
|
||||||
|
'harga_satuan' => 300000,
|
||||||
|
'total_harga' => 4500000
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Transaksi Keluar
|
||||||
|
InventoriKandang::create([
|
||||||
|
'user_id' => 1,
|
||||||
|
'tanggal' => now(),
|
||||||
|
'nama_barang' => 'Konsentrat',
|
||||||
|
'jenis_transaksi' => 'keluar',
|
||||||
|
'jumlah' => 5,
|
||||||
|
'satuan' => 'karung',
|
||||||
|
'harga_satuan' => null,
|
||||||
|
'total_harga' => null
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Kandang;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class KandangSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
Kandang::create([
|
||||||
|
'nama_kandang' => 'Kandang Pembesaran',
|
||||||
|
'jenis_kandang' => 'Pembesaran'
|
||||||
|
]);
|
||||||
|
|
||||||
|
Kandang::create([
|
||||||
|
'nama_kandang' => 'Kandang Produksi',
|
||||||
|
'jenis_kandang' => 'Produksi'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Karyawan;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class KaryawanSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$userMisno = User::where('email', 'ninavirgiana931@gmail.com')->first();
|
||||||
|
|
||||||
|
Karyawan::updateOrCreate(
|
||||||
|
[
|
||||||
|
'nama_karyawan' => 'Misno'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'user_id' => $userMisno ? $userMisno->id : null,
|
||||||
|
'nama_karyawan' => 'Misno',
|
||||||
|
'no_hp' => '085859716566',
|
||||||
|
'alamat' => 'Tanjungkalang',
|
||||||
|
'status_karyawan' => 'aktif'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use App\Models\MutasiAyam;
|
||||||
|
|
||||||
|
class MutasiAyamSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
MutasiAyam::create([
|
||||||
|
'kandang_id' => 1,
|
||||||
|
'user_id' => 1,
|
||||||
|
'jenis_mutasi' => 'masuk',
|
||||||
|
'jumlah' => 7000,
|
||||||
|
'tanggal' => now(),
|
||||||
|
'keterangan' => 'DOC baru'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Penjualan;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class PenjualanSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
// Penjualan 1
|
||||||
|
Penjualan::create([
|
||||||
|
'user_id' => 1,
|
||||||
|
'jenis_produk' => 'telur',
|
||||||
|
'berat_terjual' => 50,
|
||||||
|
'harga_satuan' => 27500,
|
||||||
|
'total_penjualan' => 1375000,
|
||||||
|
'tanggal_penjualan' => now()
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Penjualan 2
|
||||||
|
Penjualan::create([
|
||||||
|
'user_id' => 1,
|
||||||
|
'jenis_produk' => 'telur',
|
||||||
|
'berat_terjual' => 80,
|
||||||
|
'harga_satuan' => 27500,
|
||||||
|
'total_penjualan' => 2200000,
|
||||||
|
'tanggal_penjualan' => now()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\ProduksiTelur;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class ProduksiTelurSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Shift Pagi
|
||||||
|
ProduksiTelur::create([
|
||||||
|
'kandang_id' => 2,
|
||||||
|
'user_id' => 1,
|
||||||
|
'shift' => 'pagi',
|
||||||
|
'berat_telur_layak' => 150,
|
||||||
|
'berat_telur_rusak' => 0,
|
||||||
|
'berat_telur_total' => 150,
|
||||||
|
'tanggal_produksi' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Shift Sore
|
||||||
|
ProduksiTelur::create([
|
||||||
|
'kandang_id' => 2,
|
||||||
|
'user_id' => 1,
|
||||||
|
'shift' => 'sore',
|
||||||
|
'berat_telur_layak' => 80,
|
||||||
|
'berat_telur_rusak' => 0,
|
||||||
|
'berat_telur_total' => 80,
|
||||||
|
'tanggal_produksi' => now(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
class UserSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
// ADMIN UTAMA
|
||||||
|
User::updateOrCreate(
|
||||||
|
[
|
||||||
|
'email' => 'vrgnina001@gmail.com',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Mashari',
|
||||||
|
'password' => Hash::make('password'),
|
||||||
|
'role' => 'admin',
|
||||||
|
'is_active' => true,
|
||||||
|
'email_verified_at' => now(),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// USER UNTUK KARYAWAN
|
||||||
|
User::updateOrCreate(
|
||||||
|
[
|
||||||
|
'email' => 'ninavirgiana931@gmail.com',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Misno',
|
||||||
|
'password' => Hash::make('password'),
|
||||||
|
'role' => 'karyawan',
|
||||||
|
'is_active' => true,
|
||||||
|
'email_verified_at' => now(),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://www.schemastore.org/package.json",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"build": "vite build",
|
||||||
|
"dev": "vite"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tailwindcss/forms": "^0.5.2",
|
||||||
|
"@tailwindcss/vite": "^4.0.0",
|
||||||
|
"alpinejs": "^3.4.2",
|
||||||
|
"autoprefixer": "^10.4.2",
|
||||||
|
"axios": "^1.11.0",
|
||||||
|
"concurrently": "^9.0.1",
|
||||||
|
"laravel-vite-plugin": "^2.0.0",
|
||||||
|
"postcss": "^8.4.31",
|
||||||
|
"tailwindcss": "^3.1.0",
|
||||||
|
"vite": "^7.0.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?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="BROADCAST_CONNECTION" value="null"/>
|
||||||
|
<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="QUEUE_CONNECTION" value="sync"/>
|
||||||
|
<env name="SESSION_DRIVER" value="array"/>
|
||||||
|
<env name="PULSE_ENABLED" value="false"/>
|
||||||
|
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||||
|
<env name="NIGHTWATCH_ENABLED" value="false"/>
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
export default {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -0,0 +1,146 @@
|
||||||
|
/* =========================================
|
||||||
|
AUTH CLEAN MODERN STYLE
|
||||||
|
========================================= */
|
||||||
|
body {
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
html {
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.auth-page {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== WRAPPER ===== */
|
||||||
|
.auth-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
/* ===== CARD ===== */
|
||||||
|
.auth-card {
|
||||||
|
background: #ffffff;
|
||||||
|
padding: 40px;
|
||||||
|
border-radius: 20px;
|
||||||
|
box-shadow: 0 25px 50px rgba(0, 0, 0, 0.08);
|
||||||
|
width: 100%;
|
||||||
|
max-width: 420px;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hover subtle modern */
|
||||||
|
.auth-card:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== IMAGE ===== */
|
||||||
|
.auth-card img {
|
||||||
|
max-width: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== TITLE ===== */
|
||||||
|
.auth-card h4 {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1e293b;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-card .text-muted {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #64748b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== INPUT ===== */
|
||||||
|
.form-label {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control {
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control:focus {
|
||||||
|
border-color: #2563EB;
|
||||||
|
box-shadow: 0 0 0 0.15rem rgba(37, 99, 235, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== CHECKBOX ===== */
|
||||||
|
.form-check-input {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check-label {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== BUTTON ===== */
|
||||||
|
.btn {
|
||||||
|
border-radius: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: #2563EB;
|
||||||
|
border-color: #2563EB;
|
||||||
|
box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #1E4ED8;
|
||||||
|
border-color: #1E4ED8;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== LINK ===== */
|
||||||
|
a {
|
||||||
|
color: #2563EB;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #1E40AF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =========================================
|
||||||
|
RESPONSIVE MOBILE
|
||||||
|
========================================= */
|
||||||
|
|
||||||
|
@media (max-width: 576px) {
|
||||||
|
body.auth-page {
|
||||||
|
align-items: center;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-card {
|
||||||
|
padding: 25px;
|
||||||
|
border-radius: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-card img {
|
||||||
|
max-width: 85%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-card h4 {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,508 @@
|
||||||
|
/* =====================================================
|
||||||
|
GLOBAL DASHBOARD STYLE (AMAN UNTUK SEMUA HALAMAN)
|
||||||
|
===================================================== */
|
||||||
|
body {
|
||||||
|
font-family: "Poppins", sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
background: #f4f6fb;
|
||||||
|
color: #1f2937;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Heading lebih tegas */
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Text sekunder tetap ringan tapi jelas */
|
||||||
|
.text-muted {
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== KONTEN UTAMA ===== */
|
||||||
|
.main-panel .content {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== SECTION SPACING ===== */
|
||||||
|
.section {
|
||||||
|
margin-bottom: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== CARD BODY LEBIH KONSISTEN ===== */
|
||||||
|
.card-body {
|
||||||
|
padding: 20px 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== STAT CARD ===== */
|
||||||
|
.card .small {
|
||||||
|
font-size: 12.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== CARD ===== */
|
||||||
|
.card {
|
||||||
|
border-radius: 14px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
padding: 1.25rem 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== TABLE ===== */
|
||||||
|
.table thead th {
|
||||||
|
background: #f4f6f8;
|
||||||
|
color: #4a5568;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 13px;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table tbody td {
|
||||||
|
vertical-align: middle;
|
||||||
|
padding: 14px;
|
||||||
|
color: #2d3748;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table tbody tr:hover {
|
||||||
|
background-color: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== BADGE ===== */
|
||||||
|
.badge-divisi {
|
||||||
|
background: #edf2f7;
|
||||||
|
color: #2f855a;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== BUTTON ===== */
|
||||||
|
.btn {
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-action {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
padding: 0;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== FILTER ===== */
|
||||||
|
.filter-bar select,
|
||||||
|
.filter-bar button {
|
||||||
|
height: 38px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== PAGINATION ===== */
|
||||||
|
.pagination .page-link {
|
||||||
|
border-radius: 8px;
|
||||||
|
margin: 0 3px;
|
||||||
|
color: #4a5568;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination .active .page-link {
|
||||||
|
background: #2f855a;
|
||||||
|
border-color: #2f855a;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
/* ===== MODAL CLEAN MODERN ===== */
|
||||||
|
.modal-content {
|
||||||
|
border-radius: 12px;
|
||||||
|
border: none;
|
||||||
|
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
|
||||||
|
animation: modalFade 0.25s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes modalFade {
|
||||||
|
from {
|
||||||
|
transform: translateY(15px);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: translateY(0);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== HEADER ===== */
|
||||||
|
.modal-header-clean {
|
||||||
|
background: #ffffff;
|
||||||
|
border-bottom: 1px solid #e5e7eb;
|
||||||
|
padding: 1rem 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header-clean .modal-title {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1f2937;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header-clean .close {
|
||||||
|
color: #6b7280;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== BODY ===== */
|
||||||
|
.modal-body {
|
||||||
|
padding: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body .form-group {
|
||||||
|
margin-bottom: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body label {
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #374151;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body .form-control {
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== FOOTER ===== */
|
||||||
|
.modal-footer {
|
||||||
|
border-top: 1px solid #e5e7eb;
|
||||||
|
padding: 0.75rem 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== ICON ACCENT ===== */
|
||||||
|
.modal-title i {
|
||||||
|
margin-right: 6px;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== SIZE CONTROL ===== */
|
||||||
|
.modal-md {
|
||||||
|
max-width: 560px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-sm {
|
||||||
|
max-width: 420px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== FIX CLOSE BUTTON (ICON X) ===== */
|
||||||
|
.modal-header-clean .close {
|
||||||
|
color: #6b7280;
|
||||||
|
/* abu gelap (elegan & terlihat) */
|
||||||
|
opacity: 1;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
line-height: 1;
|
||||||
|
text-shadow: none;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header-clean .close:hover {
|
||||||
|
color: #111827;
|
||||||
|
/* lebih gelap saat hover */
|
||||||
|
transform: rotate(90deg);
|
||||||
|
/* efek halus modern */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hilangkan outline saat fokus */
|
||||||
|
.modal-header-clean .close:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== RESPONSIVE MOBILE ===== */
|
||||||
|
@media (max-width: 576px) {
|
||||||
|
.modal-dialog {
|
||||||
|
margin: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-md,
|
||||||
|
.modal-sm {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== RESPONSIVE ===== */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.auth-left {
|
||||||
|
display: none;
|
||||||
|
padding-right: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.auth-right {
|
||||||
|
padding-left: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== FORCE CHECKBOX TAMPIL (READY DASHBOARD FIX) ===== */
|
||||||
|
input[type="checkbox"] {
|
||||||
|
appearance: auto !important;
|
||||||
|
-webkit-appearance: checkbox !important;
|
||||||
|
-moz-appearance: checkbox !important;
|
||||||
|
opacity: 1 !important;
|
||||||
|
position: static !important;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
margin-right: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sidebar full tinggi layar */
|
||||||
|
.sidebar {
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wrapper sidebar jadi kolom */
|
||||||
|
.sidebar-wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nav isi penuh tinggi sidebar */
|
||||||
|
.sidebar-wrapper .nav {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
|
/* INI KUNCI UTAMA */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== SIDEBAR LOGOUT FIX ===== */
|
||||||
|
|
||||||
|
/* ===== SIDEBAR LOGOUT (KONSISTEN MENU) ===== */
|
||||||
|
.sidebar .nav .nav-item-logout>a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px 25px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #ff6b6b !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* icon sejajar */
|
||||||
|
.sidebar .nav .nav-item-logout i {
|
||||||
|
font-size: 18px;
|
||||||
|
margin-right: 15px;
|
||||||
|
width: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* text sejajar menu lain */
|
||||||
|
.sidebar .nav .nav-item-logout p {
|
||||||
|
margin: 0;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* hover */
|
||||||
|
.sidebar .nav .nav-item-logout>a:hover {
|
||||||
|
background: rgba(255, 107, 107, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* dorong logout ke bawah */
|
||||||
|
.nav-item-logout {
|
||||||
|
margin-top: auto;
|
||||||
|
border-top: 1px solid rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Logout tetap di bawah */
|
||||||
|
.nav-item-logout {
|
||||||
|
margin-top: auto;
|
||||||
|
border-top: 1px solid rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Logout dipaksa ke paling bawah */
|
||||||
|
/* .nav-item-logout {
|
||||||
|
margin-top: auto;
|
||||||
|
border-top: 1px solid rgba(255, 255, 255, 0.15);
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* Warna & hover logout */
|
||||||
|
/* .nav-item-logout a {
|
||||||
|
color: #ff6b6b !important;
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* .nav-item-logout a:hover {
|
||||||
|
background: rgba(255, 107, 107, 0.12) !important;
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* Logout terdorong ke bawah */
|
||||||
|
/* .nav-logout {
|
||||||
|
margin-top: 20px;
|
||||||
|
border-top: 1px solid rgba(255, 255, 255, .1);
|
||||||
|
} */
|
||||||
|
/* paksa hamburger selalu tampil */
|
||||||
|
/* .logo-header .navbar-toggler {
|
||||||
|
display: inline-block !important;
|
||||||
|
opacity: 1 !important;
|
||||||
|
visibility: visible !important;
|
||||||
|
} */
|
||||||
|
.nav-collapse {
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-collapse .sub-item {
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*KERAPIAN TABEL*/
|
||||||
|
/* .table-fixed {
|
||||||
|
table-layout: fixed;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.table td,
|
||||||
|
.table th {
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table td:nth-child(3) {
|
||||||
|
/* Nama Barang */
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* =========================================
|
||||||
|
FILTER FIX HEIGHT & TEXT
|
||||||
|
========================================= */
|
||||||
|
|
||||||
|
#formFilter .form-control {
|
||||||
|
height: 38px !important;
|
||||||
|
padding: 6px 12px !important;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#formFilter select.form-control {
|
||||||
|
height: 38px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#formFilter .btn {
|
||||||
|
height: 38px;
|
||||||
|
padding: 0 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Biar teks jelas */
|
||||||
|
#formFilter .form-control,
|
||||||
|
#formFilter select {
|
||||||
|
color: #1f2937 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== DASHBOARD LOGO FIX ===== */
|
||||||
|
.dashboard-logo {
|
||||||
|
height: 52px;
|
||||||
|
/* lebih besar & jelas */
|
||||||
|
width: auto;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Desktop besar */
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
.dashboard-logo {
|
||||||
|
height: 56px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.dashboard-logo {
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* .table-standard {
|
||||||
|
table-layout: fixed;
|
||||||
|
} */
|
||||||
|
/* ============================
|
||||||
|
OPERASIONAL PAGE
|
||||||
|
============================ */
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
|
||||||
|
.operasional-page table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operasional-page th,
|
||||||
|
.operasional-page td {
|
||||||
|
vertical-align: middle;
|
||||||
|
padding: 14px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-no {
|
||||||
|
width: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-tanggal {
|
||||||
|
width: 15%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-nama {
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-jenis {
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-jumlah {
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-satuan {
|
||||||
|
width: 8%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-harga {
|
||||||
|
width: 12%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-total {
|
||||||
|
width: 13%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-aksi {
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
|
||||||
|
.operasional-page th,
|
||||||
|
.operasional-page td {
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 10px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operasional-page .table-responsive {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.operasional-page tbody tr:hover {
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
}
|
||||||
|
.operasional-page table {
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operasional-page thead th {
|
||||||
|
font-size: 13px;
|
||||||
|
letter-spacing: .5px;
|
||||||
|
background: #f8f9fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
.update-pro{
|
||||||
|
margin: 15px 25px;}
|
||||||
|
|
||||||
|
.update-pro button {
|
||||||
|
padding: 13px 25px;
|
||||||
|
background: #4d7cfe;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 3px;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
border: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-pro button:hover {
|
||||||
|
background: #4d7cfe !important;
|
||||||
|
color: #fff;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
transition: all .2s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-pro:hover button:before{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-pro button p, .update-pro button i{
|
||||||
|
color: #fff !important;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-pro button i{
|
||||||
|
margin-right: 5px !important;
|
||||||
|
font-size: 23px;
|
||||||
|
color: #C3C5CA;
|
||||||
|
margin-right: 15px;
|
||||||
|
width: 25px;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo .btn, .demo .progress{
|
||||||
|
margin-bottom: 15px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo .form-check-label, .demo .form-radio-label{
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo #slider{
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-typo tbody > tr > td{
|
||||||
|
border-color: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-typo tbody > tr > td:first-child{
|
||||||
|
min-width: 200px;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-typo tbody > tr > td:first-child p{
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-icon {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding: 10px;
|
||||||
|
transition: all .2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-icon:hover{
|
||||||
|
background-color: #f4f5f8;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-icon .icon-preview{
|
||||||
|
font-size: 1.8rem;
|
||||||
|
margin-right: 10px;
|
||||||
|
line-height: 1;
|
||||||
|
color: #333439;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-icon .icon-class{
|
||||||
|
font-weight: 300;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
|
||||||
|
.from-show-notify .form-control{
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.from-show-notify label{
|
||||||
|
padding-top: 0.65rem;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue