/**
  * Display customer profile
  *
  * @param $profile
  * @return Response
  */
 public function show($profile)
 {
     $p = User::where('profile_url', '=', $profile)->where('approved', '=', '0')->first();
     $page = Page::where('title', '=', 'faq-customer')->first();
     $follow = Follow::where('user', $p->id)->where('hub', '=', 0)->get();
     $follow_hub = Follow::where('user', $p->id)->where('artist', '=', 0)->get();
     $wall = new \Illuminate\Database\Eloquent\Collection();
     $events = new \Illuminate\Database\Eloquent\Collection();
     $comments = Comment::where('user', '=', $p->id)->orderBy('created_at', 'desc')->get();
     $hidden = unserialize(Cookie::get('hide'));
     //dd( Cookie::get('hide') );
     if (count($follow) > 0) {
         foreach ($follow as $f) {
             $s = Song::where('artist', '=', $f->artist)->where('completed', '=', '1')->get();
             $e = ArtistEvent::where('artist', '=', $f->artist)->where('date', '>', \Carbon\Carbon::now())->get();
             $wall = $wall->merge($s);
             $events = $events->merge($e);
         }
     }
     if (count($follow_hub) > 0) {
         foreach ($follow_hub as $h) {
             $hub = Hub::where('id', '=', $h->hub)->first();
             if (!is_null($hub)) {
                 $artists = User::where('type', '=', 'artist')->where('hub', '=', $hub->id)->get();
                 $artists_list = [];
                 $songs = [];
                 $events = [];
                 foreach ($artists as $a) {
                     $artists_list[] = $a->id;
                 }
                 if (count($artists_list) > 0) {
                     $songs = Song::where('completed', '=', '1')->whereIn('artist', $artists_list)->orderBy('created_at', 'desc')->get();
                     $events = ArtistEvent::whereIn('artist', $artists_list)->get();
                 }
                 $news = News::where('hub', '=', $hub->id)->take(3)->get();
                 $wall = $wall->merge($songs);
                 $events = $events->merge($events);
             }
         }
     }
     $purchased = Purchase::where('customer', '=', $p->id)->get();
     foreach ($purchased as $pp) {
         $song_purchased = Song::withTrashed()->where('id', '=', $pp->song)->get();
         $download = Download::where('customer', '=', $p->id)->where('song', '=', $pp->song)->first();
         $song_purchased[0]->purchased = true;
         if (isset($download)) {
             $song_purchased[0]->link = $download->url;
         }
         $wall = $wall->merge($song_purchased);
     }
     $wall->sortByDesc('created_at');
     if (!isset($news)) {
         $news = null;
     }
     return View::make('customer.profile-new', ['profile' => $p, 'wall' => $wall, 'page' => $page, 'events' => $events, 'comments' => $comments, 'hidden' => $hidden, 'news' => $news]);
 }
 /**
  * Returns the song mp3 by id
  *
  * @param $id
  * @return Response
  */
 public function song_download($id)
 {
     $song = Song::withTrashed()->find($id);
     if ($song) {
         return Response::download($song->path . "/" . $song->sample . ".mp3");
     } else {
         App::abort('404');
     }
 }
示例#3
0
        if (Auth::user()->type == 'charity') {
            return Redirect::to('charity/settings');
        }
    }
    return Redirect::to('/');
});
Route::get('migrate', function () {
    Artisan::call('migrate', array('--force' => true));
});
Route::get('thumbnail/{id}', 'ArtistsController@showthumbnail');
Route::get('small/thumbnail/{id}', 'ArtistsController@smallthumbnail');
Route::get('socialize/{provider}', 'UsersController@socialize');
Route::get('download/{code}', function ($code) {
    $d = Download::where('url', '=', $code)->first();
    if (!is_null($d)) {
        $song = Song::withTrashed()->where('id', '=', $d->song)->first();
        if ($song) {
            $path = $song->path . "/" . $song->original_name;
            return Response::download($path, $song->title . ".mp3");
        } else {
            App::abort('404');
        }
    } else {
        App::abort('404');
    }
});
Route::get('admin', ['uses' => 'AdminController@index', 'before' => 'auth|admin']);
Route::post('admin', ['uses' => 'AdminController@index', 'before' => 'auth|admin']);
Route::get('admin/transaction/status/{id}', ['uses' => 'AdminController@change_status', 'before' => 'auth|admin']);
Route::get('admin/users', ['uses' => 'AdminController@list_users', 'before' => 'auth|admin']);
Route::get('admin/user/{id}/promote', ['uses' => 'AdminController@promote_user', 'before' => 'auth|admin']);