Support the ongoing development of Laravel.io →
Input Architecture

Hello folks,

i am trying to call another function inside the same controller, but its not working at all:

public function checkEditProfile()
    {
        if (Input::has('save'))
        {
            $this->doEditProfile();
        }

    }

    public function doEditProfile()
    {
        return Redirect::to('backend/main');
    }

if i try it that way, i does work:

public function checkEditProfile()
    {
        if (Input::has('save'))
        {
            return Redirect::to('backend/main');
        }

    }

And the questionis... why?! :D

Last updated 2 years ago.
0

Solved by myselfe, but i thought someone might need this:

return $this->doEditProfile();

was the solution... i guess its because its a function, thats why i have to "return" something.

Last updated 2 years ago.
0

Is there an explanation as to why this...

return $this->doEditProfile();

...works in one controller, while this...

$this->doEditProfile();

...works in another controller?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

gilganebu gilganebu Joined 14 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.