<?php
namespace App\Models;
//KitchenWares business logic Table
/*
*Table id == kitchen_id
*table key == spoons
*table key == bowls
*table key == plates
*/
use App\Models\KitchenWaresModel as SpoonModel;
use App\Models\KitchenWaresModel as BowlsModel;
use App\Models\KitchenWaresModel as PlatesModel;
class KitchenWaresController extends BaseController
{
//private ....
public function __construct() {
$this->SpoonModel = new SpoonModel();
$this->BowlsModel = new BowlsModel();
$this->PlatesModel = new PlatesModel();
}
public function spoon($spoons = null)
{
//here it shows nothing
$data['show_spoon']= $this->SpoonModel->where('spoons',$spoons)->orderBy('datetime','DESC')->findAll();
return view('kitchen/spoon',$data);
}
public function bowls($bowls = null)
{ //here it shows data from SpoonModel
$data['show_bowls']= $this->BowlsModel->where('bowls',$bowls)->orderBy('datetime','DESC')->findAll(12);
return view('kitchen/bowl',$data);
}
public function plates($plates =null)
{ //here it shows data from BowlsModel
$data['show_plate']= $this->PlatesModel->where('plates',$plates)->orderBy('datetime','DESC')->findAll();
return view('kitchen/plate',$data);
}
}
/*
*It works fine but with a different result
*/
/*
//The same as here???!!!
public function spoon($spoon = false)
{
if ($spoon === false) {
return $this->findAll();
}
return $this->asArray()
->where(['spoon' => $spoon])
->first();
}
*/