(Yii2-basic) What's the best way to pass the view data from the admin module to the site's frontend

I’m quite new to Yii2 and I’m using Yii2-basic. I made an admin module with its CRUD feature (simple CMS). Let’s say in this case we’re talking about the “About-us” page. The admin module have the basic view pages : search,form, create,update,delete,view, index.

What is the best way to pass the view to the “frontend” where anyone can see from the admin module’s “backend” view? The view’s content of the admin’s module and the “frontend” is the same, only the layout is different. (Please keep in mind I’m using the the basic version so it doesn’t have actual front-end and backend tho )

I’m doing it this way :
In SiteController.php

        use app\models\About;    
        .....

         public function actionAbout()
            {

         $about = About::find()->one();

         return $this->render('about', [

                        'model'=>$about
                    ]);
            }

    .....
    //do the same with the other controllers for other pages

.....

the view (about page’s “frontend”)

  <?=$model->Content; ?>

It actually works, but I’m wondering if it’s the best way to do so. Or is it better to directly pass the view data from the admin module’s view to the ‘front-end’ view? If so, how to do that? Thank you in advance!

LGTM

Btw, while you may, you don’t need to separate front and back ends. You can just have some pages (routes) that only admins are allowed to access. That’s what I do.

nothing wrong with your current approach in fact you will find lot of the apps use the same approach, I use it for lot of my apps it is good way to separate your secured routes from you public routes.

what @thefsb mentioned might work as well if you don’t wanna duplicate the logic.