git: 🐛 get only path of url from getAccessModel method
This commit is contained in:
parent
6edc1e4271
commit
0e8a9cf0ac
2 changed files with 6 additions and 6 deletions
|
|
@ -120,15 +120,15 @@ class InputsController extends Controller
|
|||
*
|
||||
* @param integer $modelId Id of the target model.
|
||||
* @param integer $modelName Name of the target model.
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
private function getAccessModel(int $modelId, string $modelName): string
|
||||
private function getAccessModel(int $modelId, string $modelName): string|null
|
||||
{
|
||||
$targetModel = $this->getClassFromTableName($modelName)::getModelsCached()->firstWhere('id', $modelId);
|
||||
if (!$targetModel) {
|
||||
return null;
|
||||
}
|
||||
return route("front.$modelName.show", $targetModel->slug);
|
||||
return parse_url(route("front.$modelName.show", $targetModel->slug), PHP_URL_PATH) ?? "/";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -304,16 +304,16 @@ class DynamicPage extends Model implements TranslatableModel
|
|||
* Get the url to access a specific resource.
|
||||
*
|
||||
* @param integer $id Id field of the target model.
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getAccessModel(int $id): string
|
||||
public static function getAccessModel(int $id): string|null
|
||||
{
|
||||
$targetModel = self::getModelsCached()->firstWhere('id', $id);
|
||||
if (!$targetModel) {
|
||||
return null;
|
||||
}
|
||||
$url = RouteHelper::routeNameChecker("front.dynamic-pages.{$targetModel->id_key}");
|
||||
return parse_url($url, PHP_URL_PATH);
|
||||
return parse_url($url, PHP_URL_PATH) ?? "/";
|
||||
}
|
||||
|
||||
// * RELATIONSHIPS
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue