Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Commit

Permalink
Dashboard
Browse files Browse the repository at this point in the history
Blog and Dashboard improved
  • Loading branch information
codeyash committed Sep 18, 2015
1 parent 25dcc03 commit 1ec0123
Show file tree
Hide file tree
Showing 44 changed files with 472 additions and 237 deletions.
44 changes: 44 additions & 0 deletions app/Http/Controllers/BlogController.php
@@ -0,0 +1,44 @@
<?php namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Blog;

class BlogController extends Controller {

/*
|--------------------------------------------------------------------------
| Home Controller
|--------------------------------------------------------------------------
|
| This controller renders your application's "dashboard" for users that
| are authenticated. Of course, you are free to change or remove the
| controller as you wish. It is just here to get your app started!
|
*/

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
/* $this->middleware('auth');*/
}

/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function getIndex($url)
{

$page = Blog::where('url', $url )->where('status' , 'Live')->firstOrFail();

return view('home.page',$page);
}



}
1 change: 1 addition & 0 deletions app/Http/routes.php
Expand Up @@ -17,6 +17,7 @@


Route::get('page/{url}', 'PageController@getIndex');
Route::get('kb/{url}', 'BlogController@getIndex');

//Authentication
// Authentication routes...
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Blog.php
Expand Up @@ -10,7 +10,7 @@ class Blog extends Model {

public static $rules = [
"title" => "required",
"url" => "required|unique:menus",
"url" => "required|unique:blogs",
"status" => "required",
"visibility" => "required",
"type" => "required",
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Page.php
Expand Up @@ -10,7 +10,7 @@ class Page extends Model {

public static $rules = [
"title" => "required",
"url" => "required|unique:menus",
"url" => "required|unique:pages",
"status" => "required",
"visibility" => "required",
"type" => "required",
Expand Down
2 changes: 2 additions & 0 deletions app/Services/Html/FormBuilder.php
Expand Up @@ -45,6 +45,8 @@ public function textfield($name, $label,$type, $options = array())

}



public function createform($fields,$form_data=[])
{
$output = '';
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions config/laravelmart.php
Expand Up @@ -29,7 +29,7 @@
['mrp','MRP:', 'text',[] ],
['price','Price:', 'text',[] ],
['discount','Discount:', 'text',[] ],
['category_id','Categories:', 'select' , [ "dynamic"=> "/category/list","multiple"=>""] ],
['category_id','Categories:', 'select' , [ "dynamic"=> "/list/categories/name","multiple"=>""] ],
['image','Image:', 'text',[] ],
['short_desc','Short Desc:', 'textarea',[] ],
['long_desc','Long Desc:', 'textarea',["rows" => "50","style" => " height: 200px;"] ]
Expand Down Expand Up @@ -107,7 +107,7 @@
['url', 'Url' , 'text' , ['Placeholder' => 'Enter Url'] ],
['status', 'Status' , 'select' , [ "options"=> [ 'draft' => 'Draft','live' => 'Live'] ,"selected" => 'live' ] ],
['visibility', 'Visibility' , 'select' , [ "options"=> [ 'public' => 'Public','private' => 'Private'] ,"selected" => 'public'] ],
['type', 'Type' , 'select' , [ "options"=> [ 'html' => 'Html','md' => 'Markdown'] ,"selected" => 'Html' ] ],
['type', 'Type' , 'select' , [ "options"=> [ 'html' => 'Html','md' => 'Markdown'] ,"selected" => 'html' ] ],
['body', 'Body' , 'textarea' , [] ],
['header', 'Header' , 'textarea' , [] ],
['parent_id','Parent' , 'select' , [ "dynamic"=> "/list/pages/title"] ],
Expand All @@ -121,18 +121,18 @@
['url', 'Url' , 'text' , ['Placeholder' => 'Enter Url'] ],
['status', 'Status' , 'select' , [ "options"=> [ 'draft' => 'Draft','live' => 'Live'] ,"selected" => 'live' ] ],
['visibility', 'Visibility' , 'select' , [ "options"=> [ 'public' => 'Public','private' => 'Private'] ,"selected" => 'public'] ],
['type', 'Type' , 'select' , [ "options"=> [ 'html' => 'Html','md' => 'Markdown'] ,"selected" => 'Html' ] ],
['type', 'Type' , 'select' , [ "options"=> [ 'html' => 'Html','md' => 'Markdown'] ,"selected" => 'html' ] ],
['body', 'Body' , 'textarea' , [] ],

['category_id','Categories:', 'select' , [ "dynamic"=> "/category/list","multiple"=>""] ],
['category_id','Categories:', 'select' , [ "dynamic"=> "/list/categories/name","multiple"=>""] ],
['author', 'Author' , 'text' , ['Placeholder' => 'Enter author name'] ],
['is_comments_allowed', 'Is Comments Allowed' , 'text' , ['Placeholder' => 'Enter 0 block comment'] ],
['is_comments_allowed', 'Is Comments Allowed' , 'select' , [ "options"=> [ '0' => 'No','1' => 'Yes'] ,"selected" => '1' ] ],
['comments_days', 'Allowed Comments Days' , 'text' , ['Placeholder' => 'Enter 0 for unlimited days'] ],

['header', 'Header' , 'textarea' , [] ]
,
],
"index" => [ 'title', 'url' ,'status', 'visibility','type', 'parent_id' ]
"index" => [ 'title', 'url' ,'status', 'visibility','type' ]
],


Expand Down
10 changes: 5 additions & 5 deletions database/migrations/2015_09_18_110000_create_blog_table.php
Expand Up @@ -2,7 +2,7 @@

use Illuminate\Database\Migrations\Migration;

class CreatePageTable extends Migration {
class CreateBlogTable extends Migration {

public function up() {
Schema::create("blogs", function($table) {
Expand All @@ -24,10 +24,10 @@ public function up() {

$table->text("header")->nullable();

$table->integer('category_id');
$table->text("author")->default('Kara Guru');
$table->boolean('is_comments_allowed')->default(true);
$table->integer('comments_days')->default(0); //0 is unlimited days
$table->integer("category_id");
$table->string("author")->default("Kara Guru");
$table->boolean("is_comments_allowed")->default(true);
$table->integer("comments_days")->default(0); //0 is unlimited days

$table->timestamps();
$table->softDeletes();
Expand Down
6 changes: 3 additions & 3 deletions database/seeds/BlogTableSeeder.php
Expand Up @@ -4,17 +4,17 @@
use App\Models\Blog;


class PageTableSeeder extends DatabaseSeeder {
class BlogTableSeeder extends DatabaseSeeder {

public function run() {

$faker = $this->getFaker();


$pages = [ "Sample Blog" => "sample-blog" ];
$blogs = [ "Sample Blog" => "sample-blog" ];


foreach($pages as $title => $url )
foreach($blogs as $title => $url )
{
Blog::create([
"title" => $title,
Expand Down
1 change: 1 addition & 0 deletions database/seeds/DatabaseSeeder.php
Expand Up @@ -37,6 +37,7 @@ public function run() {
$this->call("UserTableSeeder");
$this->call("RoleTableSeeder");
$this->call("PageTableSeeder");
$this->call("BlogTableSeeder");
$this->call("MenuTableSeeder");
$this->call("ProductTableSeeder");
$this->call("OrderTableSeeder");
Expand Down
18 changes: 13 additions & 5 deletions public/assets/css/all.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/assets/css/all.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/assets/css/all.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/rev-manifest.json
@@ -1,4 +1,4 @@
{
"assets/css/all.css": "assets/css/all-b9f8a207d0.css",
"assets/css/all.css": "assets/css/all-c76acc353a.css",
"assets/js/all.js": "assets/js/all-80f9394001.js"
}
12 changes: 12 additions & 0 deletions resources/assets/css/market.css
Expand Up @@ -701,3 +701,15 @@ a.remove-cart-item:hover {
min-width: 180px;
text-align: center;
}

.button, button, a.button {
padding: 0.5rem 0.8rem;
box-shadow: none;
border-radius: 0.1rem;
}

.left-dashboard
{
margin-top: 80px;
padding-right: 20px;
}
6 changes: 1 addition & 5 deletions resources/assets/css/sliders-theme.css
Expand Up @@ -2,11 +2,7 @@
padding: 20px;
}

p,h3,h4,pre {
text-align: left;
max-width: 540px;
margin: 0 auto 20px;
}


.rslides {
margin: 0 auto 40px;
Expand Down
12 changes: 11 additions & 1 deletion resources/views/admin/admin.blade.php
Expand Up @@ -21,7 +21,17 @@

@include("admin/common/header")

@yield('content')
<div class="row">

<div class="desktop-2 left-dashboard">
@include('admin/products/dashboardinner')
</div>

<div class="desktop-10">
@yield('content')
</div>

</div>

@include("admin/common/footer")

Expand Down
43 changes: 1 addition & 42 deletions resources/views/admin/products/dashboard.blade.php
Expand Up @@ -4,50 +4,9 @@

<div class="row dashboard">


<h1>Dashboard</h1>
<!-- <i class="float-left">Last created will be default address. Last used will be given priority.</i>
billings |
| categories |
| migrations |
| orderitems |
| orders |
| password_resets |
| permission_role |
| permissions |
| products |
| role_user |
| roles |
| sessions |
| tokens |
| users |
| wishlists

-->


<?php
$pages = [ 'menus','pages','users','categories', 'products' ,
'orders' , 'orderitems' ,'password_resets',
'billings', 'wishlists' , 'roles' ,'permissions',
'permission_role','role_user',
'coupons', 'emails', 'settings'
];
?>


@foreach($pages as $page)
<a class="button primary" href="{!! route('admin.index',$page) !!}">MANAGE {!! str_replace( "_" ," ", strtoupper($page) ) !!}</a>
@endforeach


<p>&nbsp;</p>
DASHBOARD CHARTS


</div>
Expand Down
43 changes: 43 additions & 0 deletions resources/views/admin/products/dashboardinner.blade.php
@@ -0,0 +1,43 @@
<?php
$pages = [ 'menus','pages', 'blogs', 'users','categories', 'products' ,
'orders' , 'orderitems' ,'password_resets',
'billings', 'wishlists' , 'roles' ,'permissions',
'permission_role','role_user',
'coupons', 'emails', 'settings'
];
?>

<ul class="link-list">
<!-- <li><span>Menus</span></li>-->
@foreach($pages as $page)
<li>
<a class="<?php echo Request::segment(2) == $page ? 'active':''?>" href="{!! route('admin.index',$page) !!}">Manage {!! str_replace( "_" ," ", ucfirst($page) ) !!}</a>
</li>
@endforeach
</ul>


<!-- strtoupper <i class="float-left">Last created will be default address. Last used will be given priority.</i>
billings |
| categories |
| migrations |
| orderitems |
| orders |
| password_resets |
| permission_role |
| permissions |
| products |
| role_user |
| roles |
| sessions |
| tokens |
| users |
| wishlists
-->
4 changes: 2 additions & 2 deletions resources/views/admin/products/index.blade.php
Expand Up @@ -13,8 +13,8 @@
</div>

<div class="desktop-6">
<a class="button primary" style="margin-top: 10px" href="{!! route('admin.create',[$table,"page=$page"]) !!}">Add New {!! ucfirst( str_singular($table) ) !!}</a>
<a class="button primary" style="margin-top: 10px" href="{!! route('admin.dashboard') !!}">Back to Dashboard</a>
<a class="button info" style="margin-top: 10px" href="{!! route('admin.create',[$table,"page=$page"]) !!}">Add New {!! ucfirst( str_singular($table) ) !!}</a>
<a class="button " style="margin-top: 10px" href="{!! route('admin.dashboard') !!}">Back to Dashboard</a>
</div>

</div>
Expand Down

0 comments on commit 1ec0123

Please sign in to comment.