I am getting started with Laravel. I have a controller which shows and inserts the data. It is similar to
class UserController extends BaseController {
protected $layout = 'layouts.master';
public function showProfile()
{
$this->layout->content = View::make('user.profile');
}
public function addProfile()
{
<Insertion Logic>
echo "Successfully added";
}
}
Now insert is a ajax call. So I want to display the just the Success message after adding to the database. But in my case the layout content also shows up. How can I just return the echo message.
Thanks
Since you inside a method, you will be able to access and change a protected property.
You can just simply add $this->layout = '';
right before you do the echo.