Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support responsable on more objects #46167

Closed
wants to merge 1 commit into from
Closed

Support responsable on more objects #46167

wants to merge 1 commit into from

Conversation

taylorotwell
Copy link
Member

Support Responsable on all response types + views so that the contract could potentially be used as an alternative to Response or mixed on controller stubs.

Reference: #46166

@ConsoleTVs
Copy link
Contributor

Here's an example of multiple controller handlers this PR would allow:

use Illuminate\Contracts\Support\Responsable;

public function foo(): Responsable {
    return response('foo');
}

public function foo(): Responsable {
    return response()->json(['foo' => 'bar']);
}

public function foo(): Responsable {
    return redirect()->route('foo');
}

public function foo(): Responsable {
    return view('foo');
}

public function foo(User $user): Responsable {
    return new UserResource($user);
}

public function foo(): Responsable {
    return UserResource::collection(User::all());
}

@taylorotwell taylorotwell deleted the responsable branch February 18, 2023 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants