{ Laravel snippets }

Andrew Schmelyun

Andrew Schmelyun @aschmelyun

Today I learned about Laravel's replicate method, which returns a new instance of a model with the same attributes as the one you're replicating. You can then make changes to the properties of it before saving! https://t.co/oXRwqtgkfL

Chris Fidao

Chris Fidao @fideloper

? TIL Laravel uses transaction for migrations for DB's that supports schema migrations (pgsql, sqlsrv). If you're like me and run a query that cannot be run inside of a transaction (sqlsrv CREATE FULLTEXT CATALOG), you can set the $withinTransaction to false. https://t.co/sAtlzAbLUN

Christoph Rumpel  ?

Christoph Rumpel ? @christophrumpel

?‍♂️ Laravel Nova When you allow a user role to see a relationship field, it will also be visible in Nova's sidebar as a resource which is not always what you want. Just learned two ways to change it. With the method, you can also define a condition yourself. thx @tillkruss https://t.co/4YoFbtsZur

Taylor Otwell ⚗️

Taylor Otwell ⚗️ @taylorotwell

? Tip: sometimes I want to perform a quick validation check outside of the normal “Validator” flow and then respond with the same HTTP response format the validator would use. You can easily do this using “ValidationException::withMessages()”… #HiddenGem https://t.co/1Du0e8yrSH

Andrew Schmelyun

Andrew Schmelyun @aschmelyun

Whenever I'm doing validation in my #Laravel projects, I've started to create static functions in the relevant models and dump the validation rules there. Everything's in one easy-to-find place! https://t.co/StGoW7GeIb