fixed descriptions
This commit is contained in:
parent
147d680c4a
commit
657f4d67bb
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
namespace Beike\Admin\Http\Controllers;
|
namespace Beike\Admin\Http\Controllers;
|
||||||
|
|
||||||
|
use Beike\Models\Page;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Beike\Admin\Repositories\PageRepo;
|
use Beike\Admin\Repositories\PageRepo;
|
||||||
|
|
||||||
|
|
@ -33,6 +34,7 @@ class PagesController
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'page' => PageRepo::findByPageId($pageId),
|
'page' => PageRepo::findByPageId($pageId),
|
||||||
|
'descriptions' => PageRepo::getDescriptionsByLocale($pageId),
|
||||||
];
|
];
|
||||||
return view('admin::pages.pages.form', $data);
|
return view('admin::pages.pages.form', $data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,13 @@ class PageRepo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function getDescriptionsByLocale($pageId)
|
||||||
|
{
|
||||||
|
$page = self::findByPageId($pageId);
|
||||||
|
return $page->descriptions->keyBy('locale');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function createOrUpdate($data)
|
public static function createOrUpdate($data)
|
||||||
{
|
{
|
||||||
$id = $data['id'] ?? 0;
|
$id = $data['id'] ?? 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue