Few days ago, i was working on my new project and project was migrate project php into laravel. I need to migrate apis, So in old php application it returns response as text and i have to keep same response in laravel 5.4 application. So i thought how we can do it, finally i got it, we can do it using response().
response() helper will help to return simple text. So in my php it was like as bellow:
PHP response:
<?php
....
....
echo "return response";
exit();
?>
Now i am going to give example of return response as text/html not json. In this example i am going to use response() for return simple text.
Laravel response in controller method:
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function logActivity(Request $request)
{
$input = $request->all();
return response('return response');
}
I hope you found, your solution from here....
Do you like below Tutorials ?
- Angular Json Pipe Example | Json Pipe in Angular 9/8/7
- Angular Slice Pipe Example | Slice Pipe in Angular 9/8/7
- Angular Uppercase Pipe Example | Uppercase Pipe in Angular 9/8/7
- Angular LowerCase Pipe Example | LowerCase Pipe in Angular 9/8/7
- Angular Titlecase Pipe Example | Titlecase Pipe in Angular 9/8/7
- Angular KeyValue Pipe Example | KeyValue Pipe in Angular 9/8/7
- Call Method from One Component to Another Component in Angular
- Angular Push Object into Array Example