2017-02-24 38 views
1

我有两个方法都返回的观点:确定由哪一种方法它是未来

public function method1() 
{ 
    return ('view1'); 
} 

public function method2() 
{ 
    return ('view1'); 
} 

在我要编辑关于一些变化的观点从法它是未来:

像这样的事情在厂景:

@if(coming form method1) 
{ 
    This is coming from method1, 
} 
@endif 

这是如何实现的?目前我只是对这么小的变化提出两个不同的看法。

回答

2

为什么没有方法

public function method1() 
{ 
    $flag = 'method1'; 
    return ('view1', compact('flag')); 
} 

public function method2() 
{ 
    $flag = 'method2'; 
    return ('view1', compact('flag')); 
} 

,并在旗

@if ($flag == 'method1') 
    This is coming from method1 
@elseif ($flag == 'method2') 
    This is coming from method2 
@endif 
视图选中添加标记
相关问题