PHP code example of angel / core

1. Go to this page and download the library: Download angel/core 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/ */

    

angel / core example snippets


'Angel\Core\CoreServiceProvider'



class PageController extends \Angel\Core\PageController {

	public function home()
	{
		return 'You are home!';
	}

}

$table->string('slug')->unique();

protected $slugSeed = 'name';

// 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);
	}
	
}

// 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();

$slug = sluggify('String to sluggify!'); // Returns 'string-to-sluggify'

// 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');
});

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