ffffer.
ffffer.
FFilament
Created by ffffer. on 8/26/2024 in #❓┊help
FileUpload for Cloudflare Images
In the end I made my own driver. But I have only one problem left that I can't solve: class CloudflareImagesAdapter implements FilesystemAdapter { protected $client; protected $apiKey; protected $accountId; protected $baseURL; protected $response; public function __construct(string $apiKey, string $accountId, string $baseURL) { $this->client = new Client([ 'base_uri' => 'https://api.cloudflare.com/client/v4/accounts/' . $accountId . '/images/v1', ]); $this->apiKey = $apiKey; $this->accountId = $accountId; $this->baseURL = $baseURL; } public function write(string $path, string $contents, Config $config): void { $response = $this->client->post('', [ 'headers' => [ 'Authorization' => 'Bearer ' . $this->apiKey, ], 'multipart' => [ [ 'name' => 'file', 'contents' => $contents, 'filename' => basename($path), ], ], ]); if ($response->getStatusCode() !== 200) { throw new \Exception('Failed to upload file to Cloudflare Images'); } } The problem is that after the upload, I get: { "result": { "id": "2cdc28f0-017a-49c4-9ed7-87056c83901", "filename": "image.jpeg", etc... } Filament is storing in my model Image: "image.jpeg", but I need to store: "2cdc28f0-017a-49c4-9ed7-87056c83901" How could I do that? Thanks
8 replies
FFilament
Created by ffffer. on 8/26/2024 in #❓┊help
FileUpload for Cloudflare Images
Thanks for the replies. With R2 everything works perfect for me because it uses it as a native disk. The problem is that CF Images is not R2, the way to save and view images is directly HTTPS (save with a post/curl, and load with the direct url). https://developers.cloudflare.com/images/upload-images/upload-url/
8 replies
FFilament
Created by ffffer. on 8/26/2024 in #❓┊help
FileUpload for Cloudflare Images
Ok, I understand. I'm trying to use the FileUpload to manage Cloudflare Images (it works with http calls) I'm using saveUploadedFileUsing to upload files, it works. But my problem is that I cannot view the uploaded file. Any recommendation? The ideal solution should be a filesystem disk, but I didn't find any working pkg for that.
8 replies
FFilament
Created by ffffer. on 8/21/2024 in #❓┊help
RelationManager select relationship with multiple(), Duplicate entry on update
Well spotted! Solved 🙂
10 replies
FFilament
Created by ffffer. on 8/26/2024 in #❓┊help
Back to default within method
I understand, but wouldn't it be more convenient that if null is returned for example, it adopts the default behavior? Or that there is some method to avoid these cases in which if there is no real change in behavior, because if I implement the current logic and in a later version the base function is changed, it may not work as expected Thanks for the clarification
5 replies
FFilament
Created by ffffer. on 8/21/2024 in #❓┊help
RelationManager select relationship with multiple(), Duplicate entry on update
Thanks for the reply, but the withPivot() method is not necessary if the pivot table doesn't have any additional columns besides the foreign keys:
In Laravel, when you define a many-to-many relationship using belongsToMany(), Laravel will automatically handle the foreign keys in the pivot table.
Any other idea?
10 replies
FFilament
Created by ffffer. on 8/21/2024 in #❓┊help
RelationManager select relationship with multiple(), Duplicate entry on update
Hi, sure: class Domain extends Model: public function assets_contents() { return $this->belongsToMany(AssetsContent::class); } class AssetsContent extends Model: public function image() { return $this->belongsTo(Image::class); } And the pivot migration: Schema::create('assets_content_domain', function (Blueprint $table) { $table->unsignedInteger('assets_content_id'); $table->foreign('assets_content_id')->references('id')->on('assets_contents'); $table->unsignedTinyInteger('domain_id'); $table->foreign('domain_id')->references('id')->on('domains'); $table->primary('assets_content_id','domain_id'); });
10 replies
FFilament
Created by ffffer. on 8/21/2024 in #❓┊help
RelationManager select relationship with multiple(), Duplicate entry on update
😩
10 replies
FFilament
Created by ffffer. on 2/29/2024 in #❓┊help
Builder schema not being reactive
Hi @awcodes , Thanks for the clarification, I'm using data objects for each 'type', so in the Builder, depending on the selected type, I need some fields to be filled in or others. Actually, my blocks looks like: \Components\Builder\Block::make('data') ->label('Features') ->hidden() ->schema(function (callable $get) { $type = $get('type'); $className = $type ? ucfirst($type) . 'BonusData' : null; $classPath = "\App\Data\{$className}Data"; return class_exists($classPath) ? self::getReflection($classPath) : []; }) ->reactive() ->columns(3) This way, as the 'type' select automatically takes the options from the db, simply by adding a new spatie data object we could extend the different fields for each option
5 replies
FFilament
Created by ffffer. on 2/19/2024 in #❓┊help
Table does not edit the correct item
I tried, by it didn't work. Anyway, I'll do it with a json field, keeping it simple. Thanks
5 replies
FFilament
Created by ffffer. on 12/28/2023 in #❓┊help
Query Builder stored in DB
Suggestions?
3 replies
FFilament
Created by ffffer. on 12/14/2023 in #❓┊help
Inefficient table
Great, thank you, I'm going to check all the selects and the loading data
8 replies
FFilament
Created by ffffer. on 12/21/2023 in #❓┊help
Attach with dynamic fields
It's cold here
5 replies
FFilament
Created by ffffer. on 12/21/2023 in #❓┊help
Attach with dynamic fields
No description
5 replies
FFilament
Created by ffffer. on 12/14/2023 in #❓┊help
Inefficient table
Maybe n+1 problem, db queries are finished in no time. I'll continue debugging, thanks
8 replies