PHP code example of formfeed-uk / nova-resource-cards
1. Go to this page and download the library: Download formfeed-uk/nova-resource-cards library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
formfeed-uk / nova-resource-cards example snippets
// MyResourceCard.php
...
use Formfeed\ResourceCards\ResourceCard;
class MyResourceCard extends ResourceCard {
...
}
// MyNovaResource.php
use App\MyResourceCard;
...
class MyNovaResource extends Resource {
...
public function cards(NovaRequest $request) {
return [
MyResourceCard::make($request)
];
}
...
}
public function cards(NovaRequest $request) {
return [
MyResourceCard::make($request)
->onlyOnForms()
->canSee(function ($request) {
return $request->user()->role === "admin";
}),
];
}