📰 Dev.to · Recca Tsai
Articles from Dev.to · Recca Tsai · 46 articles · Updated every 3 hours · View all reads
All
⚡ AI Lessons (10993)
ArXiv cs.AIDev.to · FORUM WEBDev.to AIForbes InnovationOpenAI NewsHugging Face Blog

Dev.to · Recca Tsai
1mo ago
LiVue: Use Vue 3 Directives in Laravel Blade Templates
LiVue lets you write Vue 3 directives in Blade templates without APIs or .vue files, merging Livewire server-driven architecture with the Vue ecosystem.

Dev.to · Recca Tsai
1mo ago
Fix S3 UnableToCheckFileExistence 403 Error in Laravel
Without s3:ListBucket in the IAM policy, S3 returns 403 for missing files, making [Flysystem](https://flysystem.thephpleague.com) throw UnableToCheckFileExisten

Dev.to · Recca Tsai
1mo ago
Laravel Vite Assets Fail on Custom Domain? Set server.host
Laravel Vite defaults to localhost, breaking assets on custom domains. Set server.host and server.hmr.host in vite.config.js, or use valetTls for Valet HTTPS.

Dev.to · Recca Tsai
1mo ago
Laravel Testing: Assert View Data Without Parsing HTML
HTML assertions on complex views are brittle. Use viewData() to assert view variables directly, and compare Models by id or toArray() to avoid identity issues.

Dev.to · Recca Tsai
1mo ago
2 Ways to Fake $_SERVER Variables in Laravel Feature Tests
Fake $_SERVER in Laravel feature tests by passing server vars per-request, or use withServerVariables() to apply them globally for the entire test method.

Dev.to · Recca Tsai
1mo ago
Laravel Testing: Assert Final Page Content After a Redirect
POST requests only return a 302, hiding the final page. Use followingRedirects() to automatically follow redirects and assert on the destination page content.

Dev.to · Recca Tsai
1mo ago
Add MySQL Functions to SQLite in Laravel Tests
SQLite throws "no such function" for MySQL-specific functions like FIELD. Use PDO sqliteCreateFunction in TestCase setUp to register them and make tests pass.

Dev.to · Recca Tsai
1mo ago
Laravel Queue Job Reads Stale Data in Transaction: Fix
Jobs dispatched in a transaction re-query the DB via SerializesModels before commit, reading stale data. Use afterCommit() to delay dispatch until after commit.

Dev.to · Recca Tsai
1mo ago
Laravel LazyCollection Loses Lazy Evaluation with Generator
Passing a Generator directly to LazyCollection causes iterator_to_array to expand it all at once. Wrap it in a Closure to restore true lazy evaluation.

Dev.to · Recca Tsai
1mo ago
Fix Laravel Migration Unknown Database Type Enum Error
Doctrine DBAL does not recognize MySQL enum type, causing migration failures. Covers Type::addType and registerDoctrineTypeMapping with when to use each fix.

Dev.to · Recca Tsai
1mo ago
How Laravel Facade Resolves Instances from the Container
Laravel Facade uses getFacadeAccessor to resolve instances from the Container. This post shows the difference between bind and singleton and how custom Facades

Dev.to · Recca Tsai
1mo ago
Mock IteratorAggregate with Mockery to Fix foreach in Tests
Mocking IteratorAggregate breaks foreach in PHPUnit. Return an ArrayObject from the mocked getIterator method to make foreach iterate over test data correctly.

Dev.to · Recca Tsai
1mo ago
PHPUnit: Test Closures with Mockery::spy
Assertions inside a closure pass silently even if never called. Wrap the closure in Mockery::spy to verify invocation count and arguments in PHPUnit tests.

Dev.to · Recca Tsai
1mo ago
Eloquent Macro: Fire Specific Events After saveQuietly
Save a model silently with saveQuietly, then selectively dispatch created or other Eloquent model events via a custom Builder macro fire method in Laravel.

Dev.to · Recca Tsai
1mo ago
Fix PHP Curl Comodo SSL Expired Error with GuzzleHttp verify
PHP Curl throws a Comodo RSA SSL expired error on Linux due to missing Root CA. Use GuzzleHttp verify to point to the certificate file, globally or per service.

Dev.to · Recca Tsai
1mo ago
Why Laravel min/max Fails on Numbers: Add the numeric Rule
Laravel min/max rules compare string length by default, letting 0 pass validation. Add the numeric rule to switch to value comparison and fix the bug.

Dev.to · Recca Tsai
1mo ago
3 Laravel Migration Pitfalls and How to Fix Them
Avoid 3 migration rollback mistakes: mixing add/drop in one closure, dropping index and column together, and multiple dropColumn calls. Catch them with SQLite.

Dev.to · Recca Tsai
1mo ago
Speed Up Laravel Tests 7x with PDO::exec Schema Load
Load schema dump into SQLite in-memory database via PDO::exec, skipping per-file migrations. Cuts Laravel test time from 2:21 minutes down to 18 seconds.

Dev.to · Recca Tsai
1mo ago
Laravel 10 Database Expression: Cross-Database SQL
MySQL's IF() fails on SQLite. Laravel 10's Expression interface generates Grammar-specific SQL, encapsulating cross-database differences into a reusable class.

Dev.to · Recca Tsai
1mo ago
Use Laravel Container bind to Inject Any Third-Party Package
When a third-party class needs constructor parameters, Laravel cannot auto-resolve it. Register it with bind in a ServiceProvider to enable type-hint injection.

Dev.to · Recca Tsai
1mo ago
Render Markdown with Blade and Embed Dynamic Syntax
Use Blade addExtension to make .md files support @include and variables, then pass the output through CommonMark to generate HTML for dynamic documentation.

Dev.to · Recca Tsai
1mo ago
Alpine.js Plugin for Laravel AJAX Validation Errors
Build an Alpine.js errors plugin that mirrors the Laravel MessageBag API, so 422 AJAX validation errors display just as easily as the @error directive.
DeepCamp AI