Looks for a data table by its slug. Returns an Eloquent query builder, on which you can chain to fetch what you need:
table('products')->where('published', 1)->orderBy('title')->get();
Looks for a page by its slug, or returns the current page when the slug is omitted:
// Current page
page();
// Home page
page('home');
Returns an Eloquent query builder for the page table:
pages()->whereIn('slug', ['home', 'about', 'contact'])->get();
Looks for a global set by its slug. Returns an object to access the global values:
globals('general')->website_title;
Returns a collection of the languages of the project:
@foreach (languages() as $language)
<a href="{{ $language->url() }}">{{ $language->name }}</a>
@endforeach
Looks for a language by its slug, or returns the current language when the slug is omitted:
// Current language
language();
// Dutch language
language('nl');
Returns a list of items, representing the breadcrumb path of the current page. Also works with dynamic pages:
@foreach (breadcrumbs() as $breadcrumb)
<a href="{{ $breadcrumb->url() }}">{{ $breadcrumb->title() }}</a>
@endforeach
Returns the data entry corresponding with the current URL. This only works on dynamic pages and will return null
on non-dynamic pages.
<h1>{{ entry()->title }}</h1>
Looks for a mail by its slug, to use in Livewire components. Several methods are available:
mail('subscription')
->to('name@example.com')
->cc('info@devisto.com')
->bcc('klaas@devisto.com')
->replyTo('klaas@devisto.com')
->parameter('name', $this->name)
->parameters(['name' => $this->name])
->send();
For more information on mails, take a look at the Mails section.
Looks for an asset by its path:
asset('path/to/test.jpg');
For more information on assets, take a look at the Assets section.
Helper method to register meta data. See Meta Data for more information.
Generates an Unsplash URL to get random free images for testing:
<img src="{{ unsplash()->search('nature')->size(400, 300) }}">
<img src="{{ unsplash()->user('User Name') }}">
<img src="{{ unsplash()->collection('Collection Name') }}">
<img src="{{ unsplash()->id('abc123') }}">
Returns a Faker instance to generate fake values for testing:
// Current language
faker()->firstName();
// Other Faker language
faker('nl_BE')->firstName();
The available methods are auto-suggested in the editor.
Generates the HTML to embed any service, just by giving it a URL:
{{ embed('https://twitter.com/devistoapp/status/1366841828696293380') }}
{{ embed('https://www.youtube.com/watch?v=A2Rxz8rR2Fk') }}
Generates the HTML code for an Fontawesome icon:
{{ icon('facebook') }}
{{ icon('facebook')->light() }}
{{ icon('facebook')->duotone() }}
The available icons are auto-suggested in the editor.
Generates a URL to share a URL on several services:
// Current URL
share()->facebook();
// Other URL
share('https://...')->facebook();
// Available services
share()->facebook();
share()->twitter();
share()->linkedin();
share()->email()->subject('This is interesting');
Returns a Laravel Stringable
object, equivalant to Str::of()
in Laravel:
// Chain methods
str('My Name')->snake()->upper(); // MY_NAME
// Omit the parameter to call 'Str' methods that don't expect a parameter
str()->random();
Returns true
when you're in the staging environment, and false
otherwise. See this section for more info about the different environments.
// Handy for testing
if (staging()) {
logger()->info('This happened in staging');
}
// Equivalent to
if (app()->environment('staging')) {
logger()->info('This happened in staging');
}
Returns true
when you're in the production environment, and false
otherwise. See this section for more info about the different environments.
// Handy for testing
if (production()) {
logger()->info('This happened in production');
}
// Equivalent to
if (app()->environment('production')) {
logger()->info('This happened in production');
}
Returns a Mollie client you can use to work with payments. Just provide your API key and you're good to go.
$payment = mollie('api_key')->payments->create([
'amount' => [
'currency' => 'EUR',
'value' => '100.00',
],
'description' => 'My order',
'redirectUrl' => page('completed')->url(),
'webhookUrl' => page('webhook')->url(),
]);
$url = $payment->getCheckoutUrl();
Returns a Google client you can use to work with the Google API. You can find an example here.
$client = google('access_token');
Looks for a guard by its slug, to use in Livewire components. Several methods are available:
// Default guard
guard();
// Specific guard
guard('users');
Returns the current logged in user.
@if (user())
You are logged in as {{ user()->name }}.
@endif
Of course, all default Laravel helpers are also available in Devisto, for example:
// Dates
now()->format('d/m/Y H:i:s');
today()->addDays(2)->format('d/m/Y');
// Debugging
dump('foo');
dd('foo');
// Getting data from the query string
request('foo', 'default');
// Make a collection
collect(['foo' => 'bar']);
Renders all the CSS needed to make your project work:
- All your own CSS you write in
app.css
- All styles you pushed to the stack with
@push('styles')
- Livewire styles to make Livewire components work
Typically, you'll want to include this directive in your master template before your closing </head>
tag, like so:
<html>
<head>
...
@styles
</head>
...
</html>
Renders all the JavaScript needed to make your project work:
- All your own JS you write in
app.js
- All scripts you pushed to the stack with
@push('scripts')
- Livewire scripts to make Livewire components work
- Fontawesome scripts to make the
icon()
helper work - The instant.page script for faster page loads
- The lazysizes script for faster image loading
Typically, you'll want to include this directive in your master template before your closing </body>
tag, like so:
<html>
...
<body>
...
@scripts
</body>
</html>
Renders all data that was registered with the meta()
helper. See Meta Data for more information.
Typically, you'll want to include this directive in your master template after your opening <head>
tag, like so:
<html>
<head>
@meta
...
</head>
...
</html>
Can be used to check in Blade if you're in the staging environment:
@staging
This is some debug info...
@endstaging
Can be used to check in Blade if you're in the production environment:
@production
{{-- My Google Analytics code --}}
@endproduction