chore: code style
This commit is contained in:
+10
-12
@@ -2,18 +2,16 @@
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use App\Models\Holding;
|
||||
use App\Models\Portfolio;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class Spotlight
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
|
||||
|
||||
$results = collect();
|
||||
|
||||
if (!$request->user()) {
|
||||
if (! $request->user()) {
|
||||
|
||||
return $results;
|
||||
}
|
||||
@@ -22,13 +20,13 @@ class Spotlight
|
||||
->where('title', 'LIKE', '%'.$request->input('search').'%')
|
||||
->limit(5)
|
||||
->get();
|
||||
$portfolios->each(function($portfolio) use ($results) {
|
||||
$portfolios->each(function ($portfolio) use ($results) {
|
||||
|
||||
$results->push([
|
||||
'name' => 'Portfolio: '. $portfolio->title,
|
||||
'name' => 'Portfolio: '.$portfolio->title,
|
||||
'description' => null,
|
||||
'link' => route('portfolio.show', ['portfolio' => $portfolio->id]),
|
||||
'avatar' => null
|
||||
'avatar' => null,
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -36,20 +34,20 @@ class Spotlight
|
||||
->where('holdings.quantity', '>', 0)
|
||||
->where(function ($query) use ($request) {
|
||||
return $query->where('holdings.symbol', 'LIKE', '%'.$request->input('search').'%')
|
||||
->orWhere('market_data.name', 'LIKE', '%'.$request->input('search').'%');
|
||||
->orWhere('market_data.name', 'LIKE', '%'.$request->input('search').'%');
|
||||
})
|
||||
->limit(5)
|
||||
->get();
|
||||
$holdings->each(function($holding) use ($results) {
|
||||
$holdings->each(function ($holding) use ($results) {
|
||||
|
||||
$results->push([
|
||||
'name' => 'Holding: '.$holding->market_data->name.' ('.$holding->symbol.')',
|
||||
'description' => $holding->portfolio->title,
|
||||
'link' => route('holding.show', ['portfolio' => $holding->portfolio->id, 'symbol' => $holding->symbol]),
|
||||
'avatar' => null
|
||||
'avatar' => null,
|
||||
]);
|
||||
});
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user