Jamie Cee
Jamie Cee
FFilament
Created by jesus9314 on 5/29/2024 in #❓┊help
Can't login into panel when user model use uuid
I get that, but I also wouldn't say it's uncommon that people change ID to be a uuid
7 replies
FFilament
Created by jesus9314 on 5/29/2024 in #❓┊help
Can't login into panel when user model use uuid
Is this in the documentation anyway? Might be worth adding if not, as I've struggled to find this solution until I searched the discord for "user uuid"
7 replies
FFilament
Created by Jamie Cee on 3/25/2024 in #❓┊help
Export download prompt
But I got lost navigating around things and finding where the best part to break it out would be, So if anyone does go and make a PR for the download feature, lemme know 😄
27 replies
FFilament
Created by Jamie Cee on 3/25/2024 in #❓┊help
Export download prompt
It does still populate the exports table, but doesn't run through the queue etc
27 replies
FFilament
Created by Jamie Cee on 3/25/2024 in #❓┊help
Export download prompt
Very unique to my case, so not ideal to use as a PR
27 replies
FFilament
Created by Jamie Cee on 3/25/2024 in #❓┊help
Export download prompt
So Im almost certain there has to be an easier way, but for now, I made a custom action, and implemented the Export functionality from ExportCsv class.
class ExportUsersAction extends Action
{
use CanExportRecords;
}
class ExportUsersAction extends Action
{
use CanExportRecords;
}
Inside the class above, I have this function:
/* Create the csv to download */
public function downloadCsv(Exporter $exporter, string $query, Collection $records, array $columnMap)
{
$exceptions = [];

$processedRows = 0;
$successfulRows = 0;

$csv = \League\Csv\Writer::createFromFileObject(new SplTempFileObject());
$csv->setDelimiter(',');

$query = EloquentSerializeFacade::unserialize($query);

foreach ($exporter->getCachedColumns() as $column) {
$column->applyRelationshipAggregates($query);
$column->applyEagerLoading($query);
}

$csv->insertOne(array_values($columnMap));

foreach ($records as $record) {
try {
$csv->insertOne(($exporter)($record));

$successfulRows++;
} catch (\Throwable $exception) {
$exceptions[$exception::class] = $exception;
}

$processedRows++;
}

// Return the CSV content as a downloadable response
// Create a StreamedResponse to output the CSV content
$response = new \Symfony\Component\HttpFoundation\StreamedResponse(function () use ($csv) {
echo $csv->toString();
});

// Set the headers to force download
$response->headers->set('Content-Type', 'text/csv');
$response->headers->set('Content-Disposition', 'attachment; filename="data.csv"');

if ($response) {
/* Do we prompt the user to download */
Notification::make()
->title("Exporting CSV file")
->body("Exporting content to CSV file")
->success()
->duration(5000)
->send();
}

return $response;
}
/* Create the csv to download */
public function downloadCsv(Exporter $exporter, string $query, Collection $records, array $columnMap)
{
$exceptions = [];

$processedRows = 0;
$successfulRows = 0;

$csv = \League\Csv\Writer::createFromFileObject(new SplTempFileObject());
$csv->setDelimiter(',');

$query = EloquentSerializeFacade::unserialize($query);

foreach ($exporter->getCachedColumns() as $column) {
$column->applyRelationshipAggregates($query);
$column->applyEagerLoading($query);
}

$csv->insertOne(array_values($columnMap));

foreach ($records as $record) {
try {
$csv->insertOne(($exporter)($record));

$successfulRows++;
} catch (\Throwable $exception) {
$exceptions[$exception::class] = $exception;
}

$processedRows++;
}

// Return the CSV content as a downloadable response
// Create a StreamedResponse to output the CSV content
$response = new \Symfony\Component\HttpFoundation\StreamedResponse(function () use ($csv) {
echo $csv->toString();
});

// Set the headers to force download
$response->headers->set('Content-Type', 'text/csv');
$response->headers->set('Content-Disposition', 'attachment; filename="data.csv"');

if ($response) {
/* Do we prompt the user to download */
Notification::make()
->title("Exporting CSV file")
->body("Exporting content to CSV file")
->success()
->duration(5000)
->send();
}

return $response;
}
And inside the setUp function, then inside $this->action() function, I call
return $action->downloadCsv($exporter, $serializedQuery, $records, $columnMap);
return $action->downloadCsv($exporter, $serializedQuery, $records, $columnMap);
27 replies
FFilament
Created by Jamie Cee on 3/25/2024 in #❓┊help
Export download prompt
I totally forgot to have a look into it ngl. Ill have to try find some time
27 replies
FFilament
Created by Jamie Cee on 6/17/2024 in #❓┊help
Live notifications
Update: I've now found theres a filament.php config, and inside has
'broadcasting' => [

'echo' => [
'broadcaster' => 'pusher',
'key' => env('VITE_PUSHER_APP_KEY'),
'cluster' => env('VITE_PUSHER_APP_CLUSTER'),
'wsHost' => env('VITE_PUSHER_HOST'),
'wsPort' => env('VITE_PUSHER_PORT'),
'wssPort' => env('VITE_PUSHER_PORT'),
'authEndpoint' => '/api/v1/broadcasting/auth',
'disableStats' => true,
'encrypted' => true,
'forceTLS' => true,
],

],
'broadcasting' => [

'echo' => [
'broadcaster' => 'pusher',
'key' => env('VITE_PUSHER_APP_KEY'),
'cluster' => env('VITE_PUSHER_APP_CLUSTER'),
'wsHost' => env('VITE_PUSHER_HOST'),
'wsPort' => env('VITE_PUSHER_PORT'),
'wssPort' => env('VITE_PUSHER_PORT'),
'authEndpoint' => '/api/v1/broadcasting/auth',
'disableStats' => true,
'encrypted' => true,
'forceTLS' => true,
],

],
But in my network, broadcasting/auth isn't an endpoint, is there an extra step im supposed to do?
5 replies
FFilament
Created by Jamie Cee on 6/17/2024 in #❓┊help
Live notifications
In my bootstrap.js
var channel = Echo.channel(`offer`);
channel.listen('.translations', function (data) {
console.log(JSON.stringify(data));
alert(JSON.stringify(data));
});
var channel = Echo.channel(`offer`);
channel.listen('.translations', function (data) {
console.log(JSON.stringify(data));
alert(JSON.stringify(data));
});
But running the event, I dont see anything from the console.log. COnfused to what Im missing?
5 replies
FFilament
Created by Jamie Cee on 6/17/2024 in #❓┊help
Live notifications
Ill note that $this->initiator is set to the auth user
5 replies
FFilament
Created by Jamie Cee on 6/17/2024 in #❓┊help
Issue uploading file
Nevermind, Forgot I had to do the TrustProxies thign
2 replies
FFilament
Created by Jamie Cee on 5/21/2024 in #❓┊help
Custom View Form Validation
Thank you for your help @toeknee Appreciate it 🙂
76 replies
FFilament
Created by Jamie Cee on 5/21/2024 in #❓┊help
Custom View Form Validation
Done and buried
76 replies
FFilament
Created by Jamie Cee on 5/21/2024 in #❓┊help
Custom View Form Validation
all works
76 replies
FFilament
Created by Jamie Cee on 5/21/2024 in #❓┊help
Custom View Form Validation
Instead of extending component, I've gone down extending SimplePage instead
76 replies
FFilament
Created by Jamie Cee on 5/21/2024 in #❓┊help
Custom View Form Validation
Finally working
76 replies
FFilament
Created by Jamie Cee on 5/21/2024 in #❓┊help
Custom View Form Validation
No description
76 replies
FFilament
Created by Jamie Cee on 5/21/2024 in #❓┊help
Custom View Form Validation
No description
76 replies
FFilament
Created by Jamie Cee on 5/21/2024 in #❓┊help
Custom View Form Validation
Adding this to my app.blade.php layout file
@vite('resources/css/filament/admin/theme.css')
@vite('resources/css/filament/admin/theme.css')
Has made the styling sort of better. now I need it in this sort of view
76 replies
FFilament
Created by Jamie Cee on 5/21/2024 in #❓┊help
Custom View Form Validation
No description
76 replies