Skip to content
This repository has been archived by the owner on Apr 12, 2019. It is now read-only.

Commit

Permalink
readme edit
Browse files Browse the repository at this point in the history
  • Loading branch information
simoebenhida committed Dec 26, 2017
1 parent 9241b06 commit 557bfdd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 21 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ Laramin Screenshot
<hr>

### Demo
<a href="http://devma.net/package/Laramin" target="_blank">Demo Here</a>

Video Demo
<a href="http://devma.net/package/Laramin" target="_blank">Demo</a>

BlogPost Demo
<a href="http://devma.net/blog/laramin-admin-panel" target="_blank">Demo Here</a>

### Getting Started

Expand Down
4 changes: 3 additions & 1 deletion src/Commands/stubs/make/model/Category.stub
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class Category extends Model
'name','slug'
];

public function posts()
protected $with = ['posts'];

public function ph onosts()
{
return $this->belongsTo('App\Post');
}
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/stubs/make/model/Post.stub
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class Post extends Model
{
use Taggable;

protected $with = ['tags'];

protected $fillable = [
'title', 'image', 'description','slug','status','featured','content','category'
];
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/stubs/make/model/Tag.stub
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class Tag extends Model
protected $fillable = [
'name','slug'
];
protected $with = ['posts'];

public function details($id = null)
{
if ($id) {
Expand Down
8 changes: 5 additions & 3 deletions src/Models/DataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

use Illuminate\Database\Eloquent\Model;

class DataInfo extends Model
{
class DataInfo extends Model {

protected $fillable = [
'column','data_types_id','validation','type','details','display'
'column', 'data_types_id', 'validation', 'type', 'details', 'display'
];

protected $with = ['types'];

public function types()
{
return $this->belongsTo('Simoja\Laramin\Models\DataType');
Expand Down
37 changes: 21 additions & 16 deletions src/Models/DataType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;

class DataType extends Model
{
class DataType extends Model {

protected $fillable = [
'name','slug','model','menu'
'name', 'slug', 'model', 'menu'
];

protected $with = ['infos'];

public function infos()
{
return $this->hasMany('Simoja\Laramin\Models\DataInfo', 'data_types_id');
Expand All @@ -20,26 +22,29 @@ public function infos()
public function fillableColumns()
{
return $this->infos()
->get()
->filter(function($item,$key) {
if($item->type == 'tags')
{
return;
}
return $item;
})->pluck('column');
->get()
->filter(function ($item, $key)
{
if ($item->type == 'tags')
{
return;
}

return $item;
})->pluck('column');
}

public function toArray()
{
$permission = Str::plural(lcfirst($this->name));

return array_merge(parent::toArray(), [
'links' => [
'browse' => url(config('laramin.prefix')."/{$this->slug}"),
'addedit' => url(config('laramin.prefix')."/{$this->slug}/create"),
],
'browse' => url(config('laramin.prefix') . "/{$this->slug}"),
'addedit' => url(config('laramin.prefix') . "/{$this->slug}/create"),
],
'infos' => $this->infos,
'read' => Auth::user()->hasPermission("read-{$permission}")
]);
'read' => Auth::user()->hasPermission("read-{$permission}")
]);
}
}

0 comments on commit 557bfdd

Please sign in to comment.