-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from morcov/fixing-belong-to-relation
Fixing belong to relation
- Loading branch information
Showing
2 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace SimonHamp\LaravelNovaCsvImport\Http\Requests; | ||
|
||
use Laravel\Nova\Http\Requests\NovaRequest; | ||
|
||
class ImportNovaRequest extends NovaRequest | ||
{ | ||
/** | ||
* @var | ||
*/ | ||
protected $importResource; | ||
|
||
/** | ||
* @param mixed $resource | ||
*/ | ||
public function setImportResource($resource): self | ||
{ | ||
$this->importResource = $resource; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get the class name of the resource being requested. | ||
* | ||
* @return class-string<\Laravel\Nova\Resource> | ||
* | ||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException | ||
*/ | ||
public function resource() | ||
{ | ||
return tap(once(function () { | ||
return $this->importResource; | ||
}), function ($resource) { | ||
abort_if(is_null($resource), 404); | ||
}); | ||
} | ||
} |