Answer the question
In order to leave comments, you need to log in
How to select data from Yii2 DB?
The address:
'rules' => [
'jobdb' => 'job/jobdb',
],
public function actionJobdb()
{
$array = JobList::getAll();
return $this->render('joblist',['varInView' => $array]);
}
Class 'frontend\controllers\JobList' not found
$array = JobList::getAll();
class JobList extends Model
{
public static function tableName(){
return 'tags'; // Имя таблицы в БД
}
public static function getAll(){
$data = self::find()->all();
return $data;
}
}
Answer the question
In order to leave comments, you need to log in
The problem is that the model is in its own space, the controller is in its own. Understand how namespaces work and there will be no similar problems and questions about them in the future
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question