add revision reverting option
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\Reportable;
|
||||
use function GuzzleHttp\Psr7\build_query;
|
||||
use http\QueryString;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
@@ -153,6 +155,28 @@ class Table extends BaseModel
|
||||
return parent::__get($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get route to some action (so we dont have to add xxRoute for everything)
|
||||
*
|
||||
* @param $action
|
||||
* @param array $getargs
|
||||
* @return string
|
||||
*/
|
||||
public function actionRoute($action, $getargs = [])
|
||||
{
|
||||
$user = $this->cachedOwner()->name;
|
||||
$table = $this->name;
|
||||
|
||||
$base = "/@$user/$table";
|
||||
if ($action != 'view') $base .= "/$action";
|
||||
|
||||
if ($getargs) {
|
||||
return $base . '?' . build_query($getargs);
|
||||
} else {
|
||||
return $base;
|
||||
}
|
||||
}
|
||||
|
||||
public function getDraftRoute($tab=null)
|
||||
{
|
||||
return route('table.draft', [
|
||||
|
||||
Reference in New Issue
Block a user