sllkevin's avatar

sllkevin wrote a reply+100 XP

3mos ago

That's my thinking, but shouldn't bots and crawlers or curl pings receive a proper 404 response? I just checked the standard Laravel 404 (dark 404 | NOT FOUND page) and the response is 404 in dev tools. But my custom 404.blade is 301.

sllkevin's avatar

sllkevin started a new conversation+100 XP

3mos ago

When using the browser network tools, I can see that any missing route originally reveals 404 before the official response as a 301 redirect to the 404.blade template.

However, I'm checking my Nginx access logs and all the bots pinging random wordpress routes all show the response as 301. Is this normal behavior?

sllkevin's avatar

sllkevin wrote a reply+100 XP

4mos ago

I discovered this topic after having a similar issue. However, updatingProperty($value) does not seem to work with my scenario where I'm using #[Validate] attribute on the property for a domain URL in a simple Volt component.

In my case, I wrote a function to ensure "https://" is prefixed to a string before validating, otherwise the validation will fail immediate, on blur. I wanted to format that string before validation.

My solution is to call the filter function in the rules() method just before returning the rules array. See summary of my solution below:

#[Validate]
public ?string $domain;

protected function rules()
{
	$this->domain = isset($this->domain) 
		? Application::formatDomainString($this->domain) : null;

	return [
		'domain' => 
'nullable:string|url:http,https|unique:applications,domain,'.$this->application->id,
	];
}
<flux:input wire:model.blur="domain" />
sllkevin's avatar

sllkevin wrote a reply+100 XP

5mos ago

The code above is just an example of the syntax I'm looking for, similar to how the Flux docs explain Flux::modal->close().

I understand that's what blade is for, but Flux is already a view/component and putting it in another view/component seems redundant. If i wanted to render a Flux badge it'd be nice to just return the badge instead of a whole separate view.

The first return as a static method probably wouldn't work well if to require the additional wrappers. However, i'm not sure how to reference the views path to flux components. By convention, return view('flux.menu.item') should work but it does not, even as a namespace flux::menu.item.

My solution so far is a Volt component with blade @if conditionals which i don't like. However my small project it's not a dealbreaker.

sllkevin's avatar

sllkevin started a new conversation+100 XP

5mos ago

Is there a way to have a class method return a Flux component? My work around was to create my own blade component to hold the Flux tags then return view('my-flux-component'). But can I just call Flux directly without concatenating a string in the method?

For example, I have a list of Posts I want to add an action menu: View, Delete, etc. I want to have an action class that handle() but also render the menu item.

// Example
class Post
{
	public $actions = [
		Actions\ViewPost::class,
		Actions\DeletePost::class
	];
}
//Example
class Actions\ViewPost
{
	public static function menuItem()
	{
		// What I'm trying to achieve
		return Flux::menuItem( $attributes... );
		// or...
		return view('flux::menu.item', [...]);
	}
}
sllkevin's avatar

sllkevin wrote a reply+100 XP

5mos ago

Thank you so much for linking those references and providing an answer. I was going crazy trying to find all the changes I may have missed upgrading from Laravel 11 to 12.

sllkevin's avatar

sllkevin liked a comment+100 XP

5mos ago

This is an issue of PsySH which was subject of some discussing on X thread and in the package's Github issues relating to what PsySH is interpreting either as actions or inspections. The repo owner is

Seems not to be configurable yet, so the workaround is either (i) use the $_ approach after the query to see the verbose, expanded result:

> \Laravel\Cashier\Subscription::find(3)               
= Laravel\Cashier\Subscription {#5841 …14}

> $_
= Laravel\Cashier\Subscription {#5841
    id: 3,
    user_id: 1,
    type: "1",
    stripe_id: "3",
    stripe_status: "active",
    stripe_price: null,
    quantity: null,
    trial_ends_at: null,
    ends_at: "2024-08-14 00:47:03",
    created_at: null,
    updated_at: null,
    current_period_end: null,
    event_status: null,
    items: Illuminate\Database\Eloquent\Collection {#6525
      all: [],
    },
  }

or, (ii) lock you psysh to max. version 0.12.12

composer require psy/psysh:0.12.12

Hopefully this will be configurable soon

sllkevin's avatar

sllkevin wrote a reply+100 XP

5mos ago

In v3, you can use clusters. You have to re-organize the folders a little but it should do what you're trying to do. In v4, I think there is now support for nested resources but I have not used it yet.

filamentphp . com/docs/3.x/panels/clusters

sllkevin's avatar

sllkevin wrote a reply+100 XP

5mos ago

In addition, Tinker is now also including hidden properties like password and remember_token when querying User. Same issue as above.

sllkevin's avatar

sllkevin started a new conversation+100 XP

5mos ago

Why is this happening? See my first three queries that won't return any data, but using find() works great. I have cleared cache, routes, config. I've dumped autoload. I've downgraded versions. I've tried another project where it works as expected. If I add ->id to any of them, it works. Why??

> \Laravel\Cashier\Subscription::query()->where('id','=','3')->first()
= Laravel\Cashier\Subscription {#6527 …14}

> \Laravel\Cashier\Subscription::where('id',3)->get()->first()
= Laravel\Cashier\Subscription {#6954 …14}

> \Laravel\Cashier\Subscription::where('id',3)->first()               
= Laravel\Cashier\Subscription {#5841 …14}

> \Laravel\Cashier\Subscription::find(3)               
= Laravel\Cashier\Subscription {#6527
    id: 3,
    user_id: 1,
    type: "1",
    stripe_id: "3",
    stripe_status: "active",
    stripe_price: null,
    quantity: null,
    trial_ends_at: null,
    ends_at: "2024-08-14 00:47:03",
    created_at: null,
    updated_at: null,
    current_period_end: null,
    event_status: null,
    items: Illuminate\Database\Eloquent\Collection {#6525
      all: [],
    },
  }