namespace app\Controllers;
use Yii;
use app\models\Projects;
use app\models\ProjectSearch;
use app\models\Employees;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* ProjectController implements the CRUD actions for Projects model.
*/
class ProjectController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
public function actionGetAvailableEmployees($id=null){
$available_employees = Projects::getAvailableEmployees($id);
return json_encode($available_employees);
}
}
My /config/web.php
is this:
'urlManager'=>array(
'enablePrettyUrl'=>'true',
'showScriptName'=>false,
'rules'=>array(
'' => '/',
'<action:(index|page|contact|login|logout|NotAllowed)>'=>'site/<action>',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
When i try to access the url with this http://mysite.dev/project/get-available-employees/1
I am getting a page not found error, what seems to be the problem here? I am new to Yii2.
Thanks!