Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Started demo of backend app #339

Merged
merged 4 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@
"$providers",
"providers-console.php"
],
"routes": "routes.php",
"routes": [
"routes-backend.php",
"routes.php"
],
"bootstrap": "bootstrap.php",
"bootstrap-web": [
"$bootstrap",
Expand Down
12 changes: 12 additions & 0 deletions config/routes-backend.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

use Yiisoft\Router\Route;

return [
Route::get('/app')
samdark marked this conversation as resolved.
Show resolved Hide resolved
->action([\App\Backend\Controllers\SiteController::class, 'index'])
->name('backend/index')
->host('backend.{_host}'),
];
25 changes: 25 additions & 0 deletions src/Backend/Controllers/SiteController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace App\Backend\Controllers;
githubjeka marked this conversation as resolved.
Show resolved Hide resolved

use Psr\Http\Message\ResponseInterface;
use Yiisoft\Yii\View\ViewRenderer;

class SiteController
{
private ViewRenderer $viewRenderer;

public function __construct(ViewRenderer $viewRenderer)
{
$this->viewRenderer = $viewRenderer
->withController($this)
->withViewPath(__DIR__ . '/../views');
}

public function index(): ResponseInterface
{
return $this->viewRenderer->render('index');
}
}
51 changes: 51 additions & 0 deletions src/Backend/views/site/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
githubjeka marked this conversation as resolved.
Show resolved Hide resolved

declare(strict_types=1);

use Yiisoft\View\WebView;

/** @var WebView $this */
$this->setTitle('Backend');
?>


<div class="card mt-3 col-md-8">
<div class="card-body">
<h2 class="card-title">Welcome to backend</h2>
</div>
</div>

<div class="card mt-3 col-md-8">
<div class="card-body">
Just example table
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td colspan="2">Larry the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
</div>
</div>