How to call controller function in view page in Laravel 5 -


public function getpendingorder($id)  {     $pendingorder = db::table('erp_purchase_order_details')->where('product_category_id','=',$id)->where('received','=','0')->count();        return $pendingorder; } 

to access controller methods in laravel project can create object controller can call method of controller using created object

suppose have controller product , 1 method getpendingorders() method inside it:

class product extends basecontroller {     public static function getpendingorders($id)     {         $pendingorder = db::table('erp_purchase_order_details')- >where('product_category_id','=',$id)->where('received','=','0')->count();          return $pendingorder;      } } 

so in view can call method using :: example {{ product::getpendingorders(10); }}

another method create object of class , call method if not static.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -