update version 1.0.2.1

This commit is contained in:
sujitprasad
2015-12-02 15:21:33 +05:30
parent 29c1cd1826
commit d7a77db621
46 changed files with 295 additions and 132 deletions

View File

@@ -78,7 +78,7 @@ class SettingsController extends Controller {
$companys = $company->whereId('1')->first();
if (Input::file('logo')) {
$name = Input::file('logo')->getClientOriginalName();
$destinationPath = 'dist';
$destinationPath = 'lb-faveo/dist/';
$fileName = rand(0000, 9999) . '.' . $name;
Input::file('logo')->move($destinationPath, $fileName);
$companys->logo = $fileName;

View File

@@ -640,7 +640,6 @@ class TicketController extends Controller {
}
}
/**
* Default helptopic
* @return type string

View File

@@ -5,6 +5,7 @@ use App\Http\Controllers\Agent\kb\SettingsController;
use App\Http\Controllers\Client\kb\UserController;
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Requests\kb\ArticleRequest;
use App\Http\Requests\kb\ArticleUpdate;
use App\Model\kb\Article;
use App\Model\kb\Category;
use App\Model\kb\Relationship;
@@ -62,8 +63,8 @@ class ArticleController extends Controller {
->addColumn('Actions', function ($model) {
//return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
//return '<form action="article/delete/ ' . $model->id . '" method="post" onclick="alert()"><button type="sumbit" value="Delete"></button></form><a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
return '<span data-toggle="modal" data-target="#banemail"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href=article/' . $model->slug . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href=show/'.$model->slug .' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
<div class="modal fade" id="banemail">
return '<span data-toggle="modal" data-target="#deletearticle'.$model->id .'"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href=show/'.$model->slug .' class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
<div class="modal fade" id="deletearticle'.$model->id .'">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
@@ -156,7 +157,7 @@ class ArticleController extends Controller {
*/
public function edit($slug, Article $article, Relationship $relation, Category $category) {
$aid = $article->where('slug', $slug)->first();
$aid = $article->where('id', $slug)->first();
$id = $aid->id;
/* define the selected fields */
@@ -178,13 +179,13 @@ class ArticleController extends Controller {
* @param type ArticleRequest $request
* @return Response
*/
public function update($slug, Article $article, Relationship $relation,
ArticleRequest $request) {
$aid = $article->where('slug', $slug)->first();
public function update($slug, Article $article, Relationship $relation, ArticleUpdate $request) {
$aid = $article->where('id', $slug)->first();
$id = $aid->id;
$sl = $request->input('slug');
$slug = str_slug($sl, "-");
$article->slug = $slug;
$slug = str_slug($sl, "-");
// dd($slug);
$article->slug = $slug;
/* get the attribute of relation table where id==$id */
$relation = $relation->where('article_id', $id);
$relation->delete();
@@ -196,8 +197,10 @@ class ArticleController extends Controller {
DB::insert('insert into article_relationship (category_id, article_id) values (?,?)', [$req, $id]);
}
/* update the value to the table */
if ($article->fill($request->except('slug'))->save()) //true: redirect to index page with success message
if ($article->fill($request->all())->save()) //true: redirect to index page with success message
{
$article->slug = $slug;
$article->save();
return redirect('article')->with('success', 'Article Updated Successfully');
} else // redirect to index page with fails message
{

View File

@@ -1,9 +1,10 @@
<?php namespace App\Http\Controllers\Agent\kb;
use App\Http\Controllers\Client\kb\UserController;
use App\Http\Controllers\client\kb\UserController;
use App\Http\Controllers\admin\kb\ArticleController;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\kb\SettingsController;
use App\Http\Requests\kb\CategoryRequest;
use App\Http\Requests\kb\CategoryUpdate;
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Model\kb\Category;
use App\Model\kb\Relationship;
@@ -60,8 +61,8 @@ class CategoryController extends Controller {
})
->addColumn('Actions', function ($model) {
//return '<a href=category/delete/' . $model->id . ' class="btn btn-danger btn-flat">Delete</a>&nbsp;<a href=category/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=article-list class="btn btn-warning btn-flat">View</a>';
return '<span data-toggle="modal" data-target="#banemail"><a href="#" ><button class="btn btn-danger btn-xs"></a>'. \Lang::get("lang.delete") .'</button></span>&nbsp;<a href=category/' . $model->slug . '/edit class="btn btn-warning btn-xs">'. \Lang::get("lang.edit") .'</a>&nbsp;<a href=article-list class="btn btn-primary btn-xs">'. \Lang::get("lang.view") .'</a>
<div class="modal fade" id="banemail">
return '<span data-toggle="modal" data-target="#deletecategory' . $model->slug . '"><a href="#" ><button class="btn btn-danger btn-xs"></a>'. \Lang::get("lang.delete") .'</button></span>&nbsp;<a href=category/' . $model->id . '/edit class="btn btn-warning btn-xs">'. \Lang::get("lang.edit") .'</a>&nbsp;<a href=article-list class="btn btn-primary btn-xs">'. \Lang::get("lang.view") .'</a>
<div class="modal fade" id="deletecategory' . $model->slug . '">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
@@ -138,7 +139,7 @@ class CategoryController extends Controller {
*/
public function edit($slug, Category $category) {
$cid = $category->where('slug', $slug)->first();
$cid = $category->where('id', $slug)->first();
$id = $cid->id;
/* get the atributes of the category model whose id == $id */
$category = $category->whereId($id)->first();
@@ -153,17 +154,19 @@ class CategoryController extends Controller {
* @param int $id
* @return Response
*/
public function update($slug, Category $category, CategoryRequest $request) {
public function update($slug, Category $category, CategoryUpdate $request) {
/* Edit the selected category via id */
$category = $category->where('slug', $slug)->first();
$category = $category->where('id', $slug)->first();
$sl = $request->input('slug');
$slug = str_slug($sl, "-");
// dd($slug);
$category->slug = $slug;
/* update the values at the table via model according with the request */
if ($category->fill($request->except('slug'))->save()) //True: redirct to index page with success message
if ($category->fill($request->all())->save()) //True: redirct to index page with success message
{
$category->slug = $slug;
$category->save();
return redirect('category')->with('success', 'Category Updated Successfully');
} else //redirect to index with fails message
{
@@ -178,17 +181,25 @@ class CategoryController extends Controller {
* @return Response
*/
public function destroy($id, Category $category, Relationship $relation) {
$relation = $relation->where('category_id', $id)->delete();
// $relation->delete();
/* delete the category selected, id == $id */
$category = $category->whereId($id)->first();
if ($category->delete()) //True: redirect to index with success message
{
return Redirect::back()->with('success', 'Category Deleted Successfully');
} else //redirect to index page fails message
{
$relation = $relation->where('category_id', $id)->first();
// dd($relation);
if($relation != null){
return Redirect::back()->with('fails', 'Category Not Deleted');
}
else {
/* delete the category selected, id == $id */
$category = $category->whereId($id)->first();
if ($category->delete()) //True: redirect to index with success message
{
return Redirect::back()->with('success', 'Category Deleted Successfully');
} else //redirect to index page fails message
{
return Redirect::back()->with('fails', 'Category Not Deleted');
}
}
}
}

View File

@@ -1,11 +1,12 @@
<?php namespace App\Http\Controllers\Agent\kb;
use App\Http\Controllers\Client\kb\UserController;
use App\Http\Controllers\client\kb\UserController;
use App\Http\Controllers\Agent\kb\ArticleController;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Agent\kb\SettingsController;
use App\Http\Controllers\Agent\helpdesk\TicketController;
use App\Http\Requests\kb\PageRequest;
use App\Http\Requests\kb\PageUpdate;
use App\Model\kb\Page;
use Datatable;
use Illuminate\Http\Request;
@@ -56,8 +57,8 @@ class PageController extends Controller {
->addColumn('Actions', function ($model) {
//return '<a href=page/delete/' . $model->id . ' class="btn btn-danger btn-flat">Delete</a>&nbsp;<a href=page/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=article-list class="btn btn-warning btn-flat">View</a>';
return '<span data-toggle="modal" data-target="#banemail"><a href="#" ><button class="btn btn-danger btn-xs"></a> '. \Lang::get('lang.delete') .'</button></span>&nbsp;<a href=page/' . $model->slug . '/edit class="btn btn-warning btn-xs">'. \Lang::get('lang.edit') .'</a>&nbsp;<a href=pages/' . $model->slug . ' class="btn btn-primary btn-xs">'. \Lang::get('lang.view') .'</a>
<div class="modal fade" id="banemail">
return '<span data-toggle="modal" data-target="#deletepage' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> '. \Lang::get('lang.delete') .'</button></span>&nbsp;<a href=page/' . $model->slug . '/edit class="btn btn-warning btn-xs">'. \Lang::get('lang.edit') .'</a>&nbsp;<a href=pages/' . $model->slug . ' class="btn btn-primary btn-xs">'. \Lang::get('lang.view') .'</a>
<div class="modal fade" id="deletepage' . $model->id . '">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
@@ -129,14 +130,16 @@ class PageController extends Controller {
* @param type Request $request
* @return type
*/
public function update($slug, PageRequest $request) {
public function update($slug, PageUpdate $request) {
$pages = $this->page->where('slug', $slug)->first();
$sl = $request->input('slug');
$slug = str_slug($sl, "-");
$this->page->slug = $slug;
//$id = $page->id;
$pages->fill($request->except('slug'))->save();
$pages->fill($request->all())->save();
$pages->slug = $slug;
$pages->save();
return redirect('page')->with('success', 'Your Page Updated Successfully');
}
@@ -151,4 +154,4 @@ class PageController extends Controller {
return redirect('page')->with('success', 'Page Deleted Successfully');
}
}
}

View File

@@ -395,12 +395,11 @@ class InstallController extends Controller {
File::put($install, $datacontent);
$smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()";
$path22 = app_path('Http\routes.php');
$path22 = app_path('Http/routes.php');
$content23 = File::get($path22);
$content23 = str_replace('"%smtplink%"', $smtpfilepath, $content23);
File::put($path22, $content23);
try {
return View::make('themes/default1/installer/helpdesk/view7');
} catch (Exception $e) {