MenuController.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Http\Controllers;
  3. use EasyWeChat\Foundation\Application;
  4. use Illuminate\Http\Request;
  5. class MenuController extends Controller
  6. {
  7. public $menu;
  8. public function __construct(Application $app) {
  9. $this->menu = $app->menu;
  10. }
  11. public function menu() {
  12. $buttons = [
  13. [
  14. "type" => "view",
  15. "name" => "微信投票",
  16. "url" => "http://vote.9026.com/"
  17. ],
  18. // [
  19. // "name" => "二级菜单",
  20. // "sub_button" => [
  21. // [
  22. // "type" => "view",
  23. // "name" => "登录",
  24. // "url" => "http://test.shawns.me/user"
  25. // ],
  26. // [
  27. // "type" => "view",
  28. // "name" => "视频",
  29. // "url" => "http://v.qq.com/"
  30. // ],
  31. // [
  32. // "type" => "click",
  33. // "name" => "赞一下我们",
  34. // "key" => "V1001_GOOD"
  35. // ],
  36. // ],
  37. // ],
  38. ];
  39. $this->menu->add($buttons);
  40. }
  41. }