コード例 #1
0
ファイル: admin.php プロジェクト: ajb/rfpez
 public function action_officers()
 {
     $view = View::make('admin.officers');
     $view->officers = Officer::paginate(10);
     $view->officers_json = eloquent_to_json($view->officers->results);
     $this->layout->content = $view;
 }
コード例 #2
0
ファイル: admin.php プロジェクト: ajb/rfpez
 /**
  * Gets the item edit page / information
  *
  * @param string	$modelName
  * @param mixed		$itemId
  */
 public function action_item($modelName, $itemId = false)
 {
     //try to get the object
     $model = ModelHelper::getModel($modelName, $itemId, true);
     //if it's ajax, we just return the item information as json
     //otherwise we load up the index page and dump values into
     if (Request::ajax()) {
         return eloquent_to_json($model);
     } else {
         $view = View::make("administrator::index", array("modelName" => $modelName, "model" => $model));
         //set the layout content and title
         $this->layout->modelName = $modelName;
         $this->layout->content = $view;
     }
 }
コード例 #3
0
ファイル: admin.php プロジェクト: SerdarSanri/admin
 /**
  * Gets the item edit page / information
  *
  * @param ModelConfig	$config
  * @param mixed			$itemId
  */
 public function action_item($config, $itemId = false)
 {
     //try to get the object
     $model = ModelHelper::getModel($config, $itemId, true);
     //if it's ajax, we just return the item information as json
     //otherwise we load up the index page and dump values into
     if (Request::ajax()) {
         return eloquent_to_json($model);
     } else {
         //if the $itemId is false, we can assume this is a request for /new
         //if the user doesn't have the proper permissions to create, redirect them back to the model page
         if (!$itemId && !$config->actionPermissions['create']) {
             return Redirect::to_route('admin_index', array($config->name));
         }
         $view = View::make("administrator::index", array('config' => $config, 'model' => $model));
         //set the layout content and title
         $this->layout->content = $view;
     }
 }
コード例 #4
0
 /**
  * Create a new response of JSON'd Eloquent models.
  *
  * <code>
  *		// Create a new response instance with Eloquent models
  *		return Response::eloquent($data, 200, array('header' => 'value'));
  * </code>
  *
  * @param  Eloquenet|array  $data
  * @param  int              $status
  * @param  array            $headers
  * @return Response
  */
 public static function eloquent($data, $status = 200, $headers = array())
 {
     $headers['Content-Type'] = 'application/json';
     return new static(eloquent_to_json($data), $status, $headers);
 }
コード例 #5
0
ファイル: warehousescenter.php プロジェクト: acmadi/diantaksi
 public function get_partlist()
 {
     $ppid = Input::get('ppid');
     $datas = Requestsparepartitem::join('spareparts', 'spareparts.id', '=', 'request_sparepart_items.sparepart_id')->where('request_sparepart_id', '=', $ppid)->get(array('request_sparepart_items.id', 'request_sparepart_items.qty', 'request_sparepart_items.ket', 'spareparts.name_sparepart', 'spareparts.part_number', 'request_sparepart_items.sparepart_id'));
     return eloquent_to_json($datas);
 }
コード例 #6
0
ファイル: projects.php プロジェクト: ajb/rfpez
 public function action_admin()
 {
     $view = View::make('projects.admin');
     $view->project = Config::get('project');
     $view->collaborators_json = eloquent_to_json($view->project->officers()->get());
     $this->layout->content = $view;
 }