/**
  * Load the list of available drinks
  */
 private function createDrinks()
 {
     //Three Different flavor soda
     Soda::addFlavor('Coke');
     Soda::addFlavor('Dr-Pepper');
     Soda::addFlavor('Sprite');
     //Three kind of milk
     Milk::addMilkType('Skim-Milk');
     Milk::addMilkType('Whole-Milk');
     Milk::addMilkType('2%-Milk');
 }
 public function edit(Request $request, $id = null)
 {
     if ($id) {
         $this->model = $this->model->findOrFail($id);
     }
     if ($request->get('parent_id')) {
         $parent = $this->model->find($request->get('parent_id'));
     }
     //we create a new menu block
     $this->model->fill($request->input());
     $this->model->application_id = \Soda::getApplication()->id;
     if (@$parent && !$this->model->id) {
         //create a new item and move it into a parent.
         //we need to move this item into the parent.
         $parent->addChild($this->model);
     } else {
         //otherwise, jsut assuem this is a root element I guess.
         $this->model->save();
     }
     return redirect()->route('soda.' . $this->hint . '.view', ['id' => $this->model->id])->with('success', 'updated');
 }
Beispiel #3
0
class Soda extends Producto
{
    public $sabor;
    function __construct($nombre = "", $precio = "", $descripcion = "", $sabor)
    {
        parent::__construct($nombre, $precio, $descripcion);
        $this->sabor = $sabor;
    }
    public function obtenerInfo()
    {
        return "Nombre del Producto: " . $this->nombre . " // Sabor: " . $this->sabor;
    }
}
$p = new Producto();
$camisa = new Producto("Camisa Espacial", 200, "Esta es una camisa Blanca Con Rayas Verdes");
$soda = new Soda("Soda Naranja", 20, "Esto es una soda", "naranja");
echo $soda->obtenerDistribuidor();
echo "</br>";
echo $camisa->obtenerDistribuidor();
echo "</br>";
echo $camisa::$distribuidor;
echo "</br>";
echo Producto::$distribuidor;
//Verificar si un metodo existe dentro de una clase.
echo "</br>";
echo method_exists("Producto", "obtenerDistribuidor");
// Verdadero
echo "</br>";
echo method_exists("Producto", "nada");
//Falso
echo "</br>";
Beispiel #4
0
    public function getInfo()
    {
        //return some info about the Product
        return "Product Name: " . $this->name;
    }
    public function getMaker()
    {
        return self::$manufacturer;
    }
}
class Soda extends Product
{
    public $flavor;
    function __construct($name, $price, $desc, $flavor)
    {
        parent::__construct($name, $price, $desc);
        $this->flavor = $flavor;
    }
    public function getInfo()
    {
        return "Product Name: " . $this->name . " Flavor: " . $this->flavor;
    }
}
$shirt1 = new Product("Space Juice T-shirt", 20, "Friggin great t-shirt");
$soda1 = new Soda("Space Juice Soda", 2, "Thirst Mutilator", "Grape");
echo $soda1->getInfo();
echo "<br><br>";
echo $shirt1->getInfo();
echo "<br><br>";
echo $shirt1::$manufacturer;
//die();
Beispiel #5
0
 public static function getFieldTypes()
 {
     return Soda::getFormBuilder()->getFieldTypes();
 }
Beispiel #6
0
function soda()
{
    return Soda::getInstance();
}
Beispiel #7
0
<?php

/**
 * Created by PhpStorm.
 * User: John Kagga
 * Date: 8/1/2015
 * Time: 9:53 AM
 */
include 'Product.php';
class Soda extends Product
{
    //inheriting from the product class
    public $flavor;
    //constructor
    function __construct($name, $price, $desc, $flavor)
    {
        parent::__construct($name, $price, $desc);
        $this->flavor = $flavor;
    }
    //method
    public function getInfo()
    {
        return "Product name: " . $this->name . "Flavor" . $this->flavor;
    }
}
$soda = new Soda("coca-cola", 2500, "Black in color", "coke");
echo $soda->getInfo();
    public $flavor;
    function __construct($nameNew, $price, $desc, $flavor)
    {
        parent::__construct($nameNew, $price, $desc);
        $this->flavor = $flavor;
    }
    public function getInfo()
    {
        return "Product Name: " . $this->name . " Flavor: " . $this->flavor;
    }
}
//$p = new Product();
// $p->name = "Space and Juice Soda";   BAD PRACTICE
// echo $p->name;
$shirt = new Product("Space Juice T-Shirt", 20, "Grey T-shirt");
$soda = new Soda("Space Juice Soda", 2, "Thirst Mutilator", "Grape");
echo $shirt->getInfo() . "<br>";
echo $soda->getInfo() . "<br>";
echo $shirt->getMaker() . "<br>";
echo $shirt::$manufacturer;
//OOP TOOLS
//True if method named getPrice in Product class (or $object)
return method_exists("Product", "getPrice");
//subclass
$s = new Soda();
is_subclass_of($s, "Product");
//Sub variables for Class Names
$class = "Product";
$p = new $class();
$m = "getName";
$name = $p->m();
Beispiel #9
0
@extends('soda::template')

@section('content')

    <?php 
$noice = Soda::aloha();
?>
    <h2>{{$noice}}</h2>

@stop