Last active
October 25, 2016 07:08
-
-
Save maxca/971fa447a8cdb725f530847605ddee13 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(); | |
| /** dependency 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 helper and passing argument package_id **/ | |
| $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