Skip to content

Commit

Permalink
Revised version [not complete]
Browse files Browse the repository at this point in the history
Moving more from Bulma to Blaze on Atelier CSS-Framework ...
  • Loading branch information
Arbeit authored and Arbeit committed Jan 1, 2018
1 parent 876a450 commit d2e3824
Show file tree
Hide file tree
Showing 46 changed files with 9,909 additions and 62,834 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
176 changes: 88 additions & 88 deletions src/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,107 +29,107 @@ abstract class Book extends Model {
public static $storageName;

public function title()
{
if (in_array('title', static::$dimensions))
{
return $this->morphOne(Title::class, 'titleable');
}
}
public function slug()
{
if (in_array('title', static::$dimensions))
{
return $this->morphOne(Slug::class, 'slugable');
}
}
public function description()
{
if (in_array('title', static::$dimensions))
{
return $this->morphOne(Description::class, 'descriptionable');
}
}
public function subtitle()
{
if (in_array('title', static::$dimensions))
{
{
if (in_array('title', static::$dimensions))
{
return $this->morphOne(Title::class, 'titleable');
}
}
public function slug()
{
if (in_array('title', static::$dimensions))
{
return $this->morphOne(Slug::class, 'slugable');
}
}
public function description()
{
if (in_array('title', static::$dimensions))
{
return $this->morphOne(Description::class, 'descriptionable');
}
}
public function subtitle()
{
if (in_array('title', static::$dimensions))
{
return $this->morphOne(Subtitle::class, 'subtitleable');
}
}
public function thumbnail()
{
if (in_array('title', static::$dimensions))
{
}
}
public function thumbnail()
{
if (in_array('title', static::$dimensions))
{
return $this->morphOne(Thumbnail::class, 'thumbnailable');
}
}
public function timestamp()
{
if (in_array('title', static::$dimensions))
{
}
}
public function timestamp()
{
if (in_array('title', static::$dimensions))
{
return $this->morphOne(Timestamp::class, 'timestampable');
}
}
/// fix the thing with how to find bundles without issue and sections functions rather something like: getBundle('type'), getBundle('type') alternatively run this in the construction!
public function bundles()
{
return $this->morphToMany(Bundle::class, 'bundleable');
}
public function bundle($type)
{
return $this->bundles()->where('type', $type);
}
public function bundleSingle($type)
{
return $this->bundles()->where('type', $type)->first();
}
public function keywords()
{
return $this->morphToMany(Keyword::class, 'keywordable');
}
// handle the stuff from Role::dedications and etc ...
public function people()
{
return $this->morphToMany(People::class, 'peopleable')->withPivot('role','id');
}
public function peoples($type)
{
return $this->people()->where('role', $type);
}
public function content()
}
}
/// fix the thing with how to find bundles without issue and sections functions rather something like: getBundle('type'), getBundle('type') alternatively run this in the construction!
public function bundles()
{
return $this->morphToMany(Bundle::class, 'bundleable');
}
public function bundle($type)
{
return $this->bundles()->where('type', $type);
}
public function bundleSingle($type)
{
return $this->bundles()->where('type', $type)->first();
}
public function keywords()
{
return $this->morphToMany(Keyword::class, 'keywordable');
}
// handle the stuff from Role::dedications and etc ...
public function people()
{
return $this->morphToMany(People::class, 'peopleable')->withPivot('role','id');
}
public function peoples($type)
{
return $this->people()->where('role', $type);
}
public function content()
{
$uri = static::$storageName . '/' . $this->loc . '/main.md';
$content = Storage::disk('ibook')->get($uri);
$extra = new ParsedownExtra();
$HTMLContent = $extra->text($content);
return $HTMLContent;
}
/* 💛❤️ Further development!
public function __call($name, $arguments = null)
{
// dd($arguments);
public function __call($name, $arguments = null)
{
// dd($arguments);
if ( in_array($name, static::$dimensions) )
{
$className = studly_case($name);
$tableName = static::$dimensions . 'able';;
return $this->morphOne($className, $tableName);
}
else {
return parent::__call($name, $arguments);
}
if ( in_array($name, static::$dimensions) )
{
$className = studly_case($name);
$tableName = static::$dimensions . 'able';;
return $this->morphOne($className, $tableName);
}
else {
return parent::__call($name, $arguments);
}
/*
elseif ( in_array($name, $this->relations))
{
}
elseif ( in_array($name, $this->relations))
{
}
}
*/

Expand Down
2 changes: 2 additions & 0 deletions src/Console/BookMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;

use Illuminate\Support\Str;

class BookMakeCommand extends Command
{
protected $signature = 'book:make {type}';
Expand Down
5 changes: 3 additions & 2 deletions src/Console/stubs/controller.stub
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace DummyNamespace;

use LILPLP\IBA\Http\Controllers\BookController;
use Illuminate\Http\Request as Request;

use App\DummyModelClass;

Expand Down Expand Up @@ -31,8 +32,8 @@ class DummyClass extends BookController
return response()->backend($DummyModelVariable);
}

public function update(Request $request, $id)
{
public function update(Request $request, DummyModelClass $DummyModelVariable)
{
// REQUIRED :: add what inputs to accept from the user ...
$values = $request->only([]);
$DummyModelVariable = $this->class::find($id);
Expand Down
77 changes: 46 additions & 31 deletions src/Http/Controllers/AnalogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,54 @@
use LILPLP\IBA\People;
use LILPLP\IBA\Keyword;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Routing\Controller as Controller;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\File;
use Illuminate\Contracts\Routing\ResponseFactory;

class AnalogController extends Controller
{
//
public $bookTypes;

public function __construct() {
$this->bookTypes = config('iba.book_types');
}

public function index()
{
return view('iba::index');
}

public function keywords()
{
return Keyword::all();
}

public function people()
{
return People::all();
}

public function apiHome()
{
return view('backend.apiIndex');
}

public function apiIndex()
{
return $this->bookTypes;
}
//
public $books;

public function __construct() {
$this->books = config('iba.book_types');
}

public function index()
{
$books = [];
foreach ($this->books as $key => $book)
{

$request = Request::create('iba/analog/' . $book . '/dashboard/', 'GET');
$response = Route::dispatch($request);
$books[$key] = json_decode($response->content());
// redirect('iba/analog/' . $book . '/dashboard/')->getOriginalContent();
}
return view('iba::index', compact('books'));
}

public function keywords()
{
return Keyword::all();
}

public function people()
{
return People::all();
}

public function apiHome()
{
return view('backend.apiIndex');
}

public function apiIndex()
{
return $this->books;
}

}
22 changes: 21 additions & 1 deletion src/Http/Controllers/BookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Response;

use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Route;

use App;
Expand All @@ -33,6 +33,26 @@ public function __construct()
*/
}

public function dashboard()
{
$r['name'] = $this->type;
$r['count'] = $this->class::count();
// $r['size'] = 0;
$r['size'] = $this->get_dir_size();
return $r;
}

private function get_dir_size()
{
$dir_size = 0;
$dir = storage_path() . "/ibook/" . $this->class::$storageName . "/";
foreach( File::allFiles($dir) as $file)
{
$dir_size += $file->getSize();
}
return number_format($dir_size / 1048576,2);
}

public function manage()
{
$abstract = new AbstractBook($this->class::$dimensions, $this->class::$groupings);
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/BundleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public function store(Request $request)

public function update(Request $request, $id)
{
$bundle = Bundle::find($id);
$this->validate($request, [
'title' => 'required'
]);
$values = $request->only(['title', 'slug', 'subtitle', 'description']);

$bundle = Bundle::find($id);
$bundle->type = $request->type;
$bundle->revise($values);

$bundle->save();
Expand Down

0 comments on commit d2e3824

Please sign in to comment.