1. Go to this page and download the library: Download larawelp/theme 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/ */
larawelp / theme example snippets
// The "about" page
Route::any('page.about', Controller@method);
// The child page "works" of "about".
Route::any('page.about.works', Controller@method);
// Any child page of "about".
Route::any('page.about.*', Controller@method);
// Any descendant page of "about".
Route::any('page.about.**', Controller@method);
// Grouping multiple routes that sharing a common `prefix`.
Route::group(['prefix' => 'page'], function () {
Route::any('about.contact', function () {
return 'Foo'; // equivalent to <page.about.contact>
});
Route::any('service.*.price', function () {
return 'Bar'; // equivalent to <page.service.*.price>
});
});
// IMPORTANT !
//
// Routes that has a higher specificity should be
// placed more above(earlier) than the routes that have a lower specificity.
// Why? If you place the routes that have a lower specificity,
// the subsequent routes that have a higher specificity will be ignored.
//
// The following routes have a lower specificity than the above ones.
// So you want to place them here.
// Generic pages
Route::any('page', Controller@method);
// Front page
Route::any('front_page', Controller@method);
// Post archive index page
Route::any('archive', Controller@method);
// This will use the original UriValidator of Laravel.
Route::get('/my/endpoint', function () {
return 'Magic!';
});
Route::any('archive', 'Generic\Archive@index');
namespace App\Http\Controllers\Generic;
use App\Http\Controllers\Controller;
use App\Models\Post;
class Archive extends Controller
{
public function index()
{
$data = [
'posts' => Post::queriedPosts() // get the posts for current page
];
return $this->view('generic.archive', $data);
}
}