PHP code example of masmerise / scrada-for-laravel
1. Go to this page and download the library: Download masmerise/scrada-for-laravel 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/ */
// Resolve a Scrada instance for a specific company
$company = scrada('default')->company->get($id);
// Resolve the manager and use the default company
$scrada = app('scrada');
$company = $scrada->company('default')->company->get($id);
use Scrada\Company\Type\Primitive\CompanyId;
use Scrada\Laravel\ScradaManager;
final readonly class CompanyController
{
private function __construct(private ScradaManager $scrada) {}
public function show(string $company, string $id): void
{
$id = CompanyId::fromString($id);
return view('company.show', [
'company' => $this->scrada->company($company)->company->get($id),
]);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.