recreate Proposals button/inbox, start of edit page
This commit is contained in:
@@ -20,7 +20,7 @@ class TableController extends Controller
|
||||
]);
|
||||
|
||||
/** @var Table $tableModel */
|
||||
$tableModel = $user->tables()->withCount(['favourites', 'forks', 'revisions', 'comments'])
|
||||
$tableModel = $user->tables()->withCount(['favourites', 'forks', 'revisions', 'comments', 'proposals'])
|
||||
->where('name', $table)->first();
|
||||
|
||||
if ($tableModel === null) abort(404, "No such table.");
|
||||
@@ -66,6 +66,17 @@ class TableController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
public function settings(Request $request, User $user, string $table)
|
||||
{
|
||||
/** @var Table $tableModel */
|
||||
$tableModel = $user->tables()->where('name', $table)->first();
|
||||
if ($tableModel === null) abort(404, "No such table.");
|
||||
|
||||
return view('table.edit', [
|
||||
'table' => $tableModel,
|
||||
]);
|
||||
}
|
||||
|
||||
public function storeNew(Request $request)
|
||||
{
|
||||
/** @var User $u */
|
||||
|
||||
@@ -21,7 +21,8 @@ use Illuminate\Database\Eloquent\Collection;
|
||||
* @property string $license
|
||||
* @property string $origin
|
||||
* @property int $visits
|
||||
* @property-read string $viewPage
|
||||
* @property-read string $viewRoute
|
||||
* @property-read string $settingsRoute
|
||||
* @property-read User $owner
|
||||
* @property-read Table $parentTable
|
||||
* @property-read Table[]|Collection $forks
|
||||
@@ -122,16 +123,20 @@ class Table extends BaseModel
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
if ($name == 'viewPage') {
|
||||
if ($name == 'viewRoute') {
|
||||
return route('table.view', ['user' => $this->cachedOwner()->name, 'table' => $this->name]);
|
||||
}
|
||||
|
||||
if ($name == 'settingsRoute') {
|
||||
return route('table.conf', ['user' => $this->cachedOwner()->name, 'table' => $this->name]);
|
||||
}
|
||||
|
||||
return parent::__get($name);
|
||||
}
|
||||
|
||||
public function scopeForList(Builder $query)
|
||||
{
|
||||
return $query->with('revision:id,row_count')->with('owner:id,name,title')
|
||||
->withCount(['favourites', 'forks', 'revisions']);
|
||||
->withCount(['favourites', 'forks', 'revisions', 'proposals']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user