Exemple #1
0
 public function boot()
 {
     Event::listen('cms.page.display', function ($controller, $url, $page, $result) {
         preg_match_all("/\\:[a-zA-Z]+\\:/", $result, $array);
         if (count($array[0]) > 0) {
             $shortcodes = Code::all();
             foreach ($shortcodes as $shortcode) {
                 $result = preg_replace("/\\:{$shortcode->identity}\\:/", $shortcode->content, $result);
             }
         }
         return $result;
     });
 }
 public function run()
 {
     $code = Code::create(['identity' => 'teste', 'content' => '<h2>teste</h2>']);
 }