Usage Guide
The "Smart Fallback" Router
Waravel's most powerful feature is how it handles routing. It doesn't force you to change your existing Laravel routes.
Where a request comes in:
- Laravel Regular Routes: We check your
routes/web.phpfirst. If you have defined a route, Laravel handles it. - Waravel EXACT Match: We check if a Waravel Page exists with that exact full URL.
- Waravel HIERARCHY: We traverse the URL segments to find
nested pages (e.g.,
parent/child).
Why this matters: You can build your Saas/App logic in Laravel as usual, and let Waravel handle all the marketing pages (About, Blog, Terms, Landing Pages) without cluttering your route files.
🖥 Managing Content
Pages & Templates
When you create a Page in the dashboard, you can select a Template.
These templates correspond directly to Blade files in your theme.
- Default Template: Standard WYSIWYG content area.
- Full Width: Removes sidebars, great for landing pages.
- Custom: You can register your own! (See Developer Guide).
The Media Library
Waravel organizes media uploads by Date (Year/Month), mirroring the WordPress structure.
- Upload: Drag and drop in the dashboard.
- Optimize: Images are automatically resized to
thumbnail,medium, andlargevariants using the GD driver. - SEO: You can set
alttext andtitleattributes directly in the library.
💻 Developer API: The Waravel Facade
You can access Waravel data anywhere in your application using the Facade.
Fetching Content
use Sobberrc\Waravel\Facades\Waravel;
// Get a specific page
$page = Waravel::getPage('pricing');
// Get the latest 3 blog posts (pages with 'post' type)
$posts = Waravel::getPages([
'type' => 'post',
'status' => 'published',
'limit' => 3,
'order_by' => 'created_at'
]);
Rendering Content Manually
If you want to render a Waravel page from within a custom Controller:
public function showPricing() {
// Custom logic here...
// Then render the Waravel page
return Waravel::renderPage('pricing', [
'customData' => $someData // Pass data to the view
]);
}