Fix Laravel Pint formatting
This commit is contained in:
+14
-15
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class Event extends BaseModel
|
||||
{
|
||||
protected $table = 'events';
|
||||
@@ -26,9 +24,9 @@ class Event extends BaseModel
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'amount' => 'decimal:2', // adjust precision if needed
|
||||
'amount' => 'decimal:2', // adjust precision if needed
|
||||
'expiration_date' => 'date', // change to 'datetime' if stored as DATETIME
|
||||
'created_by' => 'integer',
|
||||
'created_by' => 'integer',
|
||||
];
|
||||
|
||||
/* Optional relationships */
|
||||
@@ -54,7 +52,7 @@ class Event extends BaseModel
|
||||
$q = static::query()
|
||||
->whereDate('expiration_date', '>=', now()->toDateString());
|
||||
|
||||
if (!empty($schoolYear)) {
|
||||
if (! empty($schoolYear)) {
|
||||
$q->where('school_year', $schoolYear);
|
||||
}
|
||||
|
||||
@@ -67,9 +65,9 @@ class Event extends BaseModel
|
||||
public static function getEventsByName(string $name, ?string $schoolYear = null)
|
||||
{
|
||||
$q = static::query()
|
||||
->where('event_name', 'like', '%' . $name . '%');
|
||||
->where('event_name', 'like', '%'.$name.'%');
|
||||
|
||||
if (!empty($schoolYear)) {
|
||||
if (! empty($schoolYear)) {
|
||||
$q->where('school_year', $schoolYear);
|
||||
}
|
||||
|
||||
@@ -83,7 +81,7 @@ class Event extends BaseModel
|
||||
{
|
||||
$q = static::query();
|
||||
|
||||
if (!empty($schoolYear)) {
|
||||
if (! empty($schoolYear)) {
|
||||
$q->where('school_year', $schoolYear);
|
||||
}
|
||||
|
||||
@@ -96,6 +94,7 @@ class Event extends BaseModel
|
||||
public static function addEvent(array $data): int
|
||||
{
|
||||
$row = static::create($data);
|
||||
|
||||
return (int) $row->id;
|
||||
}
|
||||
|
||||
@@ -106,7 +105,7 @@ class Event extends BaseModel
|
||||
{
|
||||
$q = static::query()->whereDate('expiration_date', $date);
|
||||
|
||||
if (!empty($schoolYear)) {
|
||||
if (! empty($schoolYear)) {
|
||||
$q->where('school_year', $schoolYear);
|
||||
}
|
||||
|
||||
@@ -121,11 +120,11 @@ class Event extends BaseModel
|
||||
$q = static::query()
|
||||
->whereDate('expiration_date', '>=', now()->toDateString());
|
||||
|
||||
if (!empty($schoolYear)) {
|
||||
if (! empty($schoolYear)) {
|
||||
$q->where('school_year', $schoolYear);
|
||||
}
|
||||
|
||||
if (!empty($semester)) {
|
||||
if (! empty($semester)) {
|
||||
$q->where('semester', $semester);
|
||||
}
|
||||
|
||||
@@ -139,7 +138,7 @@ class Event extends BaseModel
|
||||
{
|
||||
$q = static::query()->whereKey($id);
|
||||
|
||||
if (!empty($schoolYear)) {
|
||||
if (! empty($schoolYear)) {
|
||||
$q->where('school_year', $schoolYear);
|
||||
}
|
||||
|
||||
@@ -153,7 +152,7 @@ class Event extends BaseModel
|
||||
{
|
||||
$q = static::query()->whereKey($id);
|
||||
|
||||
if (!empty($schoolYear)) {
|
||||
if (! empty($schoolYear)) {
|
||||
$q->where('school_year', $schoolYear);
|
||||
}
|
||||
|
||||
@@ -167,10 +166,10 @@ class Event extends BaseModel
|
||||
{
|
||||
$q = static::query()->whereKey($id);
|
||||
|
||||
if (!empty($schoolYear)) {
|
||||
if (! empty($schoolYear)) {
|
||||
$q->where('school_year', $schoolYear);
|
||||
}
|
||||
|
||||
return (bool) $q->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user