Skip to content

Commit

Permalink
create [restful like] CRUD for Projects
Browse files Browse the repository at this point in the history
* add Model, set fillables for auto-columns
* add migrations
* add Controller, use Restful
* add View, use Edge (blade) renderer [and inherit layouts]
  • Loading branch information
alex7r committed Sep 9, 2018
1 parent 6e0e005 commit 8c419af
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
15 changes: 15 additions & 0 deletions admin/Controller/Project.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Copyright (c) 2018. JoomPlace, all rights reserved
*/

namespace Joomplace\Component\Roadmap\Admin\Controller;


use Joomplace\X\Controller;
use Joomplace\X\Helper\Restful;

class Project extends Controller
{
use Restful;
}
14 changes: 14 additions & 0 deletions admin/Model/Project.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* Copyright (c) 2018. JoomPlace, all rights reserved
*/

namespace Joomplace\Component\Roadmap\Admin\Model;


use Joomplace\X\Model;

class Project extends Model
{
protected $fillable = ['title', 'description'];
}
22 changes: 22 additions & 0 deletions admin/migrations/2018_09_09_232413_create_projects_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* Copyright (c) 2018. JoomPlace, all rights reserved
*/

use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateProjectsTable extends Migration
{
public function up()
{
$model = new \Joomplace\Component\Roadmap\Admin\Model\Project();
DB::schema()->create($model->getTable(), function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->string('description');
$table->timestamps();
});
}
}
15 changes: 15 additions & 0 deletions admin/view/Project/Html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Copyright (c) 2018. JoomPlace, all rights reserved
*/

namespace Joomplace\Component\Roadmap\Admin\view\Project;


use Joomplace\X\Renderer\Edge;
use Joomplace\X\View;

class Html extends View
{
use Edge;
}

0 comments on commit 8c419af

Please sign in to comment.