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
Post a Comment