Skip to content

Commit

Permalink
Add Macroable trait to RedirectResponse (#16929)
Browse files Browse the repository at this point in the history
  • Loading branch information
timroberson authored and taylorotwell committed Dec 23, 2016
1 parent dd3c081 commit d8ca3e6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Illuminate/Http/RedirectResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
use Illuminate\Support\Str;
use Illuminate\Support\MessageBag;
use Illuminate\Support\ViewErrorBag;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Session\Store as SessionStore;
use Illuminate\Contracts\Support\MessageProvider;
use Symfony\Component\HttpFoundation\File\UploadedFile as SymfonyUploadedFile;
use Symfony\Component\HttpFoundation\RedirectResponse as BaseRedirectResponse;

class RedirectResponse extends BaseRedirectResponse
{
use ResponseTrait;
use ResponseTrait, Macroable {
Macroable::__call as macroCall;
}

/**
* The request instance.
Expand Down Expand Up @@ -204,6 +207,10 @@ public function setSession(SessionStore $session)
*/
public function __call($method, $parameters)
{
if (static::hasMacro($method)) {
return $this->macroCall($method, $parameters);
}

if (Str::startsWith($method, 'with')) {
return $this->with(Str::snake(substr($method, 4)), $parameters[0]);
}
Expand Down

0 comments on commit d8ca3e6

Please sign in to comment.