Giter Site home page Giter Site logo

angel-core's Introduction

Angel CMS for Laravel 4

Angel is a CMS built on top of Laravel. It is available via Packagist.

UPDATE 8/5/2016: The Laravel 5 version of Angel is underway here.

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.

Table of Contents

Demo

Demo Screenshot

Installation

Installation Screenshot

The Angel CMS was built on top of Laravel 4.1.

Install Laravel 4.1 using the following command:

composer create-project laravel/laravel --prefer-dist {project-name} 4.1.*

Add the angel/core package requirement to your composer.json file, like this:

"require": {
    "laravel/framework": "4.1.*",
    "angel/core": "1.0.*"
},

Issue a composer update to install the package.

After the package has been installed, open app/config/app.php and add the following to your providers array:

'Angel\Core\CoreServiceProvider'

While you're in there, set debug to true.

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.

Create and configure your database so that we can run the migrations.

Finally, issue the following artisan commands:

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

Customize Screenshot

Every class in the core is easily extendable.

Let's start by extending the PageController.

When extending this controller, you can create a method for each page URI that you've created in the administration panel.

Create the following file as app/controllers/PageController.php:

<?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:

App::offsetUnset('PageController');
App::singleton('PageController', function() {
	return new \PageController;
});

Do a composer dump-autoload.

Now, you should be able to navigate to http://yoursite.com/home and see: You are home!.

Configuration

Take a look at the config file you just published in app/config/packages/angel/core/config.php.

Admin URL

By default, the following configuration is set:

'admin_prefix' => 'admin'

This allows one to access the administration panel via the url http://yoursite.com/admin.

To be secure, you may want to change this prefix. Hackers tend to target sites with URLs like this.

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.

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.

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.

For instance: http://yoursite.com/products/big-orange-ball.

To do this, you want to 'sluggify' one of the columns / properties of the model.

If you are extending the AngelModel, this is as simple as adding a slug column to your table with a unique index:

$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:

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.)

You can use the generated slugs after adding or editing some items.

For instance:

// 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.

Reorderable Indexes

Assume we're developing a persons module package.

First, make sure that Person extends \Angel\Core\AngelModel and has the property protected $reorderable = true;.

// workbench/persons/src/views/admin/persons/index.blade.php
@section('js')
    {{ HTML::script('packages/angel/core/js/jquery/jquery-ui.min.js') }}
    <script>
    	$(function() {
            $('tbody').sortable(sortObj);
    	});
    </script>
@stop
@section('content')
    <table class="table table-striped">
        <tbody data-url="persons/order"><!-- This data-url is appended to the admin url and posted. -->
            @foreach ($persons as $person)
                <tr data-id="{{ $person->id }}">
                    {{ Form::hidden(null, $person->order, array('class'=>'orderInput')) }}
                    <button type="button" class="btn btn-xs btn-default handle">
                        <span class="glyphicon glyphicon-resize-vertical"></span>
                    </button>
                </tr>
            @endforeach
        </tbody>
    </table>
@stop

// workbench/persons/src/routes.php
Route::group(array('prefix' => admin_uri('persons'), 'before' => 'admin'), function() {
	Route::post('order', 'AdminPersonsController@order');
});

angel-core's People

Contributors

charlesav avatar jvmartin avatar teodorsandu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angel-core's Issues

plans for laravel 5?

Just curious if this is still active and if you are looking toward laravel 5?

Question: How does one use other providers on 'pages'

I am trying to use former and it does not appear to be working... I assumed that you would be putting the laravel code in the "modules" section but it does not appear to be working..

Also, just out of curiosity, why are all the pages stored in the database? Thanks, so far I think this project is wonderful!

Best Regards,
Gyoza.

Unable to nest menus more than once

We should update Menus to allow nesting more than one level deep. I tried hiding the error that appears when adding a child menu to another child menu, but errors always crop up in the render view for the nested items.

I think this could have to do with the way menus are built with Menu->fillItems() and Menu->modelsToFetch() - we should update this for infinite drop down menus!

[solved] extending the core - total noob stuff here

Hi, I am kind of new to laravel, I do web development for fun, its not my job, I am a sysadmin so I am learning still.

Ok, now that that is out there.

I am having issues with I believe are Routes not passing data properly when using angel. I've extended the angel core so i can have my own custom pages.

I am trying to create a form that routes data to a new page. I get the page to route fine and checking the post data i see my normal data but i get an error when it attempts to display the next page.

I am getting

Undefined variable: page (View: /var/www/email/app/views/pages/returnmail.blade.php)

which is essentially a modified copy of the main blade file with some small modifications.

There is a "pages" view added in pages. Any help would be REALLY appreciated, I love this project so far and we all love

Base64 encoded images in CKeditor.

Had a client drag an image into a ckeditor field for a page. At least in Firefox, the image is base64 encoded by default. When the image is too big this exceeds mysql's text field size, which breaks the html and the changelog, causing an fatal error on the edit page (and the client to panic).

This might be one solution: http://ckeditor.com/addon/imagepaste

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.