Category : yii2

I’m attempting to adapt the Heroic Features template from Start Bootstrap to Yii2. The heroic-features.css includes Bootstrap & I like to use CDNs where I can, so I’ve overridden YiiAsset, JqueryAsset, & BootstrapAsset. Everything looks good until I include the NavBar. In frontend/views/layouts/main.php I have everything bootstrap5… use commonwidgetsAlert; use yiibootstrap5Breadcrumbs; use yiibootstrap5Html; use yiibootstrap5Nav; ..

Read more

I have a JavaScript frontend that ask for a plain text to my PHP backend. It almost works excepts because I have a CORS problem. How can allow CORS in my PHP code? My frontend (JavaScript and jQuery): $.ajax({ type: ‘GET’, url: ‘http://localhost:8080/’, }) .done(function(data) { console.log(data); }) .fail(function() { alert("Oh, no. CORS error again."); ..

Read more

There is a page where the GridView is displayed: // OrderController public function actionIndex() { $dataProvider = new ActiveDataProvider([ ‘query’ => Model::find(), ‘sort’ => false, ‘pagination’ => [ ‘pageSize’ => 15, ‘route’ => ‘/order’ ], ]); return $this->render(‘index’, [ ‘dataProvider’ => $dataProvider, ]); } There are buttons on the page that filter the information in ..

Read more

i have working with yii2 for many years and just don’t give a mean what im doing right now wrong, I need to create a simple relation between tags and post. i have created a 3 tables posts, tags_to_posts, tags. i add a relation from posts to tags between tags_to_posts. Here is my code: /** ..

Read more

I’m using Yii2-usuario for my user module. I ran the migrations found in "first step", and only changed from new DaUserModelUser() to new appmodelsuserModelUser() like this $user = new appmodelsuserModelUser([ ‘scenario’ => ‘create’, ’email’ => "[email protected]", ‘firstname’ => ‘first’, ‘lastname’ => ‘last’, ‘password’ => "verysecret" // >6 characters! ]); it populated my tables correctly. But ..

Read more