Posts

This profile is from a federated server and may be incomplete. Browse more on the original instance.

doefom, to php
@doefom@mastodon.social avatar

Right now all my #php packages have 855 downloads in total. Which compared to other packages is like nothing. But 1000 people downloading and some of them still using my open source work is a cool feeling. Will pop open a beer once I reached my first 1000

doefom, to Laravel
@doefom@mastodon.social avatar

I think in English when you write formal text you spell the numbers until 10. From there on you just write the number. can help with that using the 'Number::spell' helper.

doefom, to Laravel
@doefom@mastodon.social avatar

TIL that #Statamic ships with the 'isCpRoute()' function, which allowed me to make my code a little more compact. The function will check if the current route is a control panel route or not. Here's the old and new code. Feels refreshing 😁

#Laravel #PHP #refactoring #webdev

doefom, to Laravel
@doefom@mastodon.social avatar

The last few days I've shown some examples of how I use macros in #Laravel for certain classes in my daily work. In case you enjoy using macros as much as I do, here's a list of some popular and frequently used classes that implement the Macroable trait that you might not yet have on your radar.

doefom, to Laravel
@doefom@mastodon.social avatar

By default #Laravel will wrap your json resources in a 'data' key. The '::withoutWrapping()' method lets you disable this behavior.

You can turn this off for all resources extending the JsonResource class or just for specific ones, that's up to you.

#webdev

doefom, to webdev
@doefom@mastodon.social avatar

Just published a new release of one of my addons. But first I rewrote the whole thing, then updated the README, noticed that half of my code is not necessary, rewrote the whole thing, then updated the README again. That's how I work.

doefom, to webdev
@doefom@mastodon.social avatar

Recently a friend of mine pointed me towards HTTPie, a currently free Postman alternative which feels quite similar but less bloated. Also, besides the desktop app they've built a CLI client supporting form submissions and what not which is super fun to use. I personally prefer working with UIs in most cases but judging from GitHub with 32k stars as of today there might be some folks that feel a little different about the CLI topic.

Check it out here: https://httpie.io/

#webdev

doefom, to random
@doefom@mastodon.social avatar

I've worked on a new release of my 'restrict' addon for @statamic. Since v0.4.x you can define which entries should be listable to whom in the control panel by defining your custom restriction logic. Bring your own permissions, only show entries that belong to the same company as the user and what not.

However, my approach on achieving this still feels a bit shaky. So feel free to take a look at the repo and bring in your thoughts. Every hint is appreciated!

https://github.com/doefom/restrict

doefom, to webdev
@doefom@mastodon.social avatar

Oh man, there are so many tags I didn't know about. One of those is the <abbr> tag that can be useful when working with abbreviations. Here's a short example.

image/png

doefom, to Laravel
@doefom@mastodon.social avatar

Macros are one thing I enjoy using the most in . It's a way to extend the functionality of many built-in by providing custom callbacks for a specific key.

One production example I use macros for fairly often is what I call the "admin alert". Especially in smaller applications I want to get notified whenever an error or an event occurs the admin (mostly that's me) should know about.

Here's what this might look like.

emd,
@emd@cosocial.ca avatar

@doefom welcome, let me know if I can help you get going with them

doefom,
@doefom@mastodon.social avatar

@emd thanks for the offer! Do you know a GitHub repo where this is used and I can take a look at?

doefom, to webdev
@doefom@mastodon.social avatar

Here's another interesting tag. <mark> lets you highlight certain parts of your text to draw extra attention to it.

One real world example where this can be especially useful is highlighting the parts of your search results that match the search query. Or at least that's where I regularly use it.

Any more ideas on where this might be useful?

image/png

shaedrich,
@shaedrich@mastodon.online avatar

@doefom If you have comments in a text. These could be put in the title attribute and displayed as a tooltip or the like.

doefom,
@doefom@mastodon.social avatar

@shaedrich that’s a great use case indeed, thanks!

doefom, to webdev
@doefom@mastodon.social avatar

Do you know the tags 'details' and 'summary'? I didn't until now.

The combination of those two let's you toggle content with default HTML behavior. This is one of those things you will probably not use in production because it just doesn't look so nice but as always, for quickly prototyping something like an FAQ section this might just fit in perfectly.

image/png
image/png

lyokolux,
@lyokolux@fosstodon.org avatar

@doefom What stops you from using it in production? They are great toggle to display more content after a user interaction.

doefom,
@doefom@mastodon.social avatar

@lyokolux Nothing and you’re absolutely right! I just don’t like the little arrow, it looks a bit „old“ I think but that definitely is not a deal breaker for sure. Maybe you can even change the arrow? Don’t know

doefom, to Software German
@doefom@mastodon.social avatar

What’s the best piece of #software you use in your daily work as a #laravel developer?

emd,
@emd@cosocial.ca avatar

@doefom Ray

doefom,
@doefom@mastodon.social avatar

@emd how could I not know this exists. Thanks for the hint! Will try this

doefom, to Laravel
@doefom@mastodon.social avatar

Using global query scopes for simple one-to-many tenancy.

Code example of a cat pension app I've started and never finished. It's structured like this:

  • A user belongs to a pension
  • A pension has many clients
  • A client has many animals

Users (cat pension owners and their employees) can only view clients and animals from the same pension. Global query scopes ensure this rule is consistently applied throughout the app without accidentally forgetting it somewhere in your code.

doefom, to Laravel
@doefom@mastodon.social avatar

When developing applications I'm always a little afraid of sending emails to actual customers or placing real orders by accident. So I came up with a habit that works super well for me and maybe this will suit you as well.

In my /config/mail.php I add a 'developer' email address and ensure in my AppServiceProvider all emails are sent to this address when in non-production environments no matter what. Makes me build and test stuff way more confidently 😁

Is there a better approach?

doefom, (edited )
@doefom@mastodon.social avatar

@rolfdenhartog That's a great solution, thanks! For such cases I usually work with Laravel Herd. However, many times I know my clients work with outlook for example and then I ensure everything looks fine in outlook. But still, your approach in general feels cleaner than adding my code snippet to the service provider.

doefom,
@doefom@mastodon.social avatar

@mmk2410 that's great, thanks! :)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • cisconetworking
  • ethstaker
  • rosin
  • love
  • Youngstown
  • slotface
  • khanakhh
  • kavyap
  • osvaldo12
  • DreamBathrooms
  • megavids
  • everett
  • InstantRegret
  • tester
  • normalnudes
  • ngwrru68w68
  • cubers
  • GTA5RPClips
  • mdbf
  • Durango
  • anitta
  • modclub
  • Leos
  • JUstTest
  • All magazines