Laravel 如何在blade中创建包含页面的短代码

Laravel 如何在blade中创建包含页面的短代码,laravel,shortcode,Laravel,Shortcode,我想为我的Laravel项目创建短代码系统,以便在另一个页面中包含一个页面 有人有办法吗 [include]test[/include] -> @include('test'); 这可能是你想要的 比如: class IncludeShortcode { public function register($shortcode, $content, $compiler, $name) { return view($content); } } Shortcode

我想为我的Laravel项目创建短代码系统,以便在另一个页面中包含一个页面

有人有办法吗

[include]test[/include]  ->   @include('test');
这可能是你想要的

比如:

class IncludeShortcode {

  public function register($shortcode, $content, $compiler, $name)
  {
    return view($content);
  }
}

Shortcode::register('include', 'IncludeShortcode');
没有经过测试,但应该能让你朝着正确的方向前进