render searchbox relate icon css

This commit is contained in:
xiaomlove
2021-05-28 02:25:08 +08:00
parent 4cde957edb
commit 685a427c13
6 changed files with 38 additions and 10 deletions
+7 -4
View File
@@ -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);
}
}
+5
View File
@@ -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');
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace App\Models;
class Icon extends NexusModel
{
protected $table = 'caticons';
protected $fillable = ['name', 'folder', 'cssfile', 'multilang', 'secondicon', 'designer', 'comment'];
}
-3
View File
@@ -22,7 +22,4 @@ class SearchBox extends NexusModel
return $this->hasMany(SearchBoxField::class, 'searchbox_id');
}
}
+8
View File
@@ -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);
}
}
+7 -3
View File
@@ -2254,6 +2254,7 @@ function stdhead($title = "", $msgalert = true, $script = "", $place = "")
global $tstart;
global $Cache;
global $Advertisement;
global $browsecatmode;
$Cache->setLanguage($CURLANGDIR);
@@ -2322,10 +2323,13 @@ $cssupdatedate=($cssupdatedate ? "?".htmlspecialchars($cssupdatedate) : "");
<link rel="stylesheet" href="styles/curtain_imageresizer.css<?php echo $cssupdatedate?>" type="text/css" />
<?php
if ($CURUSER){
$caticonrow = get_category_icon_row($CURUSER['caticon']);
if($caticonrow['cssfile']){
// $caticonrow = get_category_icon_row($CURUSER['caticon']);
// if($caticonrow['cssfile']){
$icons = (new \App\Repositories\SearchBoxRepository())->listIcon($browsecatmode);
foreach ($icons as $icon) {
?>
<link rel="stylesheet" href="<?php echo htmlspecialchars($caticonrow['cssfile']).$cssupdatedate?>" type="text/css" />
<link rel="stylesheet" href="<?php echo htmlspecialchars(trim($icon['cssfile'], '/')).$cssupdatedate?>" type="text/css" />
<?php
}
}