pint fixing

dev
Aji Kamaludin 1 year ago
parent 6425705e1d
commit 4b9b4a69c7
No known key found for this signature in database
GPG Key ID: 19058F67F0083AD3

@ -4,8 +4,6 @@ namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

@ -115,8 +115,8 @@ class CustomerController extends Controller
public function update(Request $request, Customer $customer)
{
$request->validate([
'email' => 'nullable|email|unique:customers,email,' . $customer->id,
'username' => 'required|string|min:5|alpha_dash|unique:customers,username,' . $customer->id,
'email' => 'nullable|email|unique:customers,email,'.$customer->id,
'username' => 'required|string|min:5|alpha_dash|unique:customers,username,'.$customer->id,
'password' => 'nullable|string|min:8',
'name' => 'required|string',
'fullname' => 'required|string',

@ -220,8 +220,8 @@ class CustomerMitraController extends Controller
public function update(Request $request, Customer $customer)
{
$request->validate([
'email' => 'nullable|email|unique:customers,email,' . $customer->id,
'username' => 'required|string|min:5|alpha_dash|unique:customers,username,' . $customer->id,
'email' => 'nullable|email|unique:customers,email,'.$customer->id,
'username' => 'required|string|min:5|alpha_dash|unique:customers,username,'.$customer->id,
'password' => 'nullable|string|min:8',
'name' => 'required|string',
'fullname' => 'required|string',

@ -103,15 +103,15 @@ class GeneralController extends Controller
$date = $date->addDay();
}
$saleYearDepositCharts = Sale::selectRaw("SUM(amount) as sale_total, MONTH(date_time) as month")
$saleYearDepositCharts = Sale::selectRaw('SUM(amount) as sale_total, MONTH(date_time) as month')
->where('payed_with', Sale::PAYED_WITH_DEPOSIT)
->whereRaw("YEAR(sales.date_time) = " . Carbon::parse($year)->year)
->groupBy(DB::raw("MONTH(date_time)"));
->whereRaw('YEAR(sales.date_time) = '.Carbon::parse($year)->year)
->groupBy(DB::raw('MONTH(date_time)'));
$saleYearPaylaterCharts = Sale::selectRaw("SUM(amount) as sale_total, MONTH(date_time) as month")
$saleYearPaylaterCharts = Sale::selectRaw('SUM(amount) as sale_total, MONTH(date_time) as month')
->where('payed_with', Sale::PAYED_WITH_PAYLATER)
->whereRaw("YEAR(sales.date_time) = " . Carbon::parse($year)->year)
->groupBy(DB::raw("MONTH(date_time)"));
->whereRaw('YEAR(sales.date_time) = '.Carbon::parse($year)->year)
->groupBy(DB::raw('MONTH(date_time)'));
// filter lokasi
if ($request->year_location_id != '') {

@ -70,9 +70,9 @@ class UserController extends Controller
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'required|email|unique:users,email,' . $user->id,
'email' => 'required|email|unique:users,email,'.$user->id,
'password' => 'nullable|string|max:255',
'username' => 'required|alpha_dash|unique:users,username,' . $user->id,
'username' => 'required|alpha_dash|unique:users,username,'.$user->id,
'phone_wa' => 'required|string',
'photo' => 'nullable|image',
]);

@ -54,7 +54,7 @@ class AuthController extends Controller
}
$password = Hash::check($request->password, $user->password);
if (!$password) {
if (! $password) {
return redirect()->route('customer.login')
->with('message', ['type' => 'error', 'message' => 'Invalid credentials']);
}
@ -109,7 +109,7 @@ class AuthController extends Controller
'fullname' => $user->name,
'name' => $user->name,
'email' => $user->email,
'username' => Str::slug($user->name . '_' . Str::random(5), '_'),
'username' => Str::slug($user->name.'_'.Str::random(5), '_'),
'google_id' => $user->id,
'google_oauth_response' => json_encode($user),
'status' => Customer::STATUS_ACTIVE,

@ -49,7 +49,7 @@ class CartController extends Controller
$operator = $request->param ?? 'add'; //delete, sub, add
$customer = $request->user('customer');
if (!$customer->allow_transaction) {
if (! $customer->allow_transaction) {
$customer->carts()->delete();
return redirect()->back()

@ -42,7 +42,7 @@ class DepositController extends Controller
public function create(Request $request)
{
$customer = $request->user('customer');
if (!$customer->allow_transaction) {
if (! $customer->allow_transaction) {
return redirect()->back()
->with('message', ['type' => 'error', 'message' => 'akun anda dibekukan tidak dapat melakukan transaksi']);
}

@ -29,7 +29,7 @@ class PaylaterController extends Controller
if ($paylater->type == PaylaterHistory::TYPE_REPAYMENT) {
$deposit = DepositHistory::where('related_id', $paylater->id)->first();
if (!in_array($deposit->is_valid, [DepositHistory::STATUS_VALID])) {
if (! in_array($deposit->is_valid, [DepositHistory::STATUS_VALID])) {
return redirect()->route('transactions.deposit.show', [
'deposit' => $deposit,
'back' => 'customer.paylater.index',

@ -32,7 +32,7 @@ class ProfileController extends Controller
'name' => 'string|nullable',
'address' => 'string|required',
'phone' => 'string|required|numeric',
'username' => 'string|required|min:5|alpha_dash|unique:customers,username,' . $customer->id,
'username' => 'string|required|min:5|alpha_dash|unique:customers,username,'.$customer->id,
'password' => 'nullable|string|min:8|confirmed',
'image' => 'nullable|image',
]);

@ -21,6 +21,7 @@ class CustomerApi
$customer = Customer::find($request->header('user'));
Auth::guard('customer')->setUser($customer);
}
return $next($request);
}
}

@ -17,7 +17,7 @@ class CustomerComplateProfile
{
$customer = $request->user('customer');
if (!$customer->is_profile_complate) {
if (! $customer->is_profile_complate) {
return redirect()->route('customer.profile.show')
->with('message', ['type' => 'error', 'message' => 'silahkan lengkapi profile sebelum dapat ber-transaksi']);
}

@ -4,7 +4,6 @@ namespace App\Http\Middleware;
use App\Models\Notification;
use Illuminate\Http\Request;
use Illuminate\Notifications\Notification as NotificationsNotification;
use Inertia\Middleware;
class HandleInertiaRequests extends Middleware
@ -32,6 +31,7 @@ class HandleInertiaRequests extends Middleware
public function share(Request $request): array
{
$notifications = Notification::where('entity_type', \App\Models\User::class)->orderBy('created_at', 'desc');
return array_merge(parent::share($request), [
'auth' => [
'user' => $request->user() ? $request->user()->load(['role.permissions']) : $request->user(),

@ -145,7 +145,7 @@ class Customer extends Authenticatable
return ' - ';
}
return '+62' . $this->phone;
return '+62'.$this->phone;
});
}

@ -6,7 +6,6 @@ use App\Events\NotificationEvent;
use App\Services\GeneralService;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Support\Carbon;
use PHPUnit\Framework\Error\Notice;
class DepositHistory extends Model
{
@ -101,10 +100,10 @@ class DepositHistory extends Model
{
return Attribute::make(get: function () {
if ($this->credit == 0) {
return 'Rp ' . number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.');
return 'Rp '.number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.');
}
return '-Rp ' . number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.');
return '-Rp '.number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.');
});
}
@ -172,7 +171,7 @@ class DepositHistory extends Model
$notification = Notification::create([
'entity_type' => User::class,
'description' => $this->customer->fullname . ' melakukan deposit transfer manual sebesar : ' . $this->amount . $status,
'description' => $this->customer->fullname.' melakukan deposit transfer manual sebesar : '.$this->amount.$status,
'url' => route('deposit.edit', $this),
'type' => Notification::TYPE_DEPOSIT,
]);
@ -186,7 +185,7 @@ class DepositHistory extends Model
$notification = Notification::create([
'entity_type' => User::class,
'description' => $this->customer->fullname . ' melakukan deposit manual sebesar : ' . $this->amount . $status,
'description' => $this->customer->fullname.' melakukan deposit manual sebesar : '.$this->amount.$status,
'url' => route('deposit.edit', $this),
'type' => Notification::TYPE_DEPOSIT,
]);
@ -195,13 +194,12 @@ class DepositHistory extends Model
if ($this->payment_channel == Setting::PAYMENT_MIDTRANS) {
$notification = Notification::create([
'entity_type' => User::class,
'description' => $this->customer->fullname . ' melakukan deposit via midtrans sebesar : ' . $this->amount,
'description' => $this->customer->fullname.' melakukan deposit via midtrans sebesar : '.$this->amount,
'url' => route('deposit.edit', $this),
'type' => Notification::TYPE_DEPOSIT,
]);
}
NotificationEvent::dispatch([
'id' => $notification->id,
'description' => $notification->description,
@ -224,7 +222,7 @@ class DepositHistory extends Model
$notification = Notification::create([
'entity_type' => User::class,
'description' => $this->customer->fullname . ' melakukan pembayaran hutang sebesar ' . $this->amount,
'description' => $this->customer->fullname.' melakukan pembayaran hutang sebesar '.$this->amount,
'url' => route('paylater.repay.edit', $this),
'type' => Notification::TYPE_DEPOSIT,
]);
@ -247,7 +245,7 @@ class DepositHistory extends Model
{
Notification::create([
'entity_id' => $this->customer_id,
'description' => 'Deposit ' . $this->description . ' sebesar ' . $this->amount . ' sudah sukses diterima',
'description' => 'Deposit '.$this->description.' sebesar '.$this->amount.' sudah sukses diterima',
]);
}
}

@ -73,10 +73,10 @@ class PaylaterHistory extends Model
{
return Attribute::make(get: function () {
if ($this->credit == 0) {
return 'Rp ' . number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.');
return 'Rp '.number_format($this->debit, is_float($this->debit) ? 2 : 0, ',', '.');
}
return '-Rp ' . number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.');
return '-Rp '.number_format($this->credit, is_float($this->credit) ? 2 : 0, ',', '.');
});
}
@ -118,7 +118,7 @@ class PaylaterHistory extends Model
{
Notification::create([
'entity_id' => $this->customer_id,
'description' => 'Pembayaran ' . $this->description . ' sebesar ' . $this->amount . ' sudah sukses diterima',
'description' => 'Pembayaran '.$this->description.' sebesar '.$this->amount.' sudah sukses diterima',
]);
}

@ -38,7 +38,7 @@ class SaleItem extends Model
{
return Attribute::make(get: function () {
$shareText = Setting::getByKey('SHARE_TEXT').'
Kode Voucher : ' . $this->voucher->username;
Kode Voucher : '.$this->voucher->username;
return $shareText;
});

@ -176,7 +176,7 @@ class Voucher extends Model
if ($count <= $treshold) {
$notification = Notification::create([
'entity_type' => User::class,
'description' => 'stok voucher ' . $this->locationProfile->name . ' (' . $this->locationProfile->location->name . ') ' . ' tersisa : ' . $count,
'description' => 'stok voucher '.$this->locationProfile->name.' ('.$this->locationProfile->location->name.') '.' tersisa : '.$count,
'url' => route('voucher.profile', $this->locationProfile->location_id),
'type' => Notification::TYPE_VOUCHER_STOCK,
]);

@ -36,7 +36,7 @@ return [
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'host' => env('PUSHER_HOST') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com',
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => false,

@ -49,8 +49,8 @@ class DummySeeder extends Seeder
$images = ['1.webp', '2.webp', '3.webp'];
foreach ($images as $index => $image) {
Banner::create([
'title' => 'Banner ' . $index,
'image' => 'sample/' . $image,
'title' => 'Banner '.$index,
'image' => 'sample/'.$image,
'description' => '<h1>Banner </h1>',
]);
}
@ -109,7 +109,7 @@ class DummySeeder extends Seeder
$lp = LocationProfile::create([
'location_id' => $location->id,
'name' => 'Profile ' . $quota,
'name' => 'Profile '.$quota,
'quota' => $quota,
'display_note' => rand(0, 1) == 1 ? 'bisa semua' : null,
'expired' => rand(1, 3),

@ -1,6 +1,5 @@
<?php
use App\Events\NotificationEvent;
use App\Http\Controllers\Api\CustomerController;
use App\Http\Controllers\Api\CustomerLevelController;
use App\Http\Controllers\Api\LocationController;

Loading…
Cancel
Save