diff --git a/app/controllers/BlogController.php b/app/controllers/BlogController.php deleted file mode 100755 index b5bffba247..0000000000 --- a/app/controllers/BlogController.php +++ /dev/null @@ -1,110 +0,0 @@ - function($query) - { - $query->withTrashed(); - }, - ))->orderBy('created_at', 'DESC')->paginate(); - - // Show the page - return View::make('frontend/blog/index', compact('posts')); - } - - /** - * View a blog post. - * - * @param string $slug - * @return View - * @throws NotFoundHttpException - */ - public function getView($slug) - { - // Get this blog post data - $post = Post::with(array( - 'author' => function($query) - { - $query->withTrashed(); - }, - 'comments', - ))->where('slug', $slug)->first(); - - // Check if the blog post exists - if (is_null($post)) - { - // If we ended up in here, it means that a page or a blog post - // don't exist. So, this means that it is time for 404 error page. - return App::abort(404); - } - - // Get this post comments - $comments = $post->comments()->with(array( - 'author' => function($query) - { - $query->withTrashed(); - }, - ))->orderBy('created_at', 'DESC')->get(); - - // Show the page - return View::make('frontend/blog/view-post', compact('post', 'comments')); - } - - /** - * View a blog post. - * - * @param string $slug - * @return Redirect - */ - public function postView($slug) - { - // The user needs to be logged in, make that check please - if ( ! Sentry::check()) - { - return Redirect::to("blog/$slug#comments")->with('error', 'You need to be logged in to post comments!'); - } - - // Get this blog post data - $post = Post::where('slug', $slug)->first(); - - // Declare the rules for the form validation - $rules = array( - 'comment' => 'required|min:3', - ); - - // Create a new validator instance from our dynamic rules - $validator = Validator::make(Input::all(), $rules); - - // If validation fails, we'll exit the operation now - if ($validator->fails()) - { - // Redirect to this blog post page - return Redirect::to("blog/$slug#comments")->withInput()->withErrors($validator); - } - - // Save the comment - $comment = new Comment; - $comment->user_id = Sentry::getUser()->id; - $comment->content = e(Input::get('comment')); - - // Was the comment saved with success? - if($post->comments()->save($comment)) - { - // Redirect to this blog post page - return Redirect::to("blog/$slug#comments")->with('success', 'Your comment was successfully added.'); - } - - // Redirect to this blog post page - return Redirect::to("blog/$slug#comments")->with('error', 'There was a problem adding your comment, please try again.'); - } - -} diff --git a/app/controllers/admin/BlogsController.php b/app/controllers/admin/BlogsController.php deleted file mode 100755 index 046fca2c7e..0000000000 --- a/app/controllers/admin/BlogsController.php +++ /dev/null @@ -1,177 +0,0 @@ -paginate(10); - - // Show the page - return View::make('backend/blogs/index', compact('posts')); - } - - /** - * Blog post create. - * - * @return View - */ - public function getCreate() - { - // Show the page - return View::make('backend/blogs/create'); - } - - /** - * Blog post create form processing. - * - * @return Redirect - */ - public function postCreate() - { - // Declare the rules for the form validation - $rules = array( - 'title' => 'required|min:3', - 'content' => 'required|min:3', - ); - - // Create a new validator instance from our validation rules - $validator = Validator::make(Input::all(), $rules); - - // If validation fails, we'll exit the operation now. - if ($validator->fails()) - { - // Ooops.. something went wrong - return Redirect::back()->withInput()->withErrors($validator); - } - - // Create a new blog post - $post = new Post; - - // Update the blog post data - $post->title = e(Input::get('title')); - $post->slug = e(Str::slug(Input::get('title'))); - $post->content = e(Input::get('content')); - $post->meta_title = e(Input::get('meta-title')); - $post->meta_description = e(Input::get('meta-description')); - $post->meta_keywords = e(Input::get('meta-keywords')); - $post->user_id = Sentry::getId(); - - // Was the blog post created? - if($post->save()) - { - // Redirect to the new blog post page - return Redirect::to("admin/blogs/$post->id/edit")->with('success', Lang::get('admin/blogs/message.create.success')); - } - - // Redirect to the blog post create page - return Redirect::to('admin/blogs/create')->with('error', Lang::get('admin/blogs/message.create.error')); - } - - /** - * Blog post update. - * - * @param int $postId - * @return View - */ - public function getEdit($postId = null) - { - // Check if the blog post exists - if (is_null($post = Post::find($postId))) - { - // Redirect to the blogs management page - return Redirect::to('admin/blogs')->with('error', Lang::get('admin/blogs/message.does_not_exist')); - } - - // Show the page - return View::make('backend/blogs/edit', compact('post')); - } - - /** - * Blog Post update form processing page. - * - * @param int $postId - * @return Redirect - */ - public function postEdit($postId = null) - { - // Check if the blog post exists - if (is_null($post = Post::find($postId))) - { - // Redirect to the blogs management page - return Redirect::to('admin/blogs')->with('error', Lang::get('admin/blogs/message.does_not_exist')); - } - - // Declare the rules for the form validation - $rules = array( - 'title' => 'required|min:3', - 'content' => 'required|min:3', - ); - - // Create a new validator instance from our validation rules - $validator = Validator::make(Input::all(), $rules); - - // If validation fails, we'll exit the operation now. - if ($validator->fails()) - { - // Ooops.. something went wrong - return Redirect::back()->withInput()->withErrors($validator); - } - - // Update the blog post data - $post->title = e(Input::get('title')); - $post->slug = e(Str::slug(Input::get('title'))); - $post->content = e(Input::get('content')); - $post->meta_title = e(Input::get('meta-title')); - $post->meta_description = e(Input::get('meta-description')); - $post->meta_keywords = e(Input::get('meta-keywords')); - - // Was the blog post updated? - if($post->save()) - { - // Redirect to the new blog post page - return Redirect::to("admin/blogs/$postId/edit")->with('success', Lang::get('admin/blogs/message.update.success')); - } - - // Redirect to the blogs post management page - return Redirect::to("admin/blogs/$postId/edit")->with('error', Lang::get('admin/blogs/message.update.error')); - } - - /** - * Delete the given blog post. - * - * @param int $postId - * @return Redirect - */ - public function getDelete($postId) - { - // Check if the blog post exists - if (is_null($post = Post::find($postId))) - { - // Redirect to the blogs management page - return Redirect::to('admin/blogs')->with('error', Lang::get('admin/blogs/message.not_found')); - } - - // Delete the blog post - $post->delete(); - - // Redirect to the blog posts management page - return Redirect::to('admin/blogs')->with('success', Lang::get('admin/blogs/message.delete.success')); - } - -} diff --git a/app/lang/en/admin/blogs/message.php b/app/lang/en/admin/blogs/message.php deleted file mode 100755 index 83256e2d91..0000000000 --- a/app/lang/en/admin/blogs/message.php +++ /dev/null @@ -1,22 +0,0 @@ - 'Blog post does not exist.', - - 'create' => array( - 'error' => 'Blog post was not created, please try again.', - 'success' => 'Blog post created successfully.' - ), - - 'update' => array( - 'error' => 'Blog post was not updated, please try again', - 'success' => 'Blog post updated successfully.' - ), - - 'delete' => array( - 'error' => 'There was an issue deleting the blog post. Please try again.', - 'success' => 'The blog post was deleted successfully.' - ) - -); diff --git a/app/lang/en/admin/blogs/table.php b/app/lang/en/admin/blogs/table.php deleted file mode 100755 index cef74de7de..0000000000 --- a/app/lang/en/admin/blogs/table.php +++ /dev/null @@ -1,9 +0,0 @@ - 'Blog Title', - 'comments' => '# of Comments', - 'created_at' => 'Created at', - -); diff --git a/app/models/Asset.php b/app/models/Asset.php index 58f3af8a35..f45e1bc626 100644 --- a/app/models/Asset.php +++ b/app/models/Asset.php @@ -74,6 +74,30 @@ class Asset extends Elegant { return $this->belongsTo('User','id'); } + /** + * Get total assets + */ + public static function assetcount() + { + return DB::table('assets') + + ->where('physical', '=', '1') + ->whereNull('deleted_at','and') + ->count(); + } + + /** + * Get total assets not checked out + */ + public static function availassetcount() + { + return DB::table('assets') + ->where('physical', '=', '1') + ->where('assigned_to', '=', '0') + ->whereNull('deleted_at','and') + ->count(); + + } } diff --git a/app/models/License.php b/app/models/License.php index ca8f60ee9b..85325e3f57 100644 --- a/app/models/License.php +++ b/app/models/License.php @@ -45,5 +45,30 @@ class License extends Elegant { return $this->belongsTo('User','id'); } + /** + * Get total licenses + */ + public static function assetcount() + { + return DB::table('assets') + ->where('physical', '=', '0') + ->whereNull('deleted_at','and') + ->count(); + } + + /** + * Get total licenses not checked out + */ + public static function availassetcount() + { + return DB::table('assets') + ->where('physical', '=', '0') + ->where('assigned_to', '=', '0') + ->whereNull('deleted_at','and') + ->count(); + + } + + } diff --git a/app/models/Post.php b/app/models/Post.php deleted file mode 100755 index 5ef291a8dd..0000000000 --- a/app/models/Post.php +++ /dev/null @@ -1,73 +0,0 @@ -comments()->delete(); - - // Delete the blog post - return parent::delete(); - } - - /** - * Returns a formatted post content entry, this ensures that - * line breaks are returned. - * - * @return string - */ - public function content() - { - return nl2br($this->content); - } - - /** - * Return the post's author. - * - * @return User - */ - public function author() - { - return $this->belongsTo('User', 'user_id'); - } - - /** - * Return how many comments this post has. - * - * @return array - */ - public function comments() - { - return $this->hasMany('Comment'); - } - - /** - * Return the URL to the post. - * - * @return string - */ - public function url() - { - return URL::route('view-post', $this->slug); - } - - /** - * Return the post thumbnail image url. - * - * @return string - */ - public function thumbnail() - { - # you should save the image url on the database - # and return that url here. - - return 'http://lorempixel.com/130/90/business/'; - } - -} diff --git a/app/views/backend/blogs/edit.blade.php b/app/views/backend/blogs/edit.blade.php deleted file mode 100755 index c47d13c362..0000000000 --- a/app/views/backend/blogs/edit.blade.php +++ /dev/null @@ -1,109 +0,0 @@ -@extends('backend/layouts/default') - -{{-- Page title --}} -@section('title') -Blog Post Update :: -@parent -@stop - -{{-- Page content --}} -@section('content') - - - - - -
- - - - -
- -
- -
- -
- - {{ $errors->first('title', ':message') }} -
-
- - -
- -
-
- - {{ str_finish(URL::to('/'), '/') }} - - -
-
-
- - -
- -
- - {{ $errors->first('content', ':message') }} -
-
-
- - -
- -
- -
- - {{ $errors->first('meta-title', ':message') }} -
-
- - -
- -
- - {{ $errors->first('meta-description', ':message') }} -
-
- - -
- -
- - {{ $errors->first('meta-keywords', ':message') }} -
-
-
-
- - -
-
- Cancel - - - - -
-
-
-@stop diff --git a/app/views/backend/blogs/index.blade.php b/app/views/backend/blogs/index.blade.php deleted file mode 100755 index 1b8643910a..0000000000 --- a/app/views/backend/blogs/index.blade.php +++ /dev/null @@ -1,48 +0,0 @@ -@extends('backend/layouts/default') - -{{-- Page title --}} -@section('title') -Blog Management :: -@parent -@stop - -{{-- Page content --}} -@section('content') - - -{{ $posts->links() }} - - - - - - - - - - - - @foreach ($posts as $post) - - - - - - - @endforeach - -
@lang('admin/blogs/table.title')@lang('admin/blogs/table.comments')@lang('admin/blogs/table.created_at')@lang('table.actions')
{{ $post->title }}{{ $post->comments()->count() }}{{ $post->created_at->diffForHumans() }} - @lang('button.edit') - @lang('button.delete') -
- -{{ $posts->links() }} -@stop diff --git a/app/views/backend/layouts/default.blade.php b/app/views/backend/layouts/default.blade.php index c81aecaa4f..6c8a610c51 100755 --- a/app/views/backend/layouts/default.blade.php +++ b/app/views/backend/layouts/default.blade.php @@ -116,7 +116,11 @@ Admin