Skip to content

Commit

Permalink
Merge pull request #4 from KTanAug21/fix_display_pdf_article_link
Browse files Browse the repository at this point in the history
Fix article readme, handle when no documents in db
  • Loading branch information
KTanAug21 authored Sep 10, 2024
2 parents c72748a + 73a8ae2 commit bf487a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion _readme/display_isolated_fly_replay_livewire.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Running global instances of our Laravel applications allows us to reduce geographical latency for users across different regions. But with it comes the responsibility of addressing regional-isolation of not only data, but files as well.

In [this article](/laravel-bytes/displaying-fly-replay-livewire/) we address file isolation by talking with the right regional instance using fly-replay. We also add a cherry on top with the use of Livewire's `wire:init` directive to improve loading of pages displaying PDF files.
In [this article](https://fly.io/laravel-bytes/displaying-fly-replay-livewire/) we address file isolation by talking with the right regional instance using fly-replay. We also add a cherry on top with the use of Livewire's `wire:init` directive to improve loading of pages displaying PDF files.

## Relevant files
1. We've added routes to a documents module in [`web.php`](https://github.com/KTanAug21/fly.io-livewire-snippets/blob/master/routes/web.php)
Expand Down
8 changes: 6 additions & 2 deletions app/Http/Controllers/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ public function index()
public function display($id)
{
$pdfDetails = Document::find($id);
Log::info('our config var value is '.config('app.fly_region') );

// None found, don
if ( $pdfDetails == null ){
return null;
}

// Decide replay
Log::info('our config var value is '.config('app.fly_region') );
if( $pdfDetails->region_id != config('app.fly_region') ){

// Replay to identified region
Expand Down

0 comments on commit bf487a1

Please sign in to comment.