Welcome Guest, Not a member yet? Register   Sign In
Why This Model Shows These Result?
#1

(This post was last modified: 06-13-2022, 04:21 AM by luckmoshy.)

Hi, gentle buddies Here I face this issue on this model where is wrong? thank you

PHP Code:
<?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();
}
*/ 
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply


Messages In This Thread
Why This Model Shows These Result? - by luckmoshy - 06-13-2022, 03:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB