first commit
This commit is contained in:
160
wave/docs/concepts/routing.md
Normal file
160
wave/docs/concepts/routing.md
Normal file
@@ -0,0 +1,160 @@
|
||||
# Routing
|
||||
|
||||
In this section we'll quickly cover the Wave routes.
|
||||
|
||||
- [Wave Web Routes](#web-routes)
|
||||
- [Wave API Routes](#api-routes)
|
||||
- [Wave Middleware](#wave-middleware)
|
||||
|
||||
---
|
||||
|
||||
<a name="web-routes"></a>
|
||||
### Wave Web Routes
|
||||
|
||||
If you take a look inside of `wave/routes/web.php` you will see all the Wave web routes:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
Route::impersonate();
|
||||
|
||||
Route::get('/', '\Wave\Http\Controllers\HomeController@index')->name('wave.home');
|
||||
Route::get('@{username}', '\Wave\Http\Controllers\ProfileController@index')->name('wave.profile');
|
||||
|
||||
// Documentation routes
|
||||
Route::view('docs/{page?}', 'docs::index')->where('page', '(.*)');
|
||||
|
||||
// Additional Auth Routes
|
||||
Route::get('logout', 'Auth\LoginController@logout')->name('logout');
|
||||
Route::get('user/verify/{verification_code}', 'Auth\RegisterController@verify')->name('verify');
|
||||
Route::post('register/complete', '\Wave\Http\Controllers\Auth\RegisterController@complete')->name('wave.register-complete');
|
||||
|
||||
Route::get('blog', '\Wave\Http\Controllers\BlogController@index')->name('wave.blog');
|
||||
Route::get('blog/{category}', '\Wave\Http\Controllers\BlogController@category')->name('wave.blog.category');
|
||||
Route::get('blog/{category}/{post}', '\Wave\Http\Controllers\BlogController@post')->name('wave.blog.post');
|
||||
|
||||
Route::view('install', 'wave::install')->name('wave.install');
|
||||
|
||||
/***** Pages *****/
|
||||
Route::get('p/{page}', '\Wave\Http\Controllers\PageController@page');
|
||||
|
||||
/***** Pricing Page *****/
|
||||
Route::view('pricing', 'theme::pricing')->name('wave.pricing');
|
||||
|
||||
/***** Billing Routes *****/
|
||||
Route::post('/billing/webhook', '\Wave\Http\Controllers\WebhookController@handleWebhook');
|
||||
Route::post('paddle/webhook', '\Wave\Http\Controllers\SubscriptionController@hook');
|
||||
Route::post('checkout', '\Wave\Http\Controllers\SubscriptionController@checkout')->name('checkout');
|
||||
|
||||
Route::get('test', '\Wave\Http\Controllers\SubscriptionController@test');
|
||||
|
||||
Route::group(['middleware' => 'wave'], function () {
|
||||
Route::get('dashboard', '\Wave\Http\Controllers\DashboardController@index')->name('wave.dashboard');
|
||||
});
|
||||
|
||||
Route::group(['middleware' => 'auth'], function(){
|
||||
Route::get('settings/{section?}', '\Wave\Http\Controllers\SettingsController@index')->name('wave.settings');
|
||||
|
||||
Route::post('settings/profile', '\Wave\Http\Controllers\SettingsController@profilePut')->name('wave.settings.profile.put');
|
||||
Route::put('settings/security', '\Wave\Http\Controllers\SettingsController@securityPut')->name('wave.settings.security.put');
|
||||
|
||||
Route::post('settings/api', '\Wave\Http\Controllers\SettingsController@apiPost')->name('wave.settings.api.post');
|
||||
Route::put('settings/api/{id?}', '\Wave\Http\Controllers\SettingsController@apiPut')->name('wave.settings.api.put');
|
||||
Route::delete('settings/api/{id?}', '\Wave\Http\Controllers\SettingsController@apiDelete')->name('wave.settings.api.delete');
|
||||
|
||||
Route::get('settings/invoices/{invoice}', '\Wave\Http\Controllers\SettingsController@invoice')->name('wave.invoice');
|
||||
|
||||
Route::get('notifications', '\Wave\Http\Controllers\NotificationController@index')->name('wave.notifications');
|
||||
Route::get('announcements', '\Wave\Http\Controllers\AnnouncementController@index')->name('wave.announcements');
|
||||
Route::get('announcement/{id}', '\Wave\Http\Controllers\AnnouncementController@announcement')->name('wave.announcement');
|
||||
Route::post('announcements/read', '\Wave\Http\Controllers\AnnouncementController@read')->name('wave.announcements.read');
|
||||
Route::get('notifications', '\Wave\Http\Controllers\NotificationController@index')->name('wave.notifications');
|
||||
Route::post('notification/read/{id}', '\Wave\Http\Controllers\NotificationController@delete')->name('wave.notification.read');
|
||||
|
||||
/********** Checkout/Billing Routes ***********/
|
||||
Route::post('cancel', '\Wave\Http\Controllers\SubscriptionController@cancel')->name('wave.cancel');
|
||||
Route::view('checkout/welcome', 'theme::welcome');
|
||||
|
||||
Route::post('subscribe', '\Wave\Http\Controllers\SubscriptionController@subscribe')->name('wave.subscribe');
|
||||
Route::view('trial_over', 'theme::trial_over')->name('wave.trial_over');
|
||||
Route::view('cancelled', 'theme::cancelled')->name('wave.cancelled');
|
||||
Route::post('switch-plans', '\Wave\Http\Controllers\SubscriptionController@switchPlans')->name('wave.switch-plans');
|
||||
});
|
||||
|
||||
Route::group(['middleware' => 'admin.user'], function(){
|
||||
Route::view('admin/do', 'wave::do');
|
||||
});
|
||||
```
|
||||
|
||||
Next, if you take a look inside of your `routes/web.php`, you will see the following line:
|
||||
|
||||
```php
|
||||
// Include Wave Routes
|
||||
Wave::routes();
|
||||
```
|
||||
|
||||
This line includes all the Wave routes into your application.
|
||||
|
||||
<a name="api-routes"></a>
|
||||
### Wave API Routes
|
||||
|
||||
The Wave API routes are located at `wave/routes/api.php`. The contents of the file are as follows:
|
||||
|
||||
```php
|
||||
Route::post('login', '\Wave\Http\Controllers\API\AuthController@login');
|
||||
Route::post('register', '\Wave\Http\Controllers\API\AuthController@register');
|
||||
Route::post('logout', '\Wave\Http\Controllers\API\AuthController@logout');
|
||||
Route::post('refresh', '\Wave\Http\Controllers\API\AuthController@refresh');
|
||||
Route::post('token', '\Wave\Http\Controllers\API\AuthController@token');
|
||||
|
||||
// BROWSE
|
||||
Route::get('/{datatype}', '\Wave\Http\Controllers\API\ApiController@browse');
|
||||
|
||||
// READ
|
||||
Route::get('/{datatype}/{id}', '\Wave\Http\Controllers\API\ApiController@read');
|
||||
|
||||
// EDIT
|
||||
Route::put('/{datatype}/{id}', '\Wave\Http\Controllers\API\ApiController@edit');
|
||||
|
||||
// ADD
|
||||
Route::post('/{datatype}', '\Wave\Http\Controllers\API\ApiController@add');
|
||||
|
||||
// DELETE
|
||||
Route::delete('/{datatype}/{id}', '\Wave\Http\Controllers\API\ApiController@delete');
|
||||
```
|
||||
|
||||
Then, if you take a look inside of your `routes/api.php`, you will see the following line:
|
||||
|
||||
```php
|
||||
// Include Wave Routes
|
||||
Wave::api();
|
||||
```
|
||||
|
||||
This line includes all the Wave API routes into your application API.
|
||||
|
||||
<a name="wave-middleware"></a>
|
||||
### Wave Middleware
|
||||
|
||||
Inside of the Wave routes.php file you will see the following line:
|
||||
|
||||
```php
|
||||
Route::group(['middleware' => 'wave'], function () {
|
||||
Route::get('dashboard', '\Wave\Http\Controllers\DashboardController@index')->name('wave.dashboard');
|
||||
});
|
||||
```
|
||||
|
||||
This is the only current route protected by the `wave` middleware. The `wave` middleware is used to protect routes against users who no longer have an active subscription or are no longer on a trial. You can include your application routes inside of this middleware:
|
||||
|
||||
```php
|
||||
Route::group(['middleware' => 'wave'], function () {
|
||||
// Add your application routes here.
|
||||
});
|
||||
```
|
||||
|
||||
You may also wish to include this middleware in a single route:
|
||||
|
||||
```php
|
||||
Route::get('awesome', 'AwesomeController@index')->middleware('wave');
|
||||
```
|
||||
|
||||
And now your application routes will be protected from users who are no longer active paying users.
|
||||
98
wave/docs/concepts/structure.md
Normal file
98
wave/docs/concepts/structure.md
Normal file
@@ -0,0 +1,98 @@
|
||||
# File Structure
|
||||
|
||||
In this section of the documentaion we will briefly discuss the file structure of Wave so that way you can better familiarize yourself with how Wave functions.
|
||||
|
||||
- [Root Folder Structure](#root-structure)
|
||||
- [Wave Folder Structure](#wave-structure)
|
||||
|
||||
---
|
||||
|
||||
<a name="root-structure"></a>
|
||||
### Root Folder Structure
|
||||
|
||||
If you are already familiar with Laravel a lot of this will seem very familiar. Let's discuss each main folder/file in your Wave application.
|
||||
|
||||
> bold text indicates a folder, non-bold indicates a file.
|
||||
|
||||
- **app** -
|
||||
This directory will hold most (if not all) of your application logic including Models, Controllers, Services, and many other classes.
|
||||
|
||||
- **bootstrap** -
|
||||
This folder contains files to bootstrap (start-up) Laravel.
|
||||
|
||||
- **config** -
|
||||
This folder will container many of the global configurations in our application.
|
||||
|
||||
- **database** -
|
||||
This folder contains database files such as migrations and seeds.
|
||||
|
||||
- **public** -
|
||||
This public folder contains many of the applications public assets such as images, stylesheets, and scripts.
|
||||
|
||||
- **resources** -
|
||||
This folder contains the views inside of our application and it also contains our theme files located inside of `resources/views/themes` folder.
|
||||
|
||||
- **routes** -
|
||||
This folder will contain all the routes files for our application.
|
||||
|
||||
- **storage** -
|
||||
This folder is used to store session information, cache files, and logs.
|
||||
|
||||
- **tests** -
|
||||
This folder contains files that we use to test the logic of our application.
|
||||
|
||||
- **vendor** -
|
||||
This folder contains the composer (third-party) dependencies we use in our application.
|
||||
|
||||
- **wave** -
|
||||
This folder contains all the logic for the wave application. We'll be talking more about the contents of this folder in the next step.
|
||||
|
||||
- *.env.example* -
|
||||
This is an example environment file. Duplicate this file and rename it to `.env` in order to make it your application environment file.
|
||||
|
||||
- *artisan* -
|
||||
This is the artisan command we use to run CLI commands, such as `php artisan tinker` and many others.
|
||||
|
||||
- *composer.json* -
|
||||
This is the file that tells our application what third-party composer packages we want to include.
|
||||
|
||||
- *composer.lock* -
|
||||
This is the file that contains the exact version number of the composer packages included in our application.
|
||||
|
||||
- *deploy.json* -
|
||||
This file contains information to deploy your app to the DigitalOcean app marketplace.
|
||||
|
||||
- *docker-compose.yml* -
|
||||
This is a docker compose file that will allow you to run your app using <a href="https://laravel.com/docs/sail" target="_blank">Laravel Sail</a>.
|
||||
|
||||
- *phpunit.xml* -
|
||||
This file is used to store information in order to run tests and test the functionality of our application.
|
||||
|
||||
- *README.md* -
|
||||
This is a quick Readme Markdown file.
|
||||
|
||||
- *server.php* -
|
||||
This is the file that allows us to create a quick local PHP server.
|
||||
|
||||
<a name="wave-structure"></a>
|
||||
### Wave Folder Structure
|
||||
|
||||
The Wave folder structure is pretty simple and straight forward. If you look inside the `wave` folder located in the application folder you will see the following folder structure:
|
||||
|
||||
- **database** -
|
||||
This folder contains the migration files needed for our Wave application.
|
||||
|
||||
- **docs** -
|
||||
This folder contains the documentation files. The files from which you are reading right now.
|
||||
|
||||
- **resources** -
|
||||
This folder contains a few shared views used by Wave.
|
||||
|
||||
- **routes** -
|
||||
This folder contains the routes defined for our wave application. You will see the web routes located at `wave/routes/web.php` and the API routes located at `/wave/routes/api.php`, go ahead and feel free to take a look at the defined routes.
|
||||
|
||||
- **src** -
|
||||
This is where all the logic happens for our Wave application including Models, Controllers, Helpers, and much more.
|
||||
|
||||
- *composer.json* -
|
||||
This file is used to require any dependencies required by Wave.
|
||||
87
wave/docs/concepts/themes.md
Normal file
87
wave/docs/concepts/themes.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# Themes
|
||||
|
||||
In this section we'll teach you how to create a new theme, reference a theme view, and add theme options for your particular theme.
|
||||
|
||||
- [Create a Theme](#create-theme)
|
||||
- [Theme Views](#theme-views)
|
||||
- [Theme Options](#theme-options)
|
||||
- [Theme Assets](#theme-assets)
|
||||
|
||||
---
|
||||
|
||||
<a name="create-theme"></a>
|
||||
## Create a Theme
|
||||
|
||||
In order to create a theme, you will need to create a new folder inside of `resources/views/themes`. Let's call this folder `sample-theme`. Then inside of this folder we need a matching filename called `sample-theme.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Sample Theme",
|
||||
"version": "1.0"
|
||||
}
|
||||
```
|
||||
|
||||
Now, if you visit `/admin/themes`, you'll see this new theme available to activate.
|
||||
|
||||
> You may see a broken image in the admin if you do not have an image for that theme. Inside of your theme folder you will need a `.jpg` file with the same name as the folder `sample-theme.jpg` (recommended 800x500px)
|
||||
|
||||
<a name="theme-views"></a>
|
||||
## Theme Views
|
||||
|
||||
After activating a theme you can render any view `file.blade.php` or `file.php` by calling `theme::file`.
|
||||
|
||||
For instance, if we created a new file inside our sample theme at `resources/views/themes/sample-theme/home.blade.php` we could then return the view in a controller like so:
|
||||
|
||||
```php
|
||||
public function home(){
|
||||
return view('theme::home');
|
||||
}
|
||||
```
|
||||
|
||||
Or, you could do this inside of your route file:
|
||||
|
||||
```php
|
||||
Route::view('/', 'theme::home');
|
||||
```
|
||||
|
||||
<a name="theme-options"></a>
|
||||
## Theme Options
|
||||
|
||||
Every theme can include options such as logo, color scheme, etc... You can choose to program any amount of options into your theme.
|
||||
|
||||
In order to create an *options* page for your theme you need to create a new file inside your theme folder called `options.blade.php`. As an example take a look at the Tailwind theme options located at `resources/views/themes/tailwind/options.blade.php`, you will see a snippet similar to:
|
||||
|
||||
```php
|
||||
<div id="branding" class="tab-pane fade in active">
|
||||
|
||||
{!! theme_field('image', 'logo', 'Site Logo') !!}
|
||||
|
||||
{!! theme_field('image', 'footer_logo', 'Footer Logo') !!}
|
||||
|
||||
</div>
|
||||
```
|
||||
|
||||
This will allow us to create some dynamic theme fields. This is powered by the [DevDojo Themes Package](https://github.com/thedevdojo/themes). You can easily create input fields for your theme options.
|
||||
|
||||
For more information about the different type of fields be sure to visit the themes package located at [https://github.com/thedevdojo/themes](https://github.com/thedevdojo/themes)
|
||||
|
||||
<a name="theme-assets"></a>
|
||||
## Theme Assets
|
||||
|
||||
The current themes use Webpack to mix their assets. In order to run the assets for each theme you will need to go into the theme folder and run:
|
||||
|
||||
```javascript
|
||||
npm run watch
|
||||
```
|
||||
|
||||
Additionally, to compile the assets and make them production ready, you'll need to use:
|
||||
|
||||
```javascript
|
||||
npm run production
|
||||
```
|
||||
|
||||
> Before compiling assets in each theme you may need to include the asset dependencies by running `npm install` inside of the theme folder.
|
||||
|
||||
---
|
||||
|
||||
Now, you can quickly and easily create configurable themes for your application 🎉
|
||||
Reference in New Issue
Block a user