@extends('layouts.master')

@section('content')

<div>
	
@if ($type == 'songs')
	<h3 style="font-weight: 800;">نتائج الأغاني</h3>
	@if ($flag)
	<table class="table">
		@foreach ($with as $song)
		<tr>
			<td>
				<a href="/songs/{{ $song->slug }}">{{ $song->title }}</a>
				<?php $result = '' ;
					foreach($song->artists->all() as $artist) {
						$result .= $artist->name." & " ;
					}
					$result = substr($result, 0,-2) ;
				?>
				<small style="color: #888;">- {{ $result }}</small>
			</td>
		</tr>
		@endforeach
	</table>
	{{ $with->appends(['q' => $q, 'w' => 'songs'])->links() }}
	@else
	<p style="color: #888;">لا توجد نتائج</p>
	@endif

@elseif ($type == 'artists')
	<h3 style="font-weight: 800;">نتائج الفنانين</h3>
	@if ($flag)
	<table class="table">
		@foreach ($with as $artist)
		<tr>
			<td>
				<a href="/artist/{{ $artist->slug }}">{{ $artist->name }}</a>
			</td>
		</tr>
		@endforeach
	</table>
	{{ $with->appends(['q' => $q, 'w' => 'artists'])->links() }}
	@else
	<p style="color: #888;">لا توجد نتائج</p>
	@endif
@endif
	
</div>

@endsection
