You've already forked Atomcms-edit
Improvements: fix duplicate seeder, add missing seeders, remove redundant $with, add migration down(), optimize queries
This commit is contained in:
@@ -22,7 +22,7 @@ class ContentApiController extends Controller
|
||||
|
||||
public function settings(): JsonResponse
|
||||
{
|
||||
$settings = Cache::remember('api_all_settings', 60, fn () => WebsiteSetting::all()->pluck('value', 'key'));
|
||||
$settings = Cache::remember('api_all_settings', 60, fn () => WebsiteSetting::pluck('value', 'key'));
|
||||
|
||||
return response()->json(['data' => $settings]);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ class ArticleController extends Controller
|
||||
|
||||
public function show(WebsiteArticle $article): View
|
||||
{
|
||||
$article->load('user:id,username,look');
|
||||
|
||||
$reactions = $article->reactions()
|
||||
->with('user:id,username')
|
||||
->get();
|
||||
|
||||
@@ -111,7 +111,8 @@ class InstallationController extends Controller
|
||||
|
||||
private function getSettingsForStep(int $step): Collection
|
||||
{
|
||||
$settingsData = array_chunk(WebsiteSetting::all()->pluck('key')->toArray(), (int) ceil(WebsiteSetting::count() / 4));
|
||||
$allKeys = WebsiteSetting::pluck('key')->toArray();
|
||||
$settingsData = array_chunk($allKeys, (int) ceil(count($allKeys) / 4));
|
||||
|
||||
$settings = match ($step) {
|
||||
1 => $settingsData[0] ?? [],
|
||||
|
||||
@@ -44,10 +44,6 @@ class WebsiteArticle extends Model
|
||||
use BelongsToUser;
|
||||
use HasSlug, \Illuminate\Database\Eloquent\Factories\HasFactory, SoftDeletes;
|
||||
|
||||
/** @var array<int, string> */
|
||||
#[\Override]
|
||||
protected $with = ['user'];
|
||||
|
||||
protected static function newFactory()
|
||||
{
|
||||
return WebsiteArticleFactory::new();
|
||||
|
||||
@@ -41,10 +41,6 @@ class WebsiteHelpCenterTicket extends Model
|
||||
#[\Override]
|
||||
protected $guarded = ['id', 'created_at', 'updated_at', 'user_id', 'status', 'subject', 'category_id'];
|
||||
|
||||
/** @var array<int, string> */
|
||||
#[\Override]
|
||||
protected $with = ['user', 'category'];
|
||||
|
||||
#[\Override]
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
@@ -13,10 +13,6 @@ class RadioShout extends Model
|
||||
use BelongsToUser;
|
||||
use HasFactory;
|
||||
|
||||
/** @var array<int, string> */
|
||||
#[\Override]
|
||||
protected $with = ['user'];
|
||||
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
|
||||
Reference in New Issue
Block a user