waterflai
waterflai
FFilament
Created by waterflai on 2/9/2025 in #❓┊help
File upload Error in production
i found the error, it was allow trusted proxy since im using reverse proxy :>
6 replies
FFilament
Created by waterflai on 2/9/2025 in #❓┊help
File upload Error in production
Up :<
6 replies
FFilament
Created by waterflai on 2/9/2025 in #❓┊help
File upload Error in production
when i do this
Route::get('/test-upload', function () {
// Sample file content
$content = "This is a test file uploaded via GET route.";

// Define the file path inside storage
$filePath = 'test-uploads/sample.txt';

// Store the file
Storage::disk('public')->put($filePath, $content);

// Return success response with file URL
return response()->json([
'message' => 'File uploaded successfully!',
'file_url' => Storage::url($filePath),
]);
});
Route::get('/test-upload', function () {
// Sample file content
$content = "This is a test file uploaded via GET route.";

// Define the file path inside storage
$filePath = 'test-uploads/sample.txt';

// Store the file
Storage::disk('public')->put($filePath, $content);

// Return success response with file URL
return response()->json([
'message' => 'File uploaded successfully!',
'file_url' => Storage::url($filePath),
]);
});
it works, means the current user has permission to upload files to the storage
6 replies
FFilament
Created by waterflai on 2/3/2025 in #❓┊help
Custom page, custom fill form radio reset after picked
now that i fix the refershed radio after select, the only problem is mounting wont set the radio default options https://pastebin.com/BFA9KaSs
13 replies
FFilament
Created by waterflai on 2/3/2025 in #❓┊help
Custom page, custom fill form radio reset after picked
but it shows the data as you can see in the notification, an array of score point
13 replies
FFilament
Created by waterflai on 2/3/2025 in #❓┊help
Custom page, custom fill form radio reset after picked
Yes, its a custom page with HasForm
13 replies
FFilament
Created by waterflai on 2/3/2025 in #❓┊help
Custom page, custom fill form radio reset after picked
No description
13 replies
FFilament
Created by waterflai on 2/3/2025 in #❓┊help
Custom page, custom fill form radio reset after picked
No description
13 replies
FFilament
Created by waterflai on 2/3/2025 in #❓┊help
How to Achieve Radio Option Styling
thank you !
8 replies
FFilament
Created by waterflai on 2/3/2025 in #❓┊help
How to Achieve Radio Option Styling
is there a way to achieve the radio option style ?
8 replies
FFilament
Created by waterflai on 1/29/2025 in #❓┊help
Fileupload in Single record editing with custom page
Thanks for all the help, i had to manually mutate the file before storing in db, so it will take the actual file path
public function save(): void
{
// Get the form data
$data = $this->form->getState();

// Process file upload fields
foreach (['head_master_photo', 'accompanying_teacher_photo', 'contingent_leader_photo'] as $field) {
if (isset($data[$field]) && is_array($data[$field])) {
// Extract the file path from the nested structure
$filePath = array_values($data[$field])[0];
$data[$field] = $filePath; // Update the data with the file path only
}
}

// Update the school record with the processed data
$this->school->update($data);

Notification::make()
->success()
->title(__('filament-panels::resources/pages/edit-record.notifications.saved.title'))
->send();
}
public function save(): void
{
// Get the form data
$data = $this->form->getState();

// Process file upload fields
foreach (['head_master_photo', 'accompanying_teacher_photo', 'contingent_leader_photo'] as $field) {
if (isset($data[$field]) && is_array($data[$field])) {
// Extract the file path from the nested structure
$filePath = array_values($data[$field])[0];
$data[$field] = $filePath; // Update the data with the file path only
}
}

// Update the school record with the processed data
$this->school->update($data);

Notification::make()
->success()
->title(__('filament-panels::resources/pages/edit-record.notifications.saved.title'))
->send();
}
36 replies
FFilament
Created by waterflai on 1/29/2025 in #❓┊help
Fileupload in Single record editing with custom page
No description
36 replies
FFilament
Created by waterflai on 1/29/2025 in #❓┊help
Fileupload in Single record editing with custom page
No description
36 replies
FFilament
Created by waterflai on 1/29/2025 in #❓┊help
Fileupload in Single record editing with custom page
the data still stored like this
{"438561d2-e57f-46c5-afcd-bd53b448dd3d":"schools\/head_masters\/01JJTM1JAZ976YVZPMRS8F5V5J.jpg"}
{"438561d2-e57f-46c5-afcd-bd53b448dd3d":"schools\/head_masters\/01JJTM1JAZ976YVZPMRS8F5V5J.jpg"}
36 replies
FFilament
Created by waterflai on 1/29/2025 in #❓┊help
Fileupload in Single record editing with custom page
Oki, i just did right now and check its still the same
36 replies
FFilament
Created by waterflai on 1/29/2025 in #❓┊help
Fileupload in Single record editing with custom page
No description
36 replies
FFilament
Created by waterflai on 1/29/2025 in #❓┊help
Fileupload in Single record editing with custom page
No description
36 replies
FFilament
Created by waterflai on 1/29/2025 in #❓┊help
Fileupload in Single record editing with custom page
36 replies
FFilament
Created by waterflai on 1/29/2025 in #❓┊help
Fileupload in Single record editing with custom page
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class School extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name', // Name of the school
'head_master', // Name of the head master
'head_master_photo', // URL or path to the head master's photo
'accompanying_teacher', // Name of the accompanying teacher/coach
'accompanying_teacher_photo', // URL or path to the accompanying teacher's photo
'address', // Address of the school
'phone_number', // Phone number of the school
'email', // Email of the school
'contingent_leader', // Name of the contingent leader
'contingent_leader_photo', // URL or path to the contingent leader's photo
'event_id', // Foreign key to the events table
];

/**
* Get the event associated with the school.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function event(): BelongsTo
{
return $this->belongsTo(Event::class);
}

/**
* Get the users associated with the school.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function users(): HasMany
{
return $this->hasMany(User::class);
}

/**
* Get the teams associated with the school.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function teams(): HasMany
{
return $this->hasMany(Team::class, 'user_id');
}
}
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class School extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name', // Name of the school
'head_master', // Name of the head master
'head_master_photo', // URL or path to the head master's photo
'accompanying_teacher', // Name of the accompanying teacher/coach
'accompanying_teacher_photo', // URL or path to the accompanying teacher's photo
'address', // Address of the school
'phone_number', // Phone number of the school
'email', // Email of the school
'contingent_leader', // Name of the contingent leader
'contingent_leader_photo', // URL or path to the contingent leader's photo
'event_id', // Foreign key to the events table
];

/**
* Get the event associated with the school.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function event(): BelongsTo
{
return $this->belongsTo(Event::class);
}

/**
* Get the users associated with the school.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function users(): HasMany
{
return $this->hasMany(User::class);
}

/**
* Get the teams associated with the school.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function teams(): HasMany
{
return $this->hasMany(Team::class, 'user_id');
}
}
36 replies
FFilament
Created by waterflai on 1/29/2025 in #❓┊help
Fileupload in Single record editing with custom page
I’ll get the model as well <3 Be right back
36 replies