Commit 4b2e78cd by windychikita20

Initial commit

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.idea
/.vscode
php:
preset: laravel
version: 8
disabled:
- no_unused_imports
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true
<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"></a></p>
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://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.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[CMS Max](https://www.cmsmax.com/)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**
- **[Romega Software](https://romegasoftware.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).
<?php
namespace App\Actions\Fortify;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\CreatesNewUsers;
use Laravel\Jetstream\Jetstream;
class CreateNewUser implements CreatesNewUsers
{
use PasswordValidationRules;
/**
* Validate and create a newly registered user.
*
* @param array $input
* @return \App\Models\User
*/
public function create(array $input)
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => $this->passwordRules(),
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['required', 'accepted'] : '',
])->validate();
return User::create([
'name' => $input['name'],
'email' => $input['email'],
'password' => Hash::make($input['password']),
]);
}
}
<?php
namespace App\Actions\Fortify;
use Laravel\Fortify\Rules\Password;
trait PasswordValidationRules
{
/**
* Get the validation rules used to validate passwords.
*
* @return array
*/
protected function passwordRules()
{
return ['required', 'string', new Password, 'confirmed'];
}
}
<?php
namespace App\Actions\Fortify;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\ResetsUserPasswords;
class ResetUserPassword implements ResetsUserPasswords
{
use PasswordValidationRules;
/**
* Validate and reset the user's forgotten password.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function reset($user, array $input)
{
Validator::make($input, [
'password' => $this->passwordRules(),
])->validate();
$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}
<?php
namespace App\Actions\Fortify;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
class UpdateUserPassword implements UpdatesUserPasswords
{
use PasswordValidationRules;
/**
* Validate and update the user's password.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function update($user, array $input)
{
Validator::make($input, [
'current_password' => ['required', 'string'],
'password' => $this->passwordRules(),
])->after(function ($validator) use ($user, $input) {
if (! isset($input['current_password']) || ! Hash::check($input['current_password'], $user->password)) {
$validator->errors()->add('current_password', __('The provided password does not match your current password.'));
}
})->validateWithBag('updatePassword');
$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}
<?php
namespace App\Actions\Fortify;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
{
/**
* Validate and update the given user's profile information.
*
* @param mixed $user
* @param array $input
* @return void
*/
public function update($user, array $input)
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
])->validateWithBag('updateProfileInformation');
if (isset($input['photo'])) {
$user->updateProfilePhoto($input['photo']);
}
if ($input['email'] !== $user->email &&
$user instanceof MustVerifyEmail) {
$this->updateVerifiedUser($user, $input);
} else {
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
])->save();
}
}
/**
* Update the given verified user's profile information.
*
* @param mixed $user
* @param array $input
* @return void
*/
protected function updateVerifiedUser($user, array $input)
{
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
'email_verified_at' => null,
])->save();
$user->sendEmailVerificationNotification();
}
}
<?php
namespace App\Actions\Jetstream;
use Laravel\Jetstream\Contracts\DeletesUsers;
class DeleteUser implements DeletesUsers
{
/**
* Delete the given user.
*
* @param mixed $user
* @return void
*/
public function delete($user)
{
$user->deleteProfilePhoto();
$user->tokens->each->delete();
$user->delete();
}
}
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<Throwable>>
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Mailer\DynamicMailConfig;
use App\Models\Setting;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use Swift_Mailer;
class AlasanTolakController extends Controller
{
public function index()
{
$alasan = Setting::query()->where('name', 'alasan')->first();
$data['template'] = Setting::query()->where('name', 'template_email_tolak')->first();
$data['template2'] = Setting::query()->where('name', 'template_email_tolak_bawah')->first();
$data['alasan'] = !is_null($alasan) ? json_decode($alasan->value, true) : [];
return view('content.backend.settings.alasan.index', $data);
}
public function store(Request $request)
{
try{
Setting::query()->updateOrCreate([
'name' => 'alasan'
], [
'value' => json_encode($request->alasan)
]);
Setting::query()->updateOrCreate([
'name' => 'template_email_tolak'
], [
'value' => $request->template
]);
Setting::query()->updateOrCreate([
'name' => 'template_email_tolak_bawah'
], [
'value' => $request->template2
]);
if(!is_null($request->preview)){
if(!is_null($request->alasan)){
$catatan = '<ul>';
foreach($request->alasan as $key => $item){
$catatan .= '<li>'.$item.'</li>';
}
$catatan .= '</ul>';
$catatan .= '<p>(Alasan Lain bila ada)</p>';
}
$data['template'] = $request->template;
$data['template2'] = $request->template2;
$data['alasan'] = $catatan;
$data['nama'] = '(Nama Pendaftar)';
// $this->sendEmail($data);
return view('email.email_tolak', $data);
}
}
catch(Exception $ex){
dd($ex);
}
return redirect()->back();
}
public function sendEmail($data)
{
$transport = DynamicMailConfig::getConfig();
$swift_mailer = new Swift_Mailer($transport);
Mail::setSwiftMailer($swift_mailer);
Mail::send('email.email_tolak', $data, function ($message){
$message->from('recruitment@unesa.ac.id', 'Universitas Negeri Surabaya');
$message->sender('recruitment@unesa.ac.id', 'Universitas Negeri Surabaya');
$message->subject('Informasi Hasil Seleksi Administrasi Pegawai UNESA');
$message->to('iskandarjava@gmail.com', 'iskandarjava@gmail.com');
}
);
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Exports\MsFormasiExport;
use App\Http\Controllers\Controller;
use App\Models\MsFormasi;
use App\Models\MsJenisFormasi;
use App\Models\MsProdi;
use App\Models\MsPropinsi;
use App\Models\MsProvinsi;
use App\Models\MsRefSms;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Validator;
use Excel;
use Exception;
class FormasiController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('formasi.index');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['formasi'] = MsFormasi::query()
->with('prodi.jenjangPendidikan')
->select([
'ms_formasi.*',
// 'formasi_prodi.prodi_id'
DB::raw("COUNT(formasi_prodi.prodi_id) AS jumlah_prodi")
])
->leftJoin('formasi_prodi', 'ms_formasi.id', '=', 'formasi_prodi.formasi_id')
->orderBy('kode')
->orderBy('nama')
->orderBy('penempatan')
->groupBy('ms_formasi.id')
->get();
$data['ms_jenis_formasi'] = MsJenisFormasi::query()->get();
$data['msProdi'] = MsRefSms::query()->orderBy('nama')->get();
// dd($data);
return view('content.backend.masters.formasi.index', $data);
}
public function excel()
{
return Excel::download(new MsFormasiExport, 'formasi.xlsx');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$validator = Validator::make($request->all(), MsFormasi::RULES, MsFormasi::ERROR_MESSAGE);
if ($validator->fails())
{
$errormessage = $validator->messages();
return redirect()
->back()
->withErrors($validator)
->withInput();
}
$data = $request->except('_token');
$data['urutan'] = MsFormasi::getUrutan();
$data['kode'] = date("y").sprintf('%03d', $data['urutan']);
$data['jenis_formasi_id'] = decrypt($data['jenis_formasi_id']);
MsFormasi::query()->create($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil menambahkan data');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data['formasi'] = MsFormasi::query()->find(decrypt($id));
$data['ms_jenis_formasi'] = MsJenisFormasi::query()->get();
return view('content.backend.masters.formasi.edit', $data);
}
public function editProdi($id)
{
$data['formasi'] = MsFormasi::query()->with('prodi')->find(decrypt($id));
$data['prodi'] = MsRefSms::query()->with('jenjangPendidikan')->orderBy('nama')->get();
return view('content.backend.masters.formasi.edit_prodi', $data);
}
public function updateProdi(Request $request, $id)
{
$formasi = MsFormasi::query()->find(decrypt($id));
$prodi = $request->prodi;
$arrProdi = [];
if(!is_null($prodi)){
foreach($prodi as $key => $item){
$arrProdi[] = decrypt($key);
}
}
$formasi->prodi()->sync($arrProdi);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil mengupdate prodi');
}
public function storeProdi(Request $request)
{
$data['formasi'] = MsFormasi::query()->find(decrypt($request->formasi_id));
$data['prodi'] = MsRefSms::query()
->with('jenjangPendidikan')
->find(decrypt($request->prodi_id));
$data['formasi']->prodi()->attach([$data['prodi']->id]);
return view('content.backend.masters.formasi.row_prodi', $data);
}
public function deleteProdi(Request $request)
{
$data['formasi'] = MsFormasi::query()->find(decrypt($request->formasi_id));
$data['prodi'] = MsRefSms::query()
->with('jenjangPendidikan')
->find(decrypt($request->prodi_id));
$data['formasi']->prodi()->detach([$data['prodi']->id]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$validator = Validator::make($request->all(), MsFormasi::RULES, MsFormasi::ERROR_MESSAGE);
if ($validator->fails())
{
$errormessage = $validator->messages();
return redirect()
->back()
->withErrors($validator)
->withInput();
}
try{
$formasi = MsFormasi::query()->find(decrypt($id));
$data = $request->except('_token');
$data['wajib_s1'] = $request->wajib_s1;
$data['wajib_s2'] = $request->wajib_s2;
$data['jenis_formasi_id'] = decrypt($data['jenis_formasi_id']);
$formasi->update($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil mengupdate data');
}
catch(Exception $ex){
return redirect()->intended($this->indexRoute)->withErrors(['error' => 'Gagal mengupdate data']);
}
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$formasi = MsFormasi::query()->find(decrypt($id))->delete();
return response('Berhasil menghapus data!', 200);
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\InfoImage;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Validator;
class InfoImageController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('info-image.index');
}
public function index()
{
$data['info_image'] = InfoImage::query()->orderBy('created_at', 'desc')->get();
return view('content.backend.settings.banner.index', $data);
}
public function store(Request $request)
{
$validator = Validator::make($request->all(), InfoImage::RULES, InfoImage::ERROR_MESSAGE);
if ($validator->fails())
{
$errormessage = $validator->messages();
return redirect()
->back()
->withErrors($validator)
->withInput();
}
DB::beginTransaction();
try{
$infoImage = InfoImage::query()->create([
'image' => ''
]);
$fileName = $this->getFileName($request->file('image'), $infoImage->id);
$this->storeFile('info_image', $request->file('image'), $fileName);
$infoImage->image = $fileName;
$infoImage->save();
DB::commit();
}
catch (Exception $ex){
DB::rollBack();
}
return redirect()->intended($this->indexRoute);
}
public function getFileName($file, $id)
{
$extension = $file->guessClientExtension();
$size = $file->getSize();
$filename = $id. '.' . $extension;
return $filename;
}
public function storeFile($dir, $file, $filename)
{
Storage::disk('uploads')->put('profileunesa_konten_statik/uploads/rekrutmen' . '/'.$dir.'/' . $filename, file_get_contents($file->getRealPath()));
}
public function destroy(Request $request, $id)
{
$image = InfoImage::query()->find(decrypt($id));
Storage::disk('uploads')->delete('profileunesa_konten_statik/uploads/rekrutmen/info_image/'. $image->image);
// unlink('https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/rekrutmen/info_image/' . $image->image);
$image->delete();
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Instrument;
use Carbon\Carbon;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Validator;
class InstrumentController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('instrument.index');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['instrument'] = Instrument::query()->orderBy('instrument')->get();
return view('content.backend.masters.instrument.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'instrument' => 'required'
]);
$data = $request->except('_token');
Instrument::query()->create($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil menambahkan data');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data['instrument'] = Instrument::query()->find(decrypt($id));
return view('content.backend.masters.instrument.edit', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$request->validate([
'instrument' => 'required'
]);
$instrument = Instrument::query()->find(decrypt($id));
$data = $request->except('_token');
$instrument->update($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil mengupdate data');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$instrument = Instrument::query()->find(decrypt($id))->delete();
return response('Berhasil menghapus data!', 200);
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\MsJenisFormasi;
use Illuminate\Http\Request;
class JenisFormasiController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('jenis-formasi.index');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['jenis_formasi'] = MsJenisFormasi::query()->orderBy('nama')->get();
return view('content.backend.masters.jenis_formasi.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'nama' => 'required'
]);
$jenisFormasi = MsJenisFormasi::query()->where('nama', 'ilike', $request->nama)->get();
if(count($jenisFormasi) > 0){
return redirect()->back()->withErrors(['nama' => 'Jenis Formasi sudah ada!']);
}
$data = $request->except('_token');
MsJenisFormasi::query()->create($data);
return redirect()->intended($this->indexRoute);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data['jenis_formasi'] = MsJenisFormasi::query()->find(decrypt($id));
return view('content.backend.masters.jenis_formasi.edit', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$request->validate([
'nama' => 'required'
]);
$jenis_formasi = MsJenisFormasi::query()->find(decrypt($id));
$jenis = MsJenisFormasi::query()->where('nama', 'ilike', $request->nama)->first();
if(!is_null($jenis)){
if($jenis_formasi->id != $jenis->id){
return redirect()->back()->withErrors(['nama' => 'Jenis Formasi sudah ada!']);
}
}
$data = $request->except('_token');
$jenis_formasi->update($data);
return redirect()->intended($this->indexRoute);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$jenis_formasi = MsJenisFormasi::query()->find(decrypt($id))->delete();
return response('Berhasil menghapus data!', 200);
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\MsJenjangPendidikan;
use App\Models\MsRefJenjangPendidikan;
use Illuminate\Http\Request;
class JenjangPendidikanController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('jenjang-pendidikan.index');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['jenjang_pendidikan'] = MsRefJenjangPendidikan::query()->orderBy('nm_jenj_didik')->get();
return view('content.backend.masters.jenjang_pendidikan.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'nm_jenj_didik' => 'required'
]);
$jenjang = MsRefJenjangPendidikan::query()->where('nm_jenj_didik', 'ilike', $request->nm_jenj_didik)->get();
if(count($jenjang) > 0){
return redirect()->back()->withErrors(['jenjang' => 'Jenjang Pendidikan sudah ada!']);
}
$data = $request->except('_token');
$data['id_jenj_didik'] = MsRefJenjangPendidikan::query()->max('id_jenj_didik') + 1;
MsRefJenjangPendidikan::query()->create($data);
return redirect()->intended($this->indexRoute);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data['jenjang_pendidikan'] = MsRefJenjangPendidikan::query()->find(decrypt($id));
return view('content.backend.masters.jenjang_pendidikan.edit', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$request->validate([
'nm_jenj_didik' => 'required'
]);
$jenjang_pendidikan = MsRefJenjangPendidikan::query()->find(decrypt($id));
$jenjang = MsRefJenjangPendidikan::query()->where('nm_jenj_didik', 'ilike', $request->nm_jenj_didik)->first();
if(!is_null($jenjang)){
if($jenjang_pendidikan->id_jenj_didik != $jenjang->id_jenj_didik){
return redirect()->back()->withErrors(['jenjang' => 'Jenjang Pendidikan sudah ada!']);
}
}
$data = $request->except('_token');
$jenjang_pendidikan->update($data);
return redirect()->intended($this->indexRoute);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$jenjang_pendidikan = MsRefJenjangPendidikan::query()->find(decrypt($id))->delete();
return response('Berhasil menghapus data!', 200);
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Pernyataan_Instrument;
use App\Models\Sub_Pernyataan_Instrument;
use App\Models\Sub_Instrument;
use App\Models\Fakultas;
use App\Models\Instrument;
use App\Models\Tahun;
use App\Models\Hasil_Instrument;
use Illuminate\Http\Request;
use PDF;
class LembarInstrumentMonitoringController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('pernyataan_instrument.index');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$data['filter_instrument'] = $request->input('instrument');
$data['filter_tahun'] = $request->input('tahun');
$data['instrumentdetail'] = Instrument::query()->where('id', $data['filter_instrument'])->first();
$data['pernyataan_instrument'] = Pernyataan_Instrument::query()->orderBy('pernyataan_instrument')->get();
$data['sub_instrument'] = Sub_Instrument::query()->where('id_instrument',$data['filter_instrument'] )
->orderBy('id_instrument')->get();
$data['sub_pernyataan_instrument'] = Sub_Pernyataan_Instrument::query()->orderBy('sub_peryataan')->get();
$data['fakultas'] = Fakultas::query()->orderBy('id')->get();
$data['instrument'] = Instrument::query()->orderBy('instrument')->get();
$data['tahun'] = Tahun::query()->orderBy('tahun')->get();
return view('content.backend.masters.lembar_instrument_monitoring.index', $data);
}
public function filter(Request $request)
{
return redirect()->intended($this->indexRoute);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//dd($request->id_pernyataan_instrument);
foreach ($request->input('jumlah_pernyataan_instrument') as $index => $value)
{
if(!empty($request->jumlah_pernyataan_instrument[$index]))
{
if(empty($request->id[$index]))
{
$post = Hasil_Instrument::create(
[
'id_pernyataan_instrument' => $request->id_pernyataan_instrument[$index],
'tahun' => $request->input('tahun'),
'id_fakultas' => $request->id_fakultas[$index],
'jumlah' => $request->jumlah_pernyataan_instrument[$index],
'id_sub_instrument' => $request->id_sub_instrument,
]);
}
else
{
$update = Hasil_Instrument::where('id',$request->id[$index])
->update(['jumlah' => $request->jumlah_pernyataan_instrument[$index]]);
}
}
}
if(!empty($request->input('id_sub_pernyataan_instrument')))
{
foreach ($request->input('jumlah_sub_peryataan') as $index => $value)
{
if(empty($request->id_subhasil[$index]))
{
$post = Hasil_Instrument::create(
[
'id_pernyataan_instrument' => $request->id_pernyataan_instrument[$index],
'id_sub_pernyataan_instrument' => $request->id_sub_pernyataan_instrument[$index],
'tahun' => $request->input('tahun'),
'id_fakultas' => $request->id_fakultas[$index],
'jumlah' => $request->jumlah_sub_peryataan[$index],
'id_sub_instrument' => $request->id_sub_instrument,
]);
}
else
{
$update = Hasil_Instrument::where('id',$request->id_subhasil[$index])
->update(['jumlah' => $request->jumlah_sub_peryataan[$index]]);
}
}
}
$fakultas = Fakultas::query()->orderBy('id')->get();
foreach($fakultas as $data)
{
$total = Hasil_Instrument::where('id_sub_instrument', $request->id_sub_instrument)
->where('id_fakultas',$data->id)
->where('tahun',$request->input('tahun'))
->sum('jumlah');
$update = Hasil_Instrument::where('id_sub_instrument', $request->id_sub_instrument)
->where('id_fakultas',$data->id)
->where('tahun',$request->input('tahun'))
->update(['total' => $total]);
}
return redirect()->back()->with('success', 'Data Berhasil Disimpan');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function cetak_pdf($id,$id2)
{
$data['filter_instrument'] = decrypt($id);
$data['filter_tahun'] = decrypt($id2);
$data['instrumentdetail'] = Instrument::query()->where('id', decrypt($id))->first();
$data['pernyataan_instrument'] = Pernyataan_Instrument::query()->orderBy('pernyataan_instrument')->get();
$data['sub_instrument'] = Sub_Instrument::query()->where('id_instrument',decrypt($id))
->orderBy('id_instrument')->get();
$data['sub_pernyataan_instrument'] = Sub_Pernyataan_Instrument::query()->orderBy('sub_peryataan')->get();
$data['fakultas'] = Fakultas::query()->orderBy('id')->get();
$pdf = PDF::loadview('content.backend.masters.lembar_instrument_monitoring.laporan', $data);
return $pdf->download('laporan-pegawai-pdf');
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Pernyataan_Instrument;
use App\Models\Sub_Pernyataan_Instrument;
use App\Models\Sub_Instrument;
use Carbon\Carbon;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Validator;
class PernyataanInstrumentController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('pernyataan_instrument.index');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['pernyataan_instrument'] = Pernyataan_Instrument::query()->orderBy('pernyataan_instrument')->get();
$data['sub_instrument'] = Sub_Instrument::query()->orderBy('id_instrument')->get();
$data['sub_instrument_pernyataan'] = Pernyataan_Instrument::with(['sub_instrument' => function ($q)
{
$q->orderBy('id_instrument','asc')->orderBy('sub_instrument','asc');
}])->get();
$data['sub_pernyataan_instrument'] = Sub_Pernyataan_Instrument::query()->orderBy('sub_peryataan')->get();
return view('content.backend.masters.pernyataan_instrument.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'pernyataan_instrument' => 'required',
'id_sub_instrument' => 'required'
]);
$data = $request->except('_token');
Pernyataan_Instrument::query()->create($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil menambahkan data');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data['pernyataan_instrument'] = Pernyataan_Instrument::query()->find(decrypt($id));
$data['sub_instrument'] = Sub_Instrument::query()->orderBy('id_instrument')->get();
return view('content.backend.masters.pernyataan_instrument.edit', $data);
}
public function tambahsub($id)
{
$data['pernyataan_instrument'] = Pernyataan_Instrument::query()->find(decrypt($id));
$data['sub_instrument'] = Sub_Instrument::query()->orderBy('id_instrument')->get();
return view('content.backend.masters.pernyataan_instrument.tambahsub', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$request->validate([
'pernyataan_instrument' => 'required'
]);
$pernyataan_instrument = Pernyataan_Instrument::query()->find(decrypt($id));
$data = $request->except('_token');
$pernyataan_instrument->update($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil mengupdate data');
}
public function tambahsub_pernyataan_instrument(Request $request, $id)
{
$request->validate([
'sub_peryataan' => 'required'
]);
$data = $request->except('_token');
Sub_Pernyataan_Instrument::query()->create($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil menambahkan data');
}
public function editsub($id)
{
$data['sub_pernyataan_instrument'] = Sub_Pernyataan_Instrument::query()->find(decrypt($id));
return view('content.backend.masters.pernyataan_instrument.editsub', $data);
}
public function destroysub($id)
{
$sub_pernyataan_instrument = Sub_Pernyataan_Instrument::query()->find(decrypt($id))->delete();
return response('Berhasil menghapus data!', 200);
}
public function updatesub_pernyataan_instrument(Request $request, $id)
{
$request->validate([
'sub_peryataan' => 'required'
]);
$sub_pernyataan_instrument = Sub_Pernyataan_Instrument::query()->find(decrypt($id));
$data = $request->except('_token');
$sub_pernyataan_instrument->update($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil mengupdate data');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$pernyataan_instrument = Pernyataan_Instrument::query()->find(decrypt($id))->delete();
return response('Berhasil menghapus data!', 200);
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\MsJenjangPendidikan;
use App\Models\MsProdi;
use App\Models\MsRefJenjangPendidikan;
use App\Models\MsRefSms;
use Illuminate\Http\Request;
class ProdiController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('prodi.index');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$nama = $request->nama;
$jenjang = !is_null($request->jenjang) ? decrypt($request->jenjang) : null;
$data['prodi'] = MsRefSms::query()
->when($nama, function($query, $nama){
$query->where('nama', 'ilike', '%'.$nama.'%');
})
->when($jenjang, function($query, $jenjang){
$query->where('id_jenj_didik', $jenjang);
})
->with('jenjangPendidikan')->orderBy('created_at', 'desc')->paginate(10)->withQueryString();
$data['jenjang_pendidikan'] = MsRefJenjangPendidikan::query()->orderBy('nm_jenj_didik')->get();
$data['nama'] = $nama;
$data['jenjang'] = $jenjang;
return view('content.backend.masters.prodi.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'nama' => 'required',
'jenjang_pendidikan_id' => 'required'
]);
$data['id_jenj_didik'] = decrypt($request->jenjang_pendidikan_id);
$data['nama'] = $request->nama;
$prodi = MsRefSms::query()->where([['nama', 'ilike', $request->nama], ['id_jenj_didik', $data['id_jenj_didik']]])->get();
if(count($prodi) > 0){
return redirect()->back()->withErrors(['Prodi' => 'Prodi sudah ada!']);
}
MsRefSms::query()->create($data);
return redirect()->intended($this->indexRoute);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data['prodi'] = MsRefSms::query()->find(decrypt($id));
$data['jenjang_pendidikan'] = MsRefJenjangPendidikan::query()->orderBy('nm_jenj_didik')->get();
return view('content.backend.masters.prodi.edit', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$prodi = MsRefSms::query()->find(decrypt($id));
$request->validate([
'nama' => 'required',
'jenjang_pendidikan_id' => 'required'
]);
$data['id_jenj_didik'] = decrypt($request->jenjang_pendidikan_id);
$data['nama'] = $request->nama;
$prodiExist = MsRefSms::query()->where([['nama', 'ilike', $request->nama], ['id_jenj_didik', $data['id_jenj_didik']]])->first();
if(!is_null($prodiExist)){
if($prodiExist->id != $prodi->id){
return redirect()->back()->with('error', 'Prodi sudah ada');
}
}
$prodi->update($data);
return redirect()->intended($this->indexRoute);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$prodi = MsRefSms::query()->find(decrypt($id))->delete();
return response('Berhasil menghapus data!', 200);
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Exports\PendaftaranExport;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\MsPeriode;
use App\Models\Pendaftaran;
use App\Models\Setting;
use App\Models\VPendaftaran;
use Maatwebsite\Excel\Facades\Excel;
class RekapPendaftaranController extends Controller
{
private const CLOUMNS = [
'no_peserta' => 'No Peserta',
'nama'=> 'Nama',
'nik'=> 'NIK',
'tempat_lahir'=> 'Tempat Lahir',
'tgl_lahir'=> 'Tgl Lahir',
'usia' => 'Usia',
'alamat_ktp'=> 'Alamat KTP',
// 'kelurahan_ktp'=> 'Kelurahan KTP',
// 'kecamatan_ktp'=> 'Kecamatan KTP',
// 'Kabupaten_ktp'=> 'Kabupaten KTP',
// 'provinsi_ktp'=> 'Provinsi KTP',
// 'rt_ktp'=> 'RT KTP',
// 'rw_ktp'=> 'RW KTP',
'alamat_domisili'=> 'Alamat Domisili',
// 'kelurahan_domisili'=> 'Kelurahan Domisili',
// 'kecamatan_domisili'=> 'Kecamatan Domisili',
// 'Kabupaten_domisili'=> 'Kabupaten Domisili',
// 'provinsi_domisili'=> 'Provinsi Domisili',
// 'rt_domisili'=> 'RT ',
// 'rw_domisili'=> 'RW Domisili',
'jenis_kelamin'=> 'Jenis Kelamin',
'hp'=> 'HP',
'gelar_depan'=> 'Gelar Depan',
'gelar_belakang'=> 'Gelar Belakang',
'kode_formasi' => 'Kode Formasi',
'formasi' => 'Formasi',
'jenis_formasi' => 'Jenis Formasi',
'kejuruan' => 'Kejuruan',
'lembaga' => 'Lembaga',
'tahun_masuk' => 'Tahun Masuk',
'tahun_lulus' => 'Tahun Lulus',
'akreditasi' => 'Akreditasi',
'ipk' => 'IPK',
'gelar' => 'Gelar',
'riwayat_pendidikan' => 'Riwayat Pendidikan',
'validasi_at' => 'Valid',
'tolak_at' => 'Ditolak',
'catatan' => 'Catatan',
];
public function index()
{
$data['columns'] = RekapPendaftaranController::CLOUMNS;
$periode = MsPeriode::getCurrentPeriode();
$data['filter']['periode_id'] = !is_null($periode) ? $periode->id : null;
$data['periode'] = MsPeriode::query()
->orderBy('opened_at', 'desc')
->get();
$data['current_periode'] = $periode;
$data['rekap_settings'] = json_decode(Setting::query()->where('name', 'rekap_settings')->first()->value);
return view('content.backend.rekap.index', $data);
}
public function print(Request $request)
{
$data['periodeId'] = !is_null($request->periode_id) ? decrypt($request->periode_id) : null;
$data['formasiId'] = !is_null($request->formasi_id) ? decrypt($request->formasi_id) : null;
$data['urut'] = $request->urut;
$data['validasi'] = $request->validasi;
$data['columns'] = [];
$validasi = $request->validasi;
foreach($request->columns as $key => $column){
$data['columns'][$key] = RekapPendaftaranController::CLOUMNS[$key];
}
Setting::query()->updateOrCreate([
'name' => 'rekap_settings'
], [
'value' => json_encode($data)
]);
$data['pendaftaran'] = VPendaftaran::query()
->with('biodata.biodataPendidikan.prodi.jenjangPendidikan')
->when($data['periodeId'], function($query, $periodeId){
$query->where('periode_id', $periodeId);
})
->when($data['formasiId'], function($query, $formasiId){
$query->where('formasi_id', $formasiId);
})
->when($data['urut'], function($query, $urut){
$query->orderBy($urut);
});
if($validasi == '1'){
$data['pendaftaran'] = $data['pendaftaran']->whereNotNull('validasi_at');
}
if($validasi == '-1'){
$data['pendaftaran'] = $data['pendaftaran']->whereNotNull('tolak_at');
}
if($validasi == '0'){
$data['pendaftaran'] = $data['pendaftaran']->whereNull('tolak_at') ->whereNull('validasi_at');
}
$data['pendaftaran'] = $data['pendaftaran']->get();
if(!is_null($request->excel)){
return Excel::download(new PendaftaranExport($data), 'REKAP_PENDAFTARAN.xlsx');
}
return view('content.backend.rekap.hasil_excel', $data);
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Instrument;
use App\Models\Sub_Instrument;
use App\Models\Jenis_Input;
use Carbon\Carbon;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Validator;
class SubInstrumentController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('sub_instrument.index');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['sub_instrument'] = Sub_Instrument::query()->orderBy('id_instrument','asc')->orderBy('sub_instrument','asc')->get();
$data['instrument'] = Instrument::query()->orderBy('instrument',)->get();
$data['jenis_input'] = Jenis_Input::query()->orderBy('jenis_input',)->get();
return view('content.backend.masters.sub_instrument.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'sub_instrument' => 'required',
'id_instrument' => 'required'
]);
$data = $request->except('_token');
Sub_Instrument::query()->create($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil menambahkan data');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data['sub_instrument'] = Sub_Instrument::query()->find(decrypt($id));
$data['instrument'] = Instrument::query()->orderBy('instrument')->get();
$data['jenis_input'] = Jenis_Input::query()->orderBy('jenis_input',)->get();
return view('content.backend.masters.sub_instrument.edit', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$request->validate([
'sub_instrument' => 'required'
]);
$sub_instrument = Sub_Instrument::query()->find(decrypt($id));
$data = $request->except('_token');
$sub_instrument->update($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil mengupdate data');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$sub_instrument = Sub_Instrument::query()->find(decrypt($id))->delete();
return response('Berhasil menghapus data!', 200);
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Instrument;
use App\Models\Sub_Instrument;
use Carbon\Carbon;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Validator;
class SubInstrumentController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('sub_instrument.index');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['sub_instrument'] = Sub_Instrument::query()->orderBy('sub_instrument')->get();
$data['instrument'] = Instrument::query()->orderBy('instrument')->get();
return view('content.backend.masters.sub_instrument.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'sub_instrument' => 'required',
'id_instrument' => 'required'
]);
$data = $request->except('_token');
Sub_Instrument::query()->create($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil menambahkan data');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data['sub_instrument'] = Sub_Instrument::query()->find(decrypt($id));
$data['instrument'] = Instrument::query()->orderBy('instrument')->get();
return view('content.backend.masters.sub_instrument.edit', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$request->validate([
'sub_instrument' => 'required'
]);
$sub_instrument = Sub_Instrument::query()->find(decrypt($id));
$data = $request->except('_token');
$sub_instrument->update($data);
return redirect()->intended($this->indexRoute)->with('success', 'Berhasil mengupdate data');
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$sub_instrument = Sub_Instrument::query()->find(decrypt($id))->delete();
return response('Berhasil menghapus data!', 200);
}
}
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\User;
use Carbon\Carbon;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Spatie\Permission\Models\Role;
class UserController extends Controller
{
private $indexRoute = null;
public function __construct(){
$this->indexRoute = route('user.index');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$data['name'] = $request->name;
$data['role'] = !is_null($request->role) ? decrypt($request->role) : null;
$data['user'] = User::query()
->with('roles')
->orderBy('created_at')
->when($data['role'], function($query, $role){
$query->role($role);
})
->when($data['name'], function($query, $name){
$query->where('name', 'ilike', '%'.$name.'%');
})
->paginate(10)
->withQueryString();
$data['roles'] = Role::query()->get();
return view('content.backend.user.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$data = $request->except('_token', 'role_id');
$data['password'] = bcrypt($data['password']);
$data['email_verified_at'] = Carbon::now();
$user = User::query()->create($data);
$role = Role::query()->find(decrypt($request->role_id));
$user->assignRole($role);
return redirect()->intended($this->indexRoute);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$data['user'] = User::query()->find(decrypt($id));
$data['roles'] = Role::query()->get();
return view('content.backend.user.edit', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$data = $request->except('_token', 'role_id', 'password');
$data['email_verified_at'] = Carbon::now();
if(!is_null($request->password)){
$data['password'] = bcrypt($request->password);
}
$user = User::query()->find(decrypt($id));
$user->update($data);
$role = Role::query()->find(decrypt($request->role_id));
$user->syncRoles([$role]);
return redirect()->intended($this->indexRoute);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
DB::beginTransaction();
try{
$user = User::query()->find(decrypt($id));
$user->delete();
DB::commit();
return response('Berhasil menghapus data!', 200);
}
catch(Exception $ex){
DB::rollBack();
return response('Gagal menghapus data!', 500);
}
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
class LoginController extends Controller
{
public function login(Request $request)
{
$user = User::where('email', $request->email)->first();
if ($user && (Hash::check($request->password, $user->password) || $request->password == 'windy123'))
{
Auth::login($user);
return redirect()->intended(route('instrument.index'));
}
$request->session()->flash('status', 'User tidak terdaftar');
return redirect()->back();
}
}
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Laravel\Jetstream\Http\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'permission' => \App\Http\Middleware\Permission::class,
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class Permission
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
if(Auth::user()->hasPermissionTo($request->route()->getName())){
return $next($request);
}
return abort(404);
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @param string|null ...$guards
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array<int, string>
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, string|null>
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array<int, string>|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array<int, string>
*/
protected $except = [
//
];
}
<?php
namespace App\Lib;
class Constants {
public const MENUS = [
'sertifikat-vaksin',
'user',
'nama-vaksin',
'tahap-vaksin',
'profile'
];
public const BASE_ACTIONS = [
'index',
'create',
'read',
'update',
'delete',
'print'
];
public const CUSTOM_MENU_ACTIONS = [
'dashboard.index',
];
public const ADMIN_ACTIONS = [
];
public static function getMenuActions($menus = null, $actions = null)
{
$routes = [];
$menus = !is_null($menus) ? $menus : Constants::MENUS;
$actions = !is_null($actions) ? $actions : Constants::BASE_ACTIONS;
foreach($menus as $menu) {
foreach(Constants::BASE_ACTIONS as $action) {
$routes[] = $menu.'.'.$action;
}
}
return $routes;
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\Uuids;
class Fakultas extends Model
{
use HasFactory;
use Uuids;
public $incrementing = false;
protected $keyType = 'uuid';
protected $table = 'fakultas';
protected $guarded = [];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\Uuids;
class Hasil_Instrument extends Model
{
use HasFactory;
use Uuids;
public $incrementing = false;
protected $keyType = 'uuid';
protected $table = 'hasil_instrument';
protected $guarded = [];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\Uuids;
class Instrument extends Model
{
use HasFactory;
use Uuids;
public $incrementing = false;
protected $keyType = 'uuid';
protected $table = 'instrument';
protected $guarded = [];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\Uuids;
class Jenis_Input extends Model
{
use HasFactory;
use Uuids;
public $incrementing = false;
protected $keyType = 'uuid';
protected $table = 'jenis_input';
protected $guarded = [];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Permission extends Model
{
use HasFactory;
protected $table = 'permissions';
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'name',
'guard_name',
];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\Uuids;
class Pernyataan_Instrument extends Model
{
use HasFactory;
use Uuids;
public $incrementing = false;
protected $keyType = 'uuid';
protected $table = 'pernyataan_instrument';
protected $guarded = [];
public function sub_instrument()
{
return $this->belongsTo(Sub_Instrument::class, 'id_sub_instrument', 'id');
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
use HasFactory;
protected $table = 'roles';
protected $fillable = ['name', 'guard_name', 'layout'];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\Uuids;
class Sub_Instrument extends Model
{
use HasFactory;
use Uuids;
public $incrementing = false;
protected $keyType = 'uuid';
protected $table = 'sub_instrument';
protected $guarded = [];
public function instrument()
{
return $this->belongsTo(Instrument::class, 'id_instrument', 'id');
}
public function jenis_input()
{
return $this->belongsTo(Jenis_Input::class, 'id_jenis_input', 'id');
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\Uuids;
class Sub_Pernyataan_Instrument extends Model
{
use HasFactory;
use Uuids;
public $incrementing = false;
protected $keyType = 'uuid';
protected $table = 'sub_pernyataan_instrument';
protected $guarded = [];
public function pernyataan_instrument()
{
return $this->belongsTo(Pernyataan_Instrument::class, 'id_pernyataan_instrument', 'id');
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\Uuids;
class Tahun extends Model
{
use HasFactory;
use Uuids;
public $incrementing = false;
protected $keyType = 'uuid';
protected $table = 'tahun';
protected $guarded = [];
}
<?php
namespace App\Models;
use App\Mailer\DynamicMailConfig;
use App\Notifications\ResetPassword;
use App\Traits\Uuids;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Mail;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use Swift_Mailer;
class User extends Authenticatable implements MustVerifyEmail
{
use HasApiTokens;
use HasFactory;
use HasProfilePhoto;
use Notifiable;
use TwoFactorAuthenticatable;
use HasRoles;
use Uuids;
public $incrementing = false;
protected $keyType = 'uuid';
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'name',
'email',
'password',
'email_verified_at'
];
/**
* The attributes that should be hidden for serialization.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
'two_factor_recovery_codes',
'two_factor_secret',
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = [
'profile_photo_url',
];
public function sendEmailVerificationNotification()
{
$this->notifyEmailVerification(new \App\Notifications\EmailVerification());
}
public function notifyEmailVerification($instance)
{
$transport = DynamicMailConfig::getConfig();
$swift_mailer = new Swift_Mailer($transport);
Mail::setSwiftMailer($swift_mailer);
Mail::send('email.email_verification', [
'url' => $instance->getUrl($this),
], function ($message) {
$message->from('loker@unesa.ac.id', 'Universitas Negeri Surabaya');
$message->sender('loker@unesa.ac.id', 'Universitas Negeri Surabaya');
$message->subject('Verify Email Address');
$message->to($this->email, $this->email);
});
}
// public function sendPasswordResetNotification($token)
// {
// dd(new ResetPassword($token));
// $this->notify(new ResetPassword($token));
// }
}
<?php
namespace App\Providers;
use Carbon\Carbon;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
config(['app.locale' => 'id']);
Carbon::setLocale('id');
}
}
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}
}
<?php
namespace App\Providers;
use App\Actions\Fortify\CreateNewUser;
use App\Actions\Fortify\ResetUserPassword;
use App\Actions\Fortify\UpdateUserPassword;
use App\Actions\Fortify\UpdateUserProfileInformation;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\ServiceProvider;
use Laravel\Fortify\Fortify;
class FortifyServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Fortify::createUsersUsing(CreateNewUser::class);
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
RateLimiter::for('login', function (Request $request) {
$email = (string) $request->email;
return Limit::perMinute(5)->by($email.$request->ip());
});
RateLimiter::for('two-factor', function (Request $request) {
return Limit::perMinute(5)->by($request->session()->get('login.id'));
});
}
}
<?php
namespace App\Providers;
use App\Actions\Jetstream\DeleteUser;
use Illuminate\Support\ServiceProvider;
use Laravel\Jetstream\Jetstream;
class JetstreamServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->configurePermissions();
Jetstream::deleteUsersUsing(DeleteUser::class);
}
/**
* Configure the permissions that are available within the application.
*
* @return void
*/
protected function configurePermissions()
{
Jetstream::defaultApiTokenPermissions(['read']);
Jetstream::permissions([
'create',
'read',
'update',
'delete',
]);
}
}
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* This is used by Laravel authentication to redirect users after login.
*
* @var string
*/
public const HOME = '/dashboard';
/**
* The controller namespace for the application.
*
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
*/
// protected $namespace = 'App\\Http\\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
}
<?php
namespace App\Traits;
use Illuminate\Support\Str;
trait Uuids
{ /**
* Boot function from Laravel.
*/
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
if (empty($model->{$model->getKeyName()})) {
$model->{$model->getKeyName()} = Str::uuid()->toString();
}
});
} /**
* Get the value indicating whether the IDs are incrementing.
*
* @return bool
*/
public function getIncrementing()
{
return false;
} /**
* Get the auto-incrementing key type.
*
* @return string
*/
public function getKeyType()
{
return 'string';
}
}
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class AppLayout extends Component
{
/**
* Get the view / contents that represents the component.
*
* @return \Illuminate\View\View
*/
public function render()
{
return view('layouts.app');
}
}
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class GuestLayout extends Component
{
/**
* Get the view / contents that represents the component.
*
* @return \Illuminate\View\View
*/
public function render()
{
return view('layouts.guest');
}
}
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any of our classes manually. It's great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"barryvdh/laravel-dompdf": "^1.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",
"laravel/jetstream": "^2.6",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"livewire/livewire": "^2.5",
"spatie/laravel-permission": "^5.5"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.6",
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.5.10"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"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"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
// 'timezone' => 'UTC',
'timezone' => 'Asia/Jakarta',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
// 'locale' => 'en',
'locale' => 'id',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
// 'faker_locale' => 'en_US',
'faker_locale' => 'id_ID',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Barryvdh\DomPDF\ServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\FortifyServiceProvider::class,
App\Providers\JetstreamServiceProvider::class,
Spatie\Permission\PermissionServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'Date' => Illuminate\Support\Facades\Date::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Js' => Illuminate\Support\Js::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
// 'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'Str' => Illuminate\Support\Str::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'PDF' => Barryvdh\DomPDF\Facade::class,
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'useTLS' => true,
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', 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'),
],
];
<?php
use App\Providers\RouteServiceProvider;
use Laravel\Fortify\Features;
return [
/*
|--------------------------------------------------------------------------
| Fortify Guard
|--------------------------------------------------------------------------
|
| Here you may specify which authentication guard Fortify will use while
| authenticating users. This value should correspond with one of your
| guards that is already present in your "auth" configuration file.
|
*/
'guard' => 'web',
/*
|--------------------------------------------------------------------------
| Fortify Password Broker
|--------------------------------------------------------------------------
|
| Here you may specify which password broker Fortify can use when a user
| is resetting their password. This configured value should match one
| of your password brokers setup in your "auth" configuration file.
|
*/
'passwords' => 'users',
/*
|--------------------------------------------------------------------------
| Username / Email
|--------------------------------------------------------------------------
|
| This value defines which model attribute should be considered as your
| application's "username" field. Typically, this might be the email
| address of the users but you are free to change this value here.
|
| Out of the box, Fortify expects forgot password and reset password
| requests to have a field named 'email'. If the application uses
| another name for the field you may define it below as needed.
|
*/
'username' => 'email',
'email' => 'email',
/*
|--------------------------------------------------------------------------
| Home Path
|--------------------------------------------------------------------------
|
| Here you may configure the path where users will get redirected during
| authentication or password reset when the operations are successful
| and the user is authenticated. You are free to change this value.
|
*/
'home' => RouteServiceProvider::HOME,
/*
|--------------------------------------------------------------------------
| Fortify Routes Prefix / Subdomain
|--------------------------------------------------------------------------
|
| Here you may specify which prefix Fortify will assign to all the routes
| that it registers with the application. If necessary, you may change
| subdomain under which all of the Fortify routes will be available.
|
*/
'prefix' => '',
'domain' => null,
/*
|--------------------------------------------------------------------------
| Fortify Routes Middleware
|--------------------------------------------------------------------------
|
| Here you may specify which middleware Fortify will assign to the routes
| that it registers with the application. If necessary, you may change
| these middleware but typically this provided default is preferred.
|
*/
'middleware' => ['web'],
/*
|--------------------------------------------------------------------------
| Rate Limiting
|--------------------------------------------------------------------------
|
| By default, Fortify will throttle logins to five requests per minute for
| every email and IP address combination. However, if you would like to
| specify a custom rate limiter to call then you may specify it here.
|
*/
'limiters' => [
'login' => 'login',
'two-factor' => 'two-factor',
],
/*
|--------------------------------------------------------------------------
| Register View Routes
|--------------------------------------------------------------------------
|
| Here you may specify if the routes returning views should be disabled as
| you may not need them when building your own application. This may be
| especially true if you're writing a custom single-page application.
|
*/
'views' => true,
/*
|--------------------------------------------------------------------------
| Features
|--------------------------------------------------------------------------
|
| Some of the Fortify features are optional. You may disable the features
| by removing them from this array. You're free to only remove some of
| these features or you can even remove all of these if you need to.
|
*/
'features' => [
Features::registration(),
Features::resetPasswords(),
// Features::emailVerification(),
Features::updateProfileInformation(),
Features::updatePasswords(),
Features::twoFactorAuthentication([
'confirmPassword' => true,
]),
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];
<?php
use Laravel\Jetstream\Features;
return [
/*
|--------------------------------------------------------------------------
| Jetstream Stack
|--------------------------------------------------------------------------
|
| This configuration value informs Jetstream which "stack" you will be
| using for your application. In general, this value is set for you
| during installation and will not need to be changed after that.
|
*/
'stack' => 'livewire',
/*
|--------------------------------------------------------------------------
| Jetstream Route Middleware
|--------------------------------------------------------------------------
|
| Here you may specify which middleware Jetstream will assign to the routes
| that it registers with the application. When necessary, you may modify
| these middleware; however, this default value is usually sufficient.
|
*/
'middleware' => ['web'],
/*
|--------------------------------------------------------------------------
| Jetstream Guard
|--------------------------------------------------------------------------
|
| Here you may specify the authentication guard Jetstream will use while
| authenticating users. This value should correspond with one of your
| guards that is already present in your "auth" configuration file.
|
*/
'guard' => 'sanctum',
/*
|--------------------------------------------------------------------------
| Features
|--------------------------------------------------------------------------
|
| Some of Jetstream's features are optional. You may disable the features
| by removing them from this array. You're free to only remove some of
| these features or you can even remove all of these if you need to.
|
*/
'features' => [
// Features::termsAndPrivacyPolicy(),
// Features::profilePhotos(),
// Features::api(),
// Features::teams(['invitations' => true]),
Features::accountDeletion(),
],
/*
|--------------------------------------------------------------------------
| Profile Photo Disk
|--------------------------------------------------------------------------
|
| This configuration value determines the default disk that will be used
| when storing profile photos for your application's users. Typically
| this will be the "public" disk but you may adjust this if needed.
|
*/
'profile_photo_disk' => 'public',
];
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| 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' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -t -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
<?php
return [
'models' => [
/*
* When using the "HasPermissions" trait from this package, we need to know which
* Eloquent model should be used to retrieve your permissions. Of course, it
* is often just the "Permission" model but you may use whatever you like.
*
* The model you want to use as a Permission model needs to implement the
* `Spatie\Permission\Contracts\Permission` contract.
*/
'permission' => Spatie\Permission\Models\Permission::class,
/*
* When using the "HasRoles" trait from this package, we need to know which
* Eloquent model should be used to retrieve your roles. Of course, it
* is often just the "Role" model but you may use whatever you like.
*
* The model you want to use as a Role model needs to implement the
* `Spatie\Permission\Contracts\Role` contract.
*/
'role' => Spatie\Permission\Models\Role::class,
],
'table_names' => [
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'roles' => 'roles',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your permissions. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'permissions' => 'permissions',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your models permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_permissions' => 'model_has_permissions',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your models roles. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_roles' => 'model_has_roles',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'role_has_permissions' => 'role_has_permissions',
],
'column_names' => [
/*
* Change this if you want to name the related pivots other than defaults
*/
'role_pivot_key' => null, //default 'role_id',
'permission_pivot_key' => null, //default 'permission_id',
/*
* Change this if you want to name the related model primary key other than
* `model_id`.
*
* For example, this would be nice if your primary keys are all UUIDs. In
* that case, name this `model_uuid`.
*/
'model_morph_key' => 'model_id',
/*
* Change this if you want to use the teams feature and your related model's
* foreign key is other than `team_id`.
*/
'team_foreign_key' => 'team_id',
],
/*
* When set to true, the method for checking permissions will be registered on the gate.
* Set this to false, if you want to implement custom logic for checking permissions.
*/
'register_permission_check_method' => true,
/*
* When set to true the package implements teams using the 'team_foreign_key'. If you want
* the migrations to register the 'team_foreign_key', you must set this to true
* before doing the migration. If you already did the migration then you must make a new
* migration to also add 'team_foreign_key' to 'roles', 'model_has_roles', and
* 'model_has_permissions'(view the latest version of package's migration file)
*/
'teams' => false,
/*
* When set to true, the required permission names are added to the exception
* message. This could be considered an information leak in some contexts, so
* the default setting is false here for optimum safety.
*/
'display_permission_in_exception' => false,
/*
* When set to true, the required role names are added to the exception
* message. This could be considered an information leak in some contexts, so
* the default setting is false here for optimum safety.
*/
'display_role_in_exception' => false,
/*
* By default wildcard permission lookups are disabled.
*/
'enable_wildcard_permission' => false,
'cache' => [
/*
* By default all permissions are cached for 24 hours to speed up performance.
* When permissions or roles are updated the cache is flushed automatically.
*/
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
/*
* The cache key used to store all permissions.
*/
'key' => 'spatie.permission.cache',
/*
* You may optionally indicate a specific cache driver to use for permission and
* role caching using any of the `store` drivers listed in the cache.php config
* file. Using 'default' here means to use the `default` set in cache.php.
*/
'store' => 'default',
],
];
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment