Angel is a CMS built on top of Laravel. It is available via Packagist., (*1)
UPDATE 8/5/2016: The Laravel 5 version of Angel is underway here., (*2)
UPDATE 3/9/2015: Just wanted to give a heads up that this project is still in very active usage and deployment and is well tested by several large applications. The eCommerce module that works with Stripe is also well tested and used., (*3)
Issue a composer update to install the package., (*9)
After the package has been installed, open app/config/app.php and add the following to your providers array:, (*10)
'Angel\Core\CoreServiceProvider'
While you're in there, set debug to true., (*11)
Delete:
* All the default routes in app/routes.php.
* All the default filters except for the csrf filter in app/filters.php.
* All controllers in app/controllers except BaseController.php.
* All the models in app/models, including User.php. You can replace it with a .gitkeep file for now to be sure to keep the app/models directory., (*12)
Create and configure your database so that we can run the migrations., (*13)
Finally, issue the following artisan commands:, (*14)
php artisan dump-autoload # Dump a load
php artisan asset:publish # Publish the assets
php artisan config:publish angel/core # Publish the config
php artisan migrate --package=angel/core # Run the migrations
mkdir -p public/uploads/kcfinder # Create the KCFinder uploads folder
touch public/uploads/kcfinder/.gitkeep # Keep the folder
Customize
, (*15)
Every class in the core is easily extendable., (*16)
When extending this controller, you can create a method for each page URI that you've created in the administration panel., (*18)
Create the following file as app/controllers/PageController.php:, (*19)
<?php
class PageController extends \Angel\Core\PageController {
public function home()
{
return 'You are home!';
}
}
Remove the old binding and bind your new class at the top of your routes.php file:, (*20)
App::offsetUnset('PageController');
App::singleton('PageController', function() {
return new \PageController;
});
Do a composer dump-autoload., (*21)
Now, you should be able to navigate to http://yoursite.com/home and see: You are home!., (*22)
Configuration
Take a look at the config file you just published in app/config/packages/angel/core/config.php., (*23)
Admin URL
By default, the following configuration is set:, (*24)
'admin_prefix' => 'admin'
This allows one to access the administration panel via the url http://yoursite.com/admin., (*25)
To be secure, you may want to change this prefix. Hackers tend to target sites with URLs like this., (*26)
Admin Menu
The next section is the 'menu' array. When you install modules, you add their indexes to this array so that they appear in the administration panel's menu., (*27)
Menu Linkable Models
Some modules come with models that you can create menu links to in the Menu module. This array is used by the Menu Link Creation Wizard on the Menu module's index., (*28)
Using Slugs
Often times, you will want to let users access products, blog posts, news articles, etc. by name instead of by ID in the URL., (*29)
For instance: http://yoursite.com/products/big-orange-ball., (*30)
To do this, you want to 'sluggify' one of the columns / properties of the model., (*31)
If you are extending the AngelModel, this is as simple as adding a slug column to your table with a unique index:, (*32)
$table->string('slug')->unique();
And then setting the slugSeed property of your model to the name of the column from which to generate the slug:, (*33)
protected $slugSeed = 'name';
Now, slugs will be automatically generated from the name column of the models as they are created or edited. (You can just as easily use a title column or any other appropriate source.), (*34)
You can use the generated slugs after adding or editing some items., (*35)
For instance:, (*36)
// app/routes.php
Route::get('products/{slug}', 'ProductController@view');
// app/controllers/ProductController.php
class ProductController extends \Angel\Core\AngelController {
public function view($slug)
{
$Product = App::make('Product');
$this->data['product'] = $Product::where('slug', $slug)->firstOrFail();
return View::make('products.view', $this->data);
}
}
Creating Unique Slugs Manually
// Adding a new item:
$article = new NewsArticle;
$article->title = Input::get('title');
$article->slug = slug($article, 'title');
$article->save();
// Editing an item:
$article = Article::find(1);
$article->title = Input::get('title');
$article->slug = slug($article, 'title');
$article->save();
Sluggifying a String
$slug = sluggify('String to sluggify!'); // Returns 'string-to-sluggify'
Develop Modules
Here is where we'll put code snippets for developing modules., (*37)
Reorderable Indexes
Assume we're developing a persons module package., (*38)
First, make sure that Person extends \Angel\Core\AngelModel and has the property protected $reorderable = true;., (*39)