Esempio n. 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;
 }
Esempio n. 2
0
 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]);
 }
Esempio n. 3
0
 public static function findByUserAndId($user, $id)
 {
     return App::where('id', '=', $id)->where('user_id', '=', $user->id)->firstOrFail();
 }