Sample code to demonstrate object retriever
This commit is contained in:
1 parent
249659e175
commit
8a5a77c164
3 files changed
+37
-3
No files matched your search
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use CloudObjects\SDK\ObjectRetriever;
|
||||
use ML\IRI\IRI;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index(ObjectRetriever $objectRetriever)
|
||||
{
|
||||
$object = $objectRetriever->getObject(new IRI('coid://cloudobjects.io'));
|
||||
$label = $object->getProperty('http://www.w3.org/2000/01/rdf-schema#label')->getValue();
|
||||
|
||||
return view('home', [
|
||||
'label' => $label
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{ config('app.name') }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>CloudObjects Demo Application</h1>
|
||||
<p>Here is a test property value retrieved from CloudObjects Core: {{ $label }}</p>
|
||||
</body>
|
||||
</html>
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\HomeController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
Route::get('/', [HomeController::class, 'index']);
|
||||
Reference in new issue
Block a user