Example #1
0
 /**
  * Page header blade directive compiler.
  * @pageHeader($title, $description, $icon, $template)
  *
  * @param string|array $styles
  * @param null $category
  * @param string $group
  */
 public function handle($styles, $group = 'footer', $category = null)
 {
     foreach ((array) $styles as $style) {
         if (!str_contains('.css', $style)) {
             $style .= ".css";
         }
         /** @var \Yajra\CMS\Entities\FileAsset $getData */
         $getData = app(Repository::class)->getByName($style, $category);
         Asset::add($getData ? $getData->url : $style, $group, $category);
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function getLayout($id)
 {
     Asset::add(['common/js/jquery.gridster.with-extras.js', 'admin/js/layout.js', 'common/css/gridster.min.css']);
     $page = Page::whereId($id)->first();
     foreach ($page->widgets as &$widget) {
         if ($widget->widget_name == 'text') {
             $text = Text::whereId($widget->widget_id)->first();
             $widget['title'] = $text['title'];
             $widget['text'] = $text['text'];
         }
     }
     return view('admin.pages.layout', ['page' => $page]);
 }
Example #3
0
 public function testCachebusterFunction()
 {
     Asset::$js = array();
     Asset::$css = array();
     function _hash($name)
     {
         if ($name == '1.js') {
             return '';
         }
         if ($name == '2.css') {
             return null;
         }
         return substr($name, 0, 1);
     }
     Asset::setCacheBusterGeneratorFunction('_hash');
     Asset::add(array('1.js', '2.js', '3.js'));
     Asset::add(array('1.css', '2.css', '3.css'));
     $this->expectOutputString('/1.js,/2.js?2,/3.js?3,/1.css?1,/2.css,/3.css?3,', Asset::jsRaw(','), Asset::cssRaw(','));
 }
 /**
  * Create a new controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     $this->middleware('guest');
     Asset::add(['common/js/jquery-2.1.4.min.js', 'common/js/bootstrap.min.js', 'http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', 'https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.5/flatly/bootstrap.min.css']);
 }
 /**
  * Add the asset using our version of the exliser loader.
  *
  * @param string $file
  * @param string $params
  * @param bool   $onUnknownExtension
  *
  * @return void
  */
 public function add($file, $params = 'footer', $onUnknownExtension = false)
 {
     Asset::add($this->elixir($file), $params, $onUnknownExtension);
 }