Skip to content

Instantly share code, notes, and snippets.

Cálcio calcio

Block or report user

Report or block calcio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@calcio
calcio / detailView.php
Created Mar 4, 2017
Example of GridView and DetailView in Yii 2
View detailView.php
<?= DetailView::widget([
'model' => $model,
'template' => '<tr><th class="col-sm-2">{label}</th> <td>{value}</td></tr>',
'attributes' => [
'full_name',
'date_born:date',
'address',
[
'attribute' => 'sex',
'value' => ($model->sex === 1) ? 'Male' : 'Female',
@calcio
calcio / m170104_184151_users.php
Created Mar 24, 2017
Migrate example - serie Vitrine project
View m170104_184151_users.php
<?php
use yii\db\Migration;
class m170104_184151_users extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
View m170203_135420_create_about_table.php
<?php
use yii\db\Migration;
/**
* Handles the creation of table `about`.
*/
class m170203_135420_create_about_table extends Migration
{
/**
View m170203_135455_create_categories_table.php
<?php
use yii\db\Migration;
/**
* Handles the creation of table `category`.
*/
class m170203_135455_create_categories_table extends Migration
{
/**
View m170317_124525_create_products_table.php
<?php
use yii\db\Migration;
/**
* Handles the creation of table `products`.
* Has foreign keys to the tables:
*
* - `category`
*/
View m170317_124609_create_product_images_table.php
<?php
use yii\db\Migration;
/**
* Handles the creation of table `product_images`.
*/
class m170317_124609_create_product_images_table extends Migration
{
/**
@calcio
calcio / web.php
Created Dec 9, 2017
Registering module admin in vitrine project
View web.php
<?php
$params = require(__DIR__ . '/params.php');
$config = [
'id' => 'vitrine',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'language' => 'pt-br',
'timezone' => 'America/Sao_Paulo',
@calcio
calcio / AdminAsset.php
Created Dec 18, 2017
Asset bundle do módulo admin
View AdminAsset.php
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace app\assets;
use yii\web\AssetBundle;
@calcio
calcio / backend.php
Created Dec 20, 2017
template backend projeto vitrine
View backend.php
<?php
/* @var $this \yii\web\View */
/* @var $content string */
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AdminAsset;
@calcio
calcio / modules\admin\controllers\DefaultController.php
Created Jan 18, 2018
Vitrine - Module Admin - DefaultController.php
View modules\admin\controllers\DefaultController.php
<?php
namespace app\modules\admin\controllers;
use Yii;
use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
use app\modules\admin\models\LoginForm;
You can’t perform that action at this time.