return $featuredProperties->get();
}
public function getPropertyByAlias(string $alias): Property
{
return $this->model->where('alias', $alias)->where('active', 1)->first();
}
public function getSimilarPropertiesByProperty(Property $property): Collection
{
$greaterPriceProperties = Property::where('category_id', $property->category_id)
$this->propertyRepository = $propertyRepository;
}
public function getPropertyByAlias(string $alias): Property
{
return $this->propertyRepository->getPropertyByAlias($alias);
}
public function getSimilarPropertiesByProperty(Property $property): Collection
{
return $this->propertyRepository->getSimilarPropertiesByProperty($property);
$this->propertyService = $propertyService;
}
public function index(Request $request): View
{
$property = $this->propertyService->getPropertyByAlias($request->route('propertyAlias'));
$propertyDescription = "{$property->category->plural_name}";
if (!empty($property->bedrooms) && $property->bedrooms > 0) {
$propertyDescription .= " com {$property->bedrooms} quarto" . ($property->bedrooms > 1 ? 's' : '');
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
});
}
/**
* Call a string reference to a class using Class@method syntax.
* @param mixed ...$args
* @return mixed
*/
public static function unwrapIfClosure($value, ...$args)
{
return $value instanceof Closure ? $value(...$args) : $value;
}
/**
* Get the class name of the given parameter's type, if possible.
*
if ($container->hasMethodBinding($method)) {
return $container->callMethodBinding($method, $callback[0]);
}
return Util::unwrapIfClosure($default);
}
/**
* Normalize the given callback into a Class@method string.
*
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
});
}
/**
$this->buildStack[] = $className;
$pushedToBuildStack = true;
}
$result = BoundMethod::call($this, $callback, $parameters, $defaultMethod);
if ($pushedToBuildStack) {
array_pop($this->buildStack);
}
*/
protected function callControllerCallable(callable $callable, array $parameters = [])
{
try {
return $this->prepareResponse(
$this->call($callable, $parameters)
);
} catch (HttpResponseException $e) {
return $e->getResponse();
}
}
if (count($middleware) > 0) {
return $this->callLumenControllerWithMiddleware(
$instance, $method, $routeInfo, $middleware
);
} else {
return $this->callControllerCallable(
[$instance, $method], $routeInfo[2]
);
}
}
if (! method_exists($instance = $this->make($controller), $method)) {
throw new NotFoundHttpException;
}
if ($instance instanceof LumenController) {
return $this->callLumenController($instance, $method, $routeInfo);
} else {
return $this->callControllerCallable(
[$instance, $method], $routeInfo[2]
);
}
protected function callActionOnArrayBasedRoute($routeInfo)
{
$action = $routeInfo[1];
if (isset($action['uses'])) {
return $this->prepareResponse($this->callControllerAction($routeInfo));
}
foreach ($action as $value) {
if ($value instanceof Closure) {
$callable = $value->bindTo(new RoutingClosure);
return $this->callActionOnArrayBasedRoute($this['request']->route());
}));
}
return $this->prepareResponse(
$this->callActionOnArrayBasedRoute($routeInfo)
);
}
/**
* Call the Closure or invokable on the array based route.
case Dispatcher::NOT_FOUND:
throw new NotFoundHttpException;
case Dispatcher::METHOD_NOT_ALLOWED:
throw new MethodNotAllowedHttpException($routeInfo[1]);
case Dispatcher::FOUND:
return $this->handleFoundRoute($routeInfo);
}
}
/**
* Handle a route found by the dispatcher.
if (isset($this->router->getRoutes()[$method.$pathInfo])) {
return $this->handleFoundRoute([true, $this->router->getRoutes()[$method.$pathInfo]['action'], []]);
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
->send($this->make('request'))
->through($middleware)
->then($then);
}
return $then($this->make('request'));
}
/**
* Prepare the response for sending.
*
[$method, $pathInfo] = $this->parseIncomingRequest($request);
try {
$this->boot();
return $this->sendThroughPipeline($this->middleware, function ($request) use ($method, $pathInfo) {
$this->instance(Request::class, $request);
if (isset($this->router->getRoutes()[$method.$pathInfo])) {
return $this->handleFoundRoute([true, $this->router->getRoutes()[$method.$pathInfo]['action'], []]);
}
* @param \Symfony\Component\HttpFoundation\Request|null $request
* @return void
*/
public function run($request = null)
{
$response = $this->dispatch($request);
if ($response instanceof SymfonyResponse) {
$response->send();
} else {
echo (string) $response;
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();
TypeError
|
---|
TypeError: App\Model\Repositories\PropertyRepository::getPropertyByAlias(): Return value must be of type App\Model\Entities\Property, null returned at /home/imobi239/public_html/app/Model/Repositories/PropertyRepository.php:68 at App\Model\Repositories\PropertyRepository->getPropertyByAlias() (/home/imobi239/public_html/app/Services/PropertyService.php:23) at App\Services\PropertyService->getPropertyByAlias() (/home/imobi239/public_html/app/Controllers/PropertyController.php:23) at App\Controllers\PropertyController->index() (/home/imobi239/public_html/vendor/illuminate/container/BoundMethod.php:36) at Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() (/home/imobi239/public_html/vendor/illuminate/container/Util.php:41) at Illuminate\Container\Util::unwrapIfClosure() (/home/imobi239/public_html/vendor/illuminate/container/BoundMethod.php:93) at Illuminate\Container\BoundMethod::callBoundMethod() (/home/imobi239/public_html/vendor/illuminate/container/BoundMethod.php:35) at Illuminate\Container\BoundMethod::call() (/home/imobi239/public_html/vendor/illuminate/container/Container.php:662) at Illuminate\Container\Container->call() (/home/imobi239/public_html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:391) at Laravel\Lumen\Application->callControllerCallable() (/home/imobi239/public_html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:356) at Laravel\Lumen\Application->callLumenController() (/home/imobi239/public_html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:331) at Laravel\Lumen\Application->callControllerAction() (/home/imobi239/public_html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:284) at Laravel\Lumen\Application->callActionOnArrayBasedRoute() (/home/imobi239/public_html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:269) at Laravel\Lumen\Application->handleFoundRoute() (/home/imobi239/public_html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:239) at Laravel\Lumen\Application->handleDispatcherResponse() (/home/imobi239/public_html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:174) at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}() (/home/imobi239/public_html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:431) at Laravel\Lumen\Application->sendThroughPipeline() (/home/imobi239/public_html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:167) at Laravel\Lumen\Application->dispatch() (/home/imobi239/public_html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:112) at Laravel\Lumen\Application->run() (/home/imobi239/public_html/public/index.php:38) |