mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
render searchbox relate icon css
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Console\Commands;
|
||||
use App\Models\Exam;
|
||||
use App\Models\ExamProgress;
|
||||
use App\Models\ExamUser;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\User;
|
||||
use App\Repositories\ExamRepository;
|
||||
use App\Repositories\SearchBoxRepository;
|
||||
@@ -66,10 +67,12 @@ class Test extends Command
|
||||
|
||||
// $rep = new SearchBoxRepository();
|
||||
// $r = $rep->initSearchBoxField(4);
|
||||
$imdb = new \Nexus\Imdb\Imdb();
|
||||
$imdb_id = 5768840;
|
||||
$r = $imdb->getMovie($imdb_id)->photo(true);
|
||||
dd($r);
|
||||
// $imdb = new \Nexus\Imdb\Imdb();
|
||||
// $imdb_id = 5768840;
|
||||
// $r = $imdb->getMovie($imdb_id)->photo(true);
|
||||
|
||||
$searchbox = (new SearchBoxRepository())->listIcon(4);
|
||||
dd($searchbox);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,4 +8,9 @@ class Category extends NexusModel
|
||||
protected $table = 'categories';
|
||||
|
||||
protected $fillable = ['mode', 'name', 'class_name', 'image', 'sort_index', 'icon_id'];
|
||||
|
||||
public function icon(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Icon::class, 'icon_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
|
||||
class Icon extends NexusModel
|
||||
{
|
||||
protected $table = 'caticons';
|
||||
|
||||
protected $fillable = ['name', 'folder', 'cssfile', 'multilang', 'secondicon', 'designer', 'comment'];
|
||||
}
|
||||
@@ -22,7 +22,4 @@ class SearchBox extends NexusModel
|
||||
return $this->hasMany(SearchBoxField::class, 'searchbox_id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\Icon;
|
||||
use App\Models\NexusModel;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\SearchBoxField;
|
||||
@@ -80,5 +81,12 @@ class SearchBoxRepository extends BaseRepository
|
||||
}
|
||||
}
|
||||
|
||||
public function listIcon($id)
|
||||
{
|
||||
$searchBox = SearchBox::query()->findOrFail($id);
|
||||
$iconIdArr = $searchBox->categories->pluck('icon_id')->unique();
|
||||
return Icon::query()->find($iconIdArr);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user