Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
salaback committed Mar 17, 2016
0 parents commit 120f3ae
Show file tree
Hide file tree
Showing 18 changed files with 563 additions and 0 deletions.
60 changes: 60 additions & 0 deletions PackageServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace Salaback\LiquidCMS;

use Illuminate\Support\ServiceProvider;

class PackageServiceProvider extends ServiceProvider
{

/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
if (! $this->app->routesAreCached()) {
require __DIR__ . '/routes.php';
}

$this->publishes([
__DIR__ . '/src/config.php' => config_path('liquid.php'),
]);

$this->publishes([
__DIR__ . '/src/assets' => public_path('vendor/liquidcms'),
], 'public');

$this->publishes([
__DIR__ . '/src/migrations/' => database_path('migrations')
], 'migrations');



//Load in the classes


}


/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->loadViewsFrom(__DIR__.'/views', 'liquid');
}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [];
}
}
13 changes: 13 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "salaback/liquidcms",
"description": "An inline focused CMS",
"license": "MIT",
"authors": [
{
"name": "Sean Alaback",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {}
}
28 changes: 28 additions & 0 deletions src/Http/CMSController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Salaback\LiquidCMS\Http;

use App\Http\Controllers\Controller;
use CityNexus\CityNexus\Property;
use CityNexus\CityNexus\DatasetQuery;
use CityNexus\CityNexus\GenerateScore;
use CityNexus\CityNexus\Score;
use CityNexus\CityNexus\Setting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Schema;
use CityNexus\CityNexus\Table;
use CityNexus\CityNexus\ScoreBuilder;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Schema\Blueprint;
use Salaback\LiquidCMS\Route;


class CMSController extends Controller
{
public function postCreatePage(Request $request)
{

}

}
79 changes: 79 additions & 0 deletions src/Http/PublicController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

namespace Salaback\LiquidCMS\Http;

use App\Http\Controllers\Controller;
use CityNexus\CityNexus\Property;
use CityNexus\CityNexus\DatasetQuery;
use CityNexus\CityNexus\GenerateScore;
use CityNexus\CityNexus\Score;
use CityNexus\CityNexus\Setting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Schema;
use CityNexus\CityNexus\Table;
use CityNexus\CityNexus\ScoreBuilder;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Schema\Blueprint;
use Salaback\LiquidCMS\Route;


class PublicController extends Controller
{
public function getIndex($a = null, $b = null, $c = null, $d = null, $e = null, $f = null)
{
$slugs = [$a, $b, $c, $d, $e, $f, 'null'];

$route = $this->findRoute($slugs);

if($route == 404)
{
if(Auth::getUser() && Auth::getUser()->admin == true)
{

}
else{
return response('Route does not exist', 404);
}
}

return view('liquid::' . $route->template)
->with('page', $route->page);
}


private function findRoute($slugs)
{
$return = null;
// Check each slug for existing route info
foreach($slugs as $depth => $slug)
{
// If there is a slug at this depth
if($slug != null)
{
// Find the first route of the same slug and depth

$route = Route::where('slug', $slug)->where('depth', $depth)->first();

// If no route exists matching the slug and depth return a 404 error
if($route == null)
{
$return = 404;
}

// If a route does exist, save it to the return variable and start the loop at the next depth
else
{
$return = $route;
}
}

// If there is no slug, return the last route model found.
else
{
return $return;
}
}
}

}
14 changes: 14 additions & 0 deletions src/Http/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::controller('/', 'Salaback\LiquidCMS\Http\PublicController');
5 changes: 5 additions & 0 deletions src/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
return [
'theme' => 'app',
'section' => 'content'
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

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

class CreateAddAdminTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function(Blueprint $table)
{
$table->boolean('admin')->default(false);
});
}

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

}
35 changes: 35 additions & 0 deletions src/migrations/2015_06_13_010032_create_contents_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

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

class CreateContentsTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contents', function(Blueprint $table)
{
$table->increments('id');
$table->text('content')->nullable();
$table->integer('block_id');
$table->integer('created_by');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('contents');
}

}
37 changes: 37 additions & 0 deletions src/migrations/2015_06_13_010039_create_blocks_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

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

class CreateBlocksTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blocks', function(Blueprint $table)
{
$table->increments('id');
$table->string('slug');
$table->integer('page_id');
$table->integer('content_id')->nullable();
$table->integer('updated_by');
$table->integer('created_by');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('blocks');
}

}
37 changes: 37 additions & 0 deletions src/migrations/2015_06_13_010039_create_pages_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

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

class CreatePagesTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pages', function(Blueprint $table)
{
$table->increments('id');
$table->string('title');
$table->string('template');
$table->json('keywords')->nullable();
$table->integer('updated_by');
$table->integer('created_by');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('pages');
}

}
37 changes: 37 additions & 0 deletions src/migrations/2015_06_13_010039_create_routes_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

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

class CreateRoutesTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('routes', function(Blueprint $table)
{
$table->increments('id');
$table->string('slug');
$table->integer('depth');
$table->integer('page_id')->nullable();
$table->integer('updated_by');
$table->integer('created_by');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('routes');
}

}
Loading

0 comments on commit 120f3ae

Please sign in to comment.