Download the PHP package snowfire/snowfire-app without Composer
On this page you can find all versions of the php package snowfire/snowfire-app. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package snowfire-app
Snowfire App
This packages makes it possible to connect your Laravel app to Snowfire.
Install the package
Add this to your composer.json
"snowfire/snowfire-app": "dev-master"
Add this to your service providers in config/app.php
'Snowfire\App\SnowfireServiceProvider'
Add this to your route middlewares in app/Http/Kernel.php
'snowfire' => 'Snowfire\App\Middleware\SnowfireMiddleware',
'snowfireAdmin' => 'Snowfire\App\Middleware\SnowfireAdminMiddleware',
Publish the config file
$ php artisan vendor:publish
Create the database table for snowfire installations
$ php artisan migrate
Seed data
Add this to your DatabaseSeeder.php
$this->call('\Snowfire\App\Storage\Seeder');
CSRF protection
If you have CSRF middleware activated in app/Http/Kernel.php
open app/Http/Middleware/VerifyCsrfToken.php
and add the following to the handle method:
Integration possibilities
There are two different ways to connect your app to Snowfire. As a link in the admin area and as a public action.
Example
Lets say you have a list of events. A public action will be something like http://your-app.com/events/all
which will render an HTML <ul>
list. Then you will have an admin link from Snowfire to http://your-app.com/admin
which will let users add/edit/remove events.
Start by adding your actions to config/snowfire_app.php
This config adds the admin link as a named route called snowfire.tab
and a route for all events. Both tab and actions are optional (but you need one of them, right?)
Your routes.php
This creates an admin route and the public action. The admin route is behind a snowfireAppAuth filter which makes sure the user is logged in and trusted.
Your Snowfire snippet to the public event list
Login to Snowfire and install the app (System -> Apps)
http://your-hosted-app.com/snowfire/install
Create a new snippet with this code:
Warning: Adding applications to the root / (i.e the home page) is currently not supported. Please create a sub page to add your app.
Now just add the snippet to a page and it will show you a list of events.
Links
When you are working in an action that will be rendered within Snowfire, you need to use:
This will make sure the links works from within Snowfire.