Controller
<?php
namespace app\modules\panel\controllers;
use Yii;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use app\models\SocialNetwork;
use app\smoservice\SmoService;
/**
* DefaultController implements the CRUD actions for Posts model.
*/
class TasksController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
public function actionIndex()
{
return $this->render('index');
}
public function actionNew($network = '', $service = '')
{
if (empty($network)) {
$model = SocialNetwork::find()->where(['slug' => 'vk'])->one();
return $this->render('new', compact('model', 'network'));
} elseif (empty($service)) {
$model = SocialNetwork::find()->where(['slug' => $network])->one();
return $this->render('new', compact('model', 'network'));
} elseif (!empty($network) && !empty($service)) {
$parent = SocialNetwork::find()->where(['slug' => $network, 'type' => 'network'])->select(['id'])->one();
$model = SocialNetwork::find()->where(['slug' => $service, 'parent_id' => $parent->id])->one();
return $this->render('new', compact('model', 'network', 'parent'));
}
}
}
Public Last updated: 2020-06-10 05:04:02 AM