本文整理汇总了PHP中Song::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Song::where方法的具体用法?PHP Song::where怎么用?PHP Song::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Song
的用法示例。
在下文中一共展示了Song::where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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]);
}
示例2: getSongs
function getSongs($perPage = 5)
{
Debugbar::log(isVoteRunning());
global $artist;
$artist = Input::get("artist");
$title = Input::get("title");
$data = Song::where(function ($q) {
global $artist;
$q->where('artist', 'LIKE', "%{$artist}%");
})->where('title', 'LIKE', "%{$title}%", 'AND')->orderBy('updated_at', 'DESC')->paginate($perPage);
return Response::json($data);
}
示例3: show
public function show($slug)
{
$hub = Hub::where('slug', '=', $slug)->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();
return View::make('hubs.main', ['hub' => $hub, 'news' => $news, 'artists' => $artists, 'songs' => $songs, 'events' => $events]);
}
App::abort(404);
}
示例4: show
/**
* Show charity profile
*
* @param int $charity
*
* @return Response
*
*/
public function show($charity)
{
$profile = User::where('profile_url', '=', $charity)->where('approved', '=', '0')->first();
if ($profile->charity) {
$page = Page::where('title', '=', 'faq-charity')->first();
$songs = Song::where('charity', $profile->charity->id)->where('charity_approved', '=', 1)->orderBy('created_at', 'desc')->get();
$songs_in = [];
$approval = Song::where('charity', $profile->charity->id)->where('charity_approved', '=', 0)->get();
foreach ($songs as $s) {
$songs_in[] = $s->id;
}
if (count($songs_in) > 0) {
$comments = Comment::whereIn('song', $songs_in)->orderBy('id', 'desc')->take(3)->get();
} else {
$comments = "";
}
return View::make('charity.profile-new', ['profile' => $profile, 'wall' => $songs, 'page' => $page, 'comments' => $comments, 'approval' => $approval]);
} else {
return Redirect::to('charity/settings');
}
}
示例5: showprofile
/**
* Show artist profile
*
* return @Response
*/
public function showprofile($user)
{
$profile = User::where('profile_url', '=', $user)->where('approved', '=', '0')->where('deleted_at', '=', null)->first();
if (!is_null($profile)) {
$activation = Activation::where('user', '=', $profile->id)->first();
$page = Page::where('title', '=', 'faq-artist')->first();
$transactions = Purchase::where('artist', '=', $profile->id)->get();
if ($activation) {
return View::make('artist.not-activated');
} else {
if ($profile) {
if ($profile->active == 1) {
$songs = Song::where('artist', '=', $profile->id)->where('completed', '=', '1')->orderBy('id', 'desc')->paginate(10);
$bundles = Bundle::where('artist', '=', $profile->id)->get();
$wall = new \Illuminate\Database\Eloquent\Collection();
$wall = $wall->merge($songs);
$wall = $wall->merge($bundles);
//dd($wall);
$followers = Follow::where('artist', '=', $profile->id)->get();
$countries = [];
foreach ($followers as $f) {
if (empty($f->profile->country)) {
$f->profile->country = 'Country unknown';
}
if (isset($countries[$f->profile->country])) {
$countries[$f->profile->country]++;
} else {
$countries[$f->profile->country] = 1;
}
}
$events = ArtistEvent::where('artist', '=', $profile->id)->where('date', '>', \Carbon\Carbon::now())->orderBy('id', 'desc')->take(3)->get();
$songs_in = [];
foreach ($songs as $s) {
$songs_in[] = $s->id;
}
if (count($songs_in) > 0) {
$comments = Comment::whereIn('song', $songs_in)->orderBy('id', 'desc')->take(3)->get();
} else {
$comments = "";
}
$wall->sortByDesc('created_at');
//dd($wall);
$notifications = MyNotification::where('user', '=', $profile->id)->get();
return View::make('artist.profile-new', ['profile' => $profile, 'songs' => $songs, 'events' => $events, 'comments' => $comments, 'notifications' => $notifications, 'wall' => $wall, 'page' => $page, 'transactions' => $transactions, 'countries' => $countries]);
} else {
return Redirect::to('profile/settings');
}
} else {
App::abort(404);
}
}
} else {
App::abort(404);
}
}
示例6: promote_user
/**
* Display User Promotion Form
*
* @return Response
*/
public function promote_user($id)
{
$user = User::find($id);
$songs = Song::where('artist', '=', $user->id)->where('completed', '=', 1)->get();
return View::make('admin.user-promote', ['songs' => $songs, 'artist' => $user]);
}