public static function addCategory($category)
 {
     $cat = new \app\models\Categories();
     $cat->category = $category;
     if ($cat->save()) {
         return $cat->id;
     } else {
         return false;
     }
 }
Exemple #2
0
                    <li class="customers<?php 
if ($currentPage == "customers") {
    echo " active";
}
?>
"><a href="<?php 
echo Yii::$app->urlManager->createUrl("customers/index");
?>
">customers</a></li>
                    <li class="items<?php 
if ($currentPage == "items") {
    echo " active";
}
?>
"><a href="<?php 
echo Yii::$app->urlManager->createUrl(["items/index", 'cat' => app\models\Categories::find()->orderby('name')->one()->id]);
?>
">items</a></li>
                    <li class="reports"><a href="#">reports</a></li>
                    <li class="invoices"><a href="#">invoices</a></li>
                    <li class="orders"><a href="#">orders</a></li>
                    <li class="checkout"><a href="#">checkout</a></li>
                </ul>
            </div>
			<button class="visible-xs navbar-toggle collapsed menu-btn">
				<span class="sr-only">Toggle navigation</span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
			</button>
            <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 content">