Last active
October 25, 2016 07:08
-
-
Save maxca/1a03676b1abf849bb50399528cf03d1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php namespace App\Http\Controllers\; | |
| use App\Http\Controllers\FrontendController; | |
| /** alias name servicePackageInterface as packge **/ | |
| use App\Repositories\Interfaces\servicePackageInterface as packge; | |
| use App\Repositories\Storage\servicePackageRepository as packageRepository; | |
| class PackageController extends FrontendController | |
| { | |
| private $packge; | |
| private $packageRepository; | |
| /** typing hiting packageRepository **/ | |
| public function __construct(packageRepository $packageRepository) | |
| { | |
| parent::__construct(); | |
| /** dependecy injection **/ | |
| $this->packageRepository = $packageRepository; | |
| } | |
| /** | |
| # package instants of servicePackageInterface | |
| # package id get by uri segment | create by route file | |
| **/ | |
| public function Package(packge $packge, $package_id = 0) | |
| { | |
| try { | |
| /** using by class **/ | |
| $package = \App::make('App\Repositories\servicePackageRepository',['packge_id' => $packge_id]); | |
| } catch (\Exception $e) { | |
| return \Response::json(['code' => 400, 'line' => $e->getLine(), 'file' => $e->getFile(), 'msg' => $e->getMessage()]); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment