Skip to content

Commit b637c41

Browse files
authored
Merge pull request #178 from fleetbase/dev-v1.6.29
v1.6.29 ~ fix company resolution within sms verification code
2 parents d964db3 + de35d48 commit b637c41

35 files changed

Lines changed: 3156 additions & 375 deletions

SCHEDULING_MODULE.md

Lines changed: 0 additions & 127 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fleetbase/core-api",
3-
"version": "1.6.28",
3+
"version": "1.6.29",
44
"description": "Core Framework and Resources for Fleetbase API",
55
"keywords": [
66
"fleetbase",
@@ -36,6 +36,7 @@
3636
"illuminate/support": "^9.0|^10.0",
3737
"inkrot/php-compress-json": "^0.1.1",
3838
"innoge/laravel-msgraph-mail": "^1.4",
39+
"intervention/image": "^3.11",
3940
"jdorn/sql-formatter": "^1.2",
4041
"laravel-notification-channels/apn": "^5.0",
4142
"laravel-notification-channels/fcm": "^4.1",

config/api.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,66 @@
22

33
return [
44
'throttle' => [
5+
// Option 1: Global enable/disable toggle
6+
// Set to false to disable throttling completely (useful for performance testing)
7+
// Default: true (enabled)
8+
// Example: THROTTLE_ENABLED=false
9+
'enabled' => env('THROTTLE_ENABLED', true),
10+
11+
// Maximum number of requests allowed per decay period
12+
// Default: 120 requests per minute
13+
// Example: THROTTLE_REQUESTS_PER_MINUTE=120
514
'max_attempts' => env('THROTTLE_REQUESTS_PER_MINUTE', 120),
15+
16+
// Time window in minutes for throttle decay
17+
// Default: 1 minute
18+
// Example: THROTTLE_DECAY_MINUTES=1
619
'decay_minutes' => env('THROTTLE_DECAY_MINUTES', 1),
20+
21+
// Option 3: Unlimited API keys (for production testing)
22+
// Comma-separated list of API keys that bypass throttling
23+
// These keys can be used for performance testing in production
24+
// Example: THROTTLE_UNLIMITED_API_KEYS=Bearer test_key_123,Bearer load_test_456
25+
'unlimited_keys' => array_filter(explode(',', env('THROTTLE_UNLIMITED_API_KEYS', ''))),
26+
],
27+
28+
'cache' => [
29+
// Enable/disable API model caching
30+
// Caching is enabled by default when HasApiModelCache trait is used
31+
// Set to false to disable caching globally
32+
// Default: true (enabled)
33+
// Example: API_CACHE_ENABLED=false
34+
'enabled' => env('API_CACHE_ENABLED', true),
35+
36+
// Cache TTL (Time To Live) in seconds
37+
'ttl' => [
38+
// Query result caching (list endpoints)
39+
// Default: 300 seconds (5 minutes)
40+
// Example: API_CACHE_QUERY_TTL=300
41+
'query' => env('API_CACHE_QUERY_TTL', 300),
42+
43+
// Model instance caching (single record endpoints)
44+
// Default: 3600 seconds (1 hour)
45+
// Example: API_CACHE_MODEL_TTL=3600
46+
'model' => env('API_CACHE_MODEL_TTL', 3600),
47+
48+
// Relationship caching
49+
// Default: 1800 seconds (30 minutes)
50+
// Example: API_CACHE_RELATIONSHIP_TTL=1800
51+
'relationship' => env('API_CACHE_RELATIONSHIP_TTL', 1800),
52+
],
53+
54+
// Cache driver (uses Laravel's cache configuration)
55+
// Options: redis, memcached, database, file
56+
// Default: uses config('cache.default')
57+
'driver' => env('API_CACHE_DRIVER', config('cache.default')),
58+
59+
// Cache key prefix
60+
// Default: 'fleetbase_api'
61+
'prefix' => env('API_CACHE_PREFIX', 'fleetbase_api'),
62+
63+
// Debug mode - adds X-Cache-Key header to responses
64+
// Default: false (only enabled when APP_DEBUG=true)
65+
'debug' => env('API_CACHE_DEBUG', false),
766
],
867
];

config/database.connections.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
$database = substr($url['path'], 1);
2020
}
2121

22-
$mysql_options = [];
22+
$mysql_options = [
23+
PDO::ATTR_PERSISTENT => true,
24+
PDO::ATTR_TIMEOUT => 5,
25+
];
2326

2427
if (env('APP_ENV') === 'local') {
2528
$mysql_options[PDO::ATTR_EMULATE_PREPARES] = true;
@@ -68,6 +71,9 @@
6871
'strict' => true,
6972
'engine' => null,
7073
'options' => $mysql_options,
74+
'pool' => [
75+
'size' => env('DB_CONNECTION_POOL_SIZE', 25),
76+
],
7177
],
7278

7379
'sandbox' => [

config/fleetbase.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,10 @@
3434
'icon_url' => 'https://flb-assets.s3.ap-southeast-1.amazonaws.com/static/fleetbase-icon.png'
3535
],
3636
'version' => env('FLEETBASE_VERSION', '0.7.1'),
37-
'instance_id' => env('FLEETBASE_INSTANCE_ID') ?? (file_exists(base_path('.fleetbase-id')) ? trim(file_get_contents(base_path('.fleetbase-id'))) : null)
37+
'instance_id' => env('FLEETBASE_INSTANCE_ID') ?? (file_exists(base_path('.fleetbase-id')) ? trim(file_get_contents(base_path('.fleetbase-id'))) : null),
38+
'user_cache' => [
39+
'enabled' => env('USER_CACHE_ENABLED', true),
40+
'server_ttl' => (int) env('USER_CACHE_SERVER_TTL', 900), // 15 minutes
41+
'browser_ttl' => (int) env('USER_CACHE_BROWSER_TTL', 300), // 5 minutes
42+
]
3843
];

config/image.php

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<?php
2+
3+
return [
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Image Processing Driver
7+
|--------------------------------------------------------------------------
8+
|
9+
| Intervention Image supports "GD Library" and "Imagick" to process images
10+
| internally. Depending on your PHP setup, you can choose one of them.
11+
|
12+
| Supported: "gd", "imagick"
13+
|
14+
| Note: The driver is auto-detected based on available extensions.
15+
| Imagick is preferred if available (better quality and more features).
16+
|
17+
*/
18+
19+
'driver' => env('IMAGE_DRIVER', extension_loaded('imagick') ? 'imagick' : 'gd'),
20+
21+
/*
22+
|--------------------------------------------------------------------------
23+
| Default Quality
24+
|--------------------------------------------------------------------------
25+
|
26+
| The default quality for image compression (1-100).
27+
| Higher values mean better quality but larger file sizes.
28+
|
29+
| Recommended: 85 (good balance between quality and size)
30+
|
31+
*/
32+
33+
'default_quality' => env('IMAGE_DEFAULT_QUALITY', 85),
34+
35+
/*
36+
|--------------------------------------------------------------------------
37+
| Allow Upscaling
38+
|--------------------------------------------------------------------------
39+
|
40+
| Whether to allow upscaling small images to larger dimensions.
41+
| When false, images smaller than the target size are left unchanged.
42+
|
43+
| Recommended: false (prevents quality loss from upscaling)
44+
|
45+
*/
46+
47+
'allow_upscale' => env('IMAGE_ALLOW_UPSCALE', false),
48+
49+
/*
50+
|--------------------------------------------------------------------------
51+
| Maximum Dimensions
52+
|--------------------------------------------------------------------------
53+
|
54+
| Safety limits for image dimensions to prevent memory exhaustion.
55+
|
56+
*/
57+
58+
'max_width' => env('IMAGE_MAX_WIDTH', 10000),
59+
'max_height' => env('IMAGE_MAX_HEIGHT', 10000),
60+
61+
/*
62+
|--------------------------------------------------------------------------
63+
| Resize Presets
64+
|--------------------------------------------------------------------------
65+
|
66+
| Predefined dimension presets for common use cases.
67+
| These act as maximum dimensions (images won't be upscaled by default).
68+
|
69+
| Usage: resize=thumb, resize=sm, resize=md, etc.
70+
|
71+
*/
72+
73+
'presets' => [
74+
'thumb' => [
75+
'width' => 150,
76+
'height' => 150,
77+
'name' => 'Thumbnail',
78+
],
79+
'sm' => [
80+
'width' => 320,
81+
'height' => 240,
82+
'name' => 'Small',
83+
],
84+
'md' => [
85+
'width' => 640,
86+
'height' => 480,
87+
'name' => 'Medium',
88+
],
89+
'lg' => [
90+
'width' => 1024,
91+
'height' => 768,
92+
'name' => 'Large',
93+
],
94+
'xl' => [
95+
'width' => 1920,
96+
'height' => 1080,
97+
'name' => 'Extra Large',
98+
],
99+
'2xl' => [
100+
'width' => 2560,
101+
'height' => 1440,
102+
'name' => '2K',
103+
],
104+
],
105+
106+
/*
107+
|--------------------------------------------------------------------------
108+
| Supported Formats
109+
|--------------------------------------------------------------------------
110+
|
111+
| Image formats that can be used for conversion.
112+
|
113+
*/
114+
115+
'formats' => [
116+
'jpg',
117+
'jpeg',
118+
'png',
119+
'webp',
120+
'gif',
121+
'bmp',
122+
'avif',
123+
],
124+
125+
/*
126+
|--------------------------------------------------------------------------
127+
| Resize Modes
128+
|--------------------------------------------------------------------------
129+
|
130+
| Available resize modes:
131+
|
132+
| - fit: Resize to fit within dimensions, maintain aspect ratio (default)
133+
| - crop: Crop to exact dimensions, maintain aspect ratio
134+
| - stretch: Stretch to exact dimensions, ignore aspect ratio
135+
| - contain: Fit within dimensions with padding
136+
|
137+
*/
138+
139+
'modes' => [
140+
'fit',
141+
'crop',
142+
'stretch',
143+
'contain',
144+
],
145+
];

src/Casts/PolymorphicType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public function set($model, $key, $value, $attributes)
3030
{
3131
// default $className is null
3232
$className = null;
33-
3433
if ($value) {
3534
$className = Utils::getMutationType($value);
3635
}

0 commit comments

Comments
 (0)