コード例 #1
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if ($this->route('app')) {
         $id = $this->route('app');
         $user = $this->user();
         return App::where('id', '=', $id)->where('user_id', '=', $user->id)->exists();
     }
     return $this->user() ? true : false;
 }
コード例 #2
0
ファイル: IndexController.php プロジェクト: kevinwan/che123
 public function appView($app_id)
 {
     $appInfo = App::dataHandle(App::find($app_id));
     if (!$appInfo) {
         header('Location:' . action('App\\Http\\Controllers\\HomeController@index'));
     }
     $commendApps = App::dataHandle(App::where('category_id', '=', $appInfo->category_id)->where('id', '!=', $app_id)->orderBy('download', 'desc')->take(4)->get());
     return view('index.appView')->with(['appInfo' => $appInfo, 'commendApps' => $commendApps]);
 }
コード例 #3
0
ファイル: App.php プロジェクト: hcvst/telegramlogin
 public static function findByUserAndId($user, $id)
 {
     return App::where('id', '=', $id)->where('user_id', '=', $user->id)->firstOrFail();
 }