PHP code example of fbf / laravel-pages

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

    

fbf / laravel-pages example snippets




use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class LinkPagesToTestimonials extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('fbf_pages', function(Blueprint $table)
		{
			$table->integer('testimonial_id')->nullable()->default(null);
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::table('fbf_pages', function(Blueprint $table)
		{
			$table->dropColumn('testimonial_id');
		});
	}

}



class Page extends Fbf\LaravelPages\Page {

	public function testimonial()
	{
		return $this->belongsTo('Fbf\LaravelTestimonials\Testimonial');
	}

}

	/**
	 * The class name of the Eloquent model that this config represents
	 *
	 * @type string
	 */
	'model' => 'Page',

		'testimonial' => array(
			'title' => 'Testimonial',
			'type' => 'relationship',
			'name_field' => 'title',
		),

App::bind('Fbf\LaravelPages\PagesController', function() {
    return new Fbf\LaravelPages\PagesController(new Page);
});