当前位置: 首页>>代码示例>>PHP>>正文


PHP Song::withTrashed方法代码示例

本文整理汇总了PHP中Song::withTrashed方法的典型用法代码示例。如果您正苦于以下问题:PHP Song::withTrashed方法的具体用法?PHP Song::withTrashed怎么用?PHP Song::withTrashed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Song的用法示例。


在下文中一共展示了Song::withTrashed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show

 /**
  * 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]);
 }
开发者ID:centaurustech,项目名称:musicequity,代码行数:62,代码来源:CustomerController.php

示例2: song_download

 /**
  * 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');
     }
 }
开发者ID:centaurustech,项目名称:musicequity,代码行数:15,代码来源:ArtistsController.php

示例3: function

        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']);
开发者ID:centaurustech,项目名称:musicequity,代码行数:31,代码来源:routes.php


注:本文中的Song::withTrashed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。