DNABeast's avatar

DNABeast wrote a comment+100 XP

3d ago

Re: 'Needle in a Haystack' Yes a needle is inside a haystack BUT str_contains has a string that contains X, so the order of string then what is contains makes more sense. Naming things is hard :)

DNABeast's avatar

DNABeast wrote a comment+100 XP

2w ago

This is a very good time to point out that the subtract and add items buttons need accessibility. You can add a title to the svgs <title>Substract Item</title> or add an aria title to the button. Something to remember on the remove item in the checkout section as well.

Yes it's a bit pedantic in a lesson like this but I find it's one of those things that can get missed if you're not on top of it all that time :)

DNABeast's avatar

DNABeast was awarded Best Answer+1000 XP

1mo ago

This was done by creating a custom relationship.

DNABeast's avatar

DNABeast wrote a reply+100 XP

1mo ago

This was done by creating a custom relationship.

DNABeast's avatar

DNABeast wrote a reply+100 XP

1mo ago

Alas this doesn't work. I don't have identical id to foreign_id matching so any relationship call can only filter down.

I need to replace the relationship check that looks for id = foreign_id with a custom solution that checks for id LIKE partial-id

DNABeast's avatar

DNABeast started a new conversation+100 XP

1mo ago

I've got a Model with an id in three parts

'id' => 'FIRSTNAME_SECONDNAME_TITLE'

I've got a second model where I have matching foreign_ids but the data that goes in there has wildcards.

'name_id'=> '???_SMITH_??'

I want to be able to set up a relationship when all the parts that are filled in match but the wildcards are ignored.

I think I need subQueries in my hasMany method but can't work out how to do it.

In my Name Model

	public function relatedNames(): HasMany
	{
			return $this->hasMany(RelatedName::class, 'name_id', 'id')
			->orWhere(function ($query) {
				$query->where(function ($query) {
					$query->where('firstname', $this->firstname)
						->orWhere('firstname', '!==', '???');
				})
					->where(function ($query) {
						$query->where('lastname', $this->lastname)
							->orWhere('lastname', '!==', '???');
					})
					->where(function ($query) {
						$query->where('title', $this->title)
							->orWhere('title', '!==', '??');
					});
			});
}

In this demo every firstname and last name has the same amount of characters and they are in the database as stored generated columns.

Relationships don't seem to allow orWhere methods on them. How do I made this relationship include these partial matches?

DNABeast's avatar

DNABeast wrote a comment+100 XP

2mos ago

Nice work on this series. I actioned several things that you taught almost immediately.

DNABeast's avatar

DNABeast wrote a comment+100 XP

2mos ago

I'm bitter. I started when the goal was to make the whole site 64k or less uncompressed. Carefully crafting the site by hand to make the user experience excellent. Doing things close to the metal meant something. Handwritten HTML. Barely any javascript.

Using LLMs to create pages like this feels so far away from the metal. My goal was to use as few resources as possible to create a grand user experience, now I have the option to set my LLM to thrash servers overnight to do the same thing. It leaves a sour taste in my mouth.

On top of this I'm racked with the ethical concerns. Water and power usage. IP issues. GPU availability. I left Twitter because it was making me complicit in great injustices. What is the ethical weight of vibe coding? Creating on the web is a great power akin to publishing newspapers in the 1800s. This sort of power needs to be wielded with strong ethics. We've seen what happens when it's not.