예제 #1
0
파일: Block.php 프로젝트: basdog22/laracms
 static function show($position)
 {
     $route = Route::getCurrentRoute();
     if (!is_null($route)) {
         $route = $route->getActionName();
     }
     //get the location for this route
     $grid = Grids::where('route', '=', $route)->first();
     if (!isset($grid->id)) {
         $grid = Grids::find(1);
     }
     $result = '';
     foreach ($grid->blocks()->where('block_position', '=', $position)->get() as $block) {
         $datas = Event::fire($block->event_to_fire, array(unserialize($block->params)));
         foreach ($datas as $data) {
             if (isset($data)) {
                 $result .= View::make($block->view_path)->with('data', $data);
             }
         }
     }
     return $result;
 }