Muthu
Muthu

Reputation: 209

Laravel function call and return in the same controller

I am new to laravel. I am having a doubt how to call other function inside the same controller and return the processed values to the function by which it has been invoked. I have tried this similar to C language but the code doesn't works

class AgreementsApiController extends Controller
    {

      public function store($th_id,$mv_id,$wk1_terms,$wk2_terms,$wk3_terms)

        {
        //make a function call here to add function similar to
        $result=add($th_id,$mv_id);
        }

    public function add($th_id,$mv_id)

        { //process the parameters and return to store function

          $r=$th_id+$mv_id;
          return $r;

        }
    }

Upvotes: 0

Views: 10463

Answers (1)

wahdan
wahdan

Reputation: 1258

In your store function

 $result=$this->add($th_id,$mv_id);

and thats it.

Upvotes: 6

Related Questions