0
Есть ли способ получить доступ к функции от FirstController
до SecondController
? если есть, может понравиться, кто-то покажет мне дорогу.
FirstController
:
Контроллер доступа от другого контроллера в Yii 2
class FirstController extends Controller
{
public function actionDownload($fileName)
{
$path = 'templates/'.$fileName;
if(file_exists($path)){
return Yii::$app->response->sendFile($path);
}
}
}
SecondController
:
class SecondController extends Controller
{
public function actionView($id)
{
// i want to access function download() from the FirstController here
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
}
Спасибо. это так полезно –