diff --git a/app/Http/Controllers/Admin/ModuleController.php b/app/Http/Controllers/Admin/ModuleController.php
index bd34609..f497ecb 100644
--- a/app/Http/Controllers/Admin/ModuleController.php
+++ b/app/Http/Controllers/Admin/ModuleController.php
@@ -25,6 +25,10 @@ public function index() {
'create_route' => route('admin.' . $this->handle_name_plural . '.create'),
'table_status' => 'all', //all , trashed
'all_count' => $all_count,
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
'trashed_count' => $trashed_count,
]);
}
@@ -33,7 +37,11 @@ public function create() {
$form_action = route('admin.modules.store');
$col_types = getColumnTypes();
$edit = 0;
- return kview($this->handle_name_plural . '.manage', compact('form_action', 'col_types', 'edit'));
+ $module_names = [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ];
+ return kview($this->handle_name_plural . '.manage', compact('form_action', 'module_names', 'col_types', 'edit'));
}
public function edit(Request $request) {
@@ -42,9 +50,13 @@ public function edit(Request $request) {
$col_types = getColumnTypes();
$data = Table::where('id', '=', $request->id)->first();
$edit = 0;
+ $module_names = [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ];
return kview(
$this->handle_name_plural . '.manage',
- compact('form_action', 'col_types', 'data', 'edit')
+ compact('form_action', 'col_types', 'module_names', 'data', 'edit')
);
}
diff --git a/app/Http/Controllers/Admin/PageController.php b/app/Http/Controllers/Admin/PageController.php
index 3b79122..9dae1c8 100644
--- a/app/Http/Controllers/Admin/PageController.php
+++ b/app/Http/Controllers/Admin/PageController.php
@@ -10,164 +10,176 @@
use Illuminate\Http\Request;
class PageController extends Controller {
- protected $handle_name = "page";
- protected $handle_name_plural = "pages";
+ protected $handle_name = "page";
+ protected $handle_name_plural = "pages";
- public function index() {
- $all_count = Table::count();
- $trashed_count = Table::onlyTrashed()->count();
- return kview($this->handle_name_plural . '.index', [
- 'ajax_route' => route('admin.' . $this->handle_name_plural . '.ajax'),
- 'delete_route' => route('admin.' . $this->handle_name_plural . '.delete'),
- 'create_route' => route('admin.' . $this->handle_name_plural . '.create'),
- 'table_status' => 'all', //all , trashed
- 'all_count' => $all_count,
- 'trashed_count' => $trashed_count,
- ]);
- }
- public function create() {
- return kview($this->handle_name_plural . '.manage', [
- 'form_action' => route('admin.' . $this->handle_name_plural . '.store'),
- 'edit' => 0,
- ]);
- }
- public function edit(Request $request) {
- return kview($this->handle_name_plural . '.manage', [
- 'form_action' => route('admin.' . $this->handle_name_plural . '.update'),
- 'edit' => 1,
- 'data' => Table::where('id', '=', $request->id)->first(),
- ]);
- }
- public function store(AddRequest $request) {
- try {
+ public function index() {
+ $all_count = Table::count();
+ $trashed_count = Table::onlyTrashed()->count();
+ return kview($this->handle_name_plural . '.index', [
+ 'ajax_route' => route('admin.' . $this->handle_name_plural . '.ajax'),
+ 'delete_route' => route('admin.' . $this->handle_name_plural . '.delete'),
+ 'create_route' => route('admin.' . $this->handle_name_plural . '.create'),
+ 'table_status' => 'all', //all , trashed
+ 'all_count' => $all_count,
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ 'trashed_count' => $trashed_count,
+ ]);
+ }
+ public function create() {
+ return kview($this->handle_name_plural . '.manage', [
+ 'form_action' => route('admin.' . $this->handle_name_plural . '.store'),
+ 'edit' => 0,
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ ]);
+ }
+ public function edit(Request $request) {
+ return kview($this->handle_name_plural . '.manage', [
+ 'form_action' => route('admin.' . $this->handle_name_plural . '.update'),
+ 'edit' => 1,
+ 'data' => Table::where('id', '=', $request->id)->first(),
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ ]);
+ }
+ public function store(AddRequest $request) {
+ try {
- $table = Table::create([
- 'name' => $request->name,
- ]);
+ $table = Table::create([
+ 'name' => $request->name,
+ ]);
- return redirect()->to(route('admin.' . $this->handle_name_plural . '.index'))->with('success', 'New ' . ucfirst($this->handle_name) . ' has been added.');
- } catch (Exception $e) {
- return $e->getMessage();
- return redirect()->back()->with('error', $e->getMessage());
- }
+ return redirect()->to(route('admin.' . $this->handle_name_plural . '.index'))->with('success', 'New ' . ucfirst($this->handle_name) . ' has been added.');
+ } catch (Exception $e) {
+ return $e->getMessage();
+ return redirect()->back()->with('error', $e->getMessage());
}
- public function update(UpdateRequest $request) {
- try {
- $update_data = [
- 'name' => $request->name,
- ];
- $where = [
- 'id' => $request->id
- ];
- Table::updateOrCreate($where, $update_data);
+ }
+ public function update(UpdateRequest $request) {
+ try {
+ $update_data = [
+ 'name' => $request->name,
+ ];
+ $where = [
+ 'id' => $request->id
+ ];
+ Table::updateOrCreate($where, $update_data);
- return redirect()->back()->with('success', ucfirst($this->handle_name) . ' has been updated');
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
+ return redirect()->back()->with('success', ucfirst($this->handle_name) . ' has been updated');
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
+ }
+ }
+ public function ajax(Request $request) {
+ $edit_route = route('admin.' . $this->handle_name_plural . '.edit');
+ $current_page = $request->page_number;
+ if (isset($request->limit)) {
+ $limit = $request->limit;
+ } else {
+ $limit = 10;
+ }
+ $offset = (($current_page - 1) * $limit);
+ $modalObject = new Table();
+ if (isset($request->string)) {
+ $string = $request->string;
+ $modalObject = $modalObject->where('name', 'like', "%" . $request->string . "%");
+ // $modalObject = $modalObject->orWhere('name','like',"%".$request->string."%");
}
- public function ajax(Request $request) {
- $edit_route = route('admin.' . $this->handle_name_plural . '.edit');
- $current_page = $request->page_number;
- if (isset($request->limit)) {
- $limit = $request->limit;
- } else {
- $limit = 10;
- }
- $offset = (($current_page - 1) * $limit);
- $modalObject = new Table();
- if (isset($request->string)) {
- $string = $request->string;
- $modalObject = $modalObject->where('name', 'like', "%" . $request->string . "%");
- // $modalObject = $modalObject->orWhere('name','like',"%".$request->string."%");
- }
- $all_trashed = $request->all_trashed;
- if ($all_trashed == "trashed") {
- $modalObject = $modalObject->onlyTrashed();
- }
+ $all_trashed = $request->all_trashed;
+ if ($all_trashed == "trashed") {
+ $modalObject = $modalObject->onlyTrashed();
+ }
- $total_records = $modalObject->count();
- $modalObject = $modalObject->offset($offset);
- $modalObject = $modalObject->take($limit);
- $data = $modalObject->get();
+ $total_records = $modalObject->count();
+ $modalObject = $modalObject->offset($offset);
+ $modalObject = $modalObject->take($limit);
+ $data = $modalObject->get();
- if (isset($request->page_number) && $request->page_number != 1) {
- $page_number = $request->page_number + $limit - 1;
- } else {
- $page_number = 1;
- }
- $pagination = array(
- "offset" => $offset,
- "total_records" => $total_records,
- "item_per_page" => $limit,
- "total_pages" => ceil($total_records / $limit),
- "current_page" => $current_page,
- );
+ if (isset($request->page_number) && $request->page_number != 1) {
+ $page_number = $request->page_number + $limit - 1;
+ } else {
+ $page_number = 1;
+ }
+ $pagination = array(
+ "offset" => $offset,
+ "total_records" => $total_records,
+ "item_per_page" => $limit,
+ "total_pages" => ceil($total_records / $limit),
+ "current_page" => $current_page,
+ );
- return kview($this->handle_name_plural . '.ajax', compact('edit_route', 'data', 'page_number', 'limit', 'offset', 'pagination'));
+ return kview($this->handle_name_plural . '.ajax', compact('edit_route', 'data', 'page_number', 'limit', 'offset', 'pagination'));
+ }
+ public function delete(Request $request) {
+ if (isset($request->action)) {
+ $action = $request->action;
+ $is_bulk = $request->is_bulk;
+ $data_id = $request->data_id;
}
- public function delete(Request $request) {
- if (isset($request->action)) {
- $action = $request->action;
- $is_bulk = $request->is_bulk;
- $data_id = $request->data_id;
+ switch ($action) {
+ case 'restore':
+ try {
+ if ($is_bulk == 1) {
+ $data_id = explode(",", $data_id);
+ $table = Table::onlyTrashed()->whereIn('id', $data_id);
+ $table->restore();
+ return 1;
+ } else {
+ $table = Table::onlyTrashed()->find($data_id);
+ $table->restore();
+ return 1;
+ }
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
+ }
+ break;
+ case 'trash':
+ try {
+ if ($is_bulk == 1) {
+ $data_id = explode(",", $data_id);
+ $table = Table::whereIn('id', $data_id);
+ $table->delete();
+ return 1;
+ } else {
+ $table = Table::find($data_id);
+ $table->delete();
+ return 1;
+ }
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
}
- switch ($action) {
- case 'restore':
- try {
- if ($is_bulk == 1) {
- $data_id = explode(",", $data_id);
- $table = Table::onlyTrashed()->whereIn('id', $data_id);
- $table->restore();
- return 1;
- } else {
- $table = Table::onlyTrashed()->find($data_id);
- $table->restore();
- return 1;
- }
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
- break;
- case 'trash':
- try {
- if ($is_bulk == 1) {
- $data_id = explode(",", $data_id);
- $table = Table::whereIn('id', $data_id);
- $table->delete();
- return 1;
- } else {
- $table = Table::find($data_id);
- $table->delete();
- return 1;
- }
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
- break;
- case 'delete':
- try {
- if ($is_bulk == 1) {
- $data_id = explode(",", $data_id);
- $table = Table::withTrashed()->whereIn('id', $data_id)->get();
- foreach ($table as $tbl) {
- // $detach_relationship = $tbl->relationship()->detach();
- $tbl->forceDelete();
- }
- return 1;
- } else {
- $table = Table::withTrashed()->find($data_id);
- // $detach_relationship = $table->relationship()->detach();
- $data = $table->forceDelete();
- return 1;
- }
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
- break;
- default:
- return 0;
+ break;
+ case 'delete':
+ try {
+ if ($is_bulk == 1) {
+ $data_id = explode(",", $data_id);
+ $table = Table::withTrashed()->whereIn('id', $data_id)->get();
+ foreach ($table as $tbl) {
+ // $detach_relationship = $tbl->relationship()->detach();
+ $tbl->forceDelete();
+ }
+ return 1;
+ } else {
+ $table = Table::withTrashed()->find($data_id);
+ // $detach_relationship = $table->relationship()->detach();
+ $data = $table->forceDelete();
+ return 1;
+ }
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
}
+ break;
+ default:
+ return 0;
}
+ }
}
diff --git a/app/Http/Controllers/Admin/SettingController.php b/app/Http/Controllers/Admin/SettingController.php
index 7940a7c..691038f 100644
--- a/app/Http/Controllers/Admin/SettingController.php
+++ b/app/Http/Controllers/Admin/SettingController.php
@@ -28,30 +28,15 @@ public function edit_profile() {
return kview('users.manage', [
'form_action' => route('admin.users.update'),
'edit' => 1,
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
'data' => $user,
'roles' => $roles,
]);
}
- // public function update(Request $request) {
- // if (isset($request->SITE_NAME)) {
- // $this->updateSetting('SITE_NAME', $request->SITE_NAME);
- // }
- // if (isset($request->site_url)) {
- // $this->updateSetting('site_url', $request->site_url);
- // }
- // if (isset($request->tagline)) {
- // $this->updateSetting('tagline', $request->tagline);
- // }
- // if (isset($request->instagram_cookie)) {
- // $this->updateSetting('instagram_cookie', $request->instagram_cookie);
- // }
- // if (isset($request->theme)) {
- // $this->updateSetting('theme', $request->theme);
- // }
- // return redirect()->back()->with('success', 'Settings has been updated');
- // }
-
public function updateSetting($key, $value) {
$where = [
'key' => $key,
@@ -66,158 +51,170 @@ public function index() {
$all_count = Table::count();
$trashed_count = Table::onlyTrashed()->count();
return kview($this->handle_name_plural . '.index', [
- 'ajax_route' => route('admin.' . $this->handle_name_plural . '.ajax'),
- 'delete_route' => route('admin.' . $this->handle_name_plural . '.delete'),
- 'create_route' => route('admin.' . $this->handle_name_plural . '.create'),
- 'table_status' => 'all', //all , trashed
- 'all_count' => $all_count,
- 'trashed_count' => $trashed_count,
+ 'ajax_route' => route('admin.' . $this->handle_name_plural . '.ajax'),
+ 'delete_route' => route('admin.' . $this->handle_name_plural . '.delete'),
+ 'create_route' => route('admin.' . $this->handle_name_plural . '.create'),
+ 'table_status' => 'all', //all , trashed
+ 'all_count' => $all_count,
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ 'trashed_count' => $trashed_count,
]);
}
public function create() {
- return kview($this->handle_name_plural . '.manage', [
- 'form_action' => route('admin.' . $this->handle_name_plural . '.store'),
- 'edit' => 0,
- ]);
+ return kview($this->handle_name_plural . '.manage', [
+ 'form_action' => route('admin.' . $this->handle_name_plural . '.store'),
+ 'edit' => 0,
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ ]);
}
public function edit(Request $request) {
- return kview($this->handle_name_plural . '.manage', [
- 'form_action' => route('admin.' . $this->handle_name_plural . '.update'),
- 'edit' => 1,
- 'data' => Table::where('id', '=', $request->id)->first(),
- ]);
+ return kview($this->handle_name_plural . '.manage', [
+ 'form_action' => route('admin.' . $this->handle_name_plural . '.update'),
+ 'edit' => 1,
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ 'data' => Table::where('id', '=', $request->id)->first(),
+ ]);
}
public function store(Request $request) {
- try {
+ try {
- $table = Table::create([
- 'key' => $request->key,
- 'value' => $request->value,
- ]);
+ $table = Table::create([
+ 'key' => $request->key,
+ 'value' => $request->value,
+ ]);
- return redirect()->to(route('admin.' . $this->handle_name_plural . '.index'))->with('success', 'New ' . ucfirst($this->handle_name) . ' has been added.');
- } catch (Exception $e) {
- return $e->getMessage();
- return redirect()->back()->with('error', $e->getMessage());
- }
+ return redirect()->to(route('admin.' . $this->handle_name_plural . '.index'))->with('success', 'New ' . ucfirst($this->handle_name) . ' has been added.');
+ } catch (Exception $e) {
+ return $e->getMessage();
+ return redirect()->back()->with('error', $e->getMessage());
+ }
}
public function update(Request $request) {
- try {
- $update_data = [
- 'key' => $request->key,
- 'value' => $request->value,
- ];
- $where = [
- 'id' => $request->id
- ];
- Table::updateOrCreate($where, $update_data);
+ try {
+ $update_data = [
+ 'key' => $request->key,
+ 'value' => $request->value,
+ ];
+ $where = [
+ 'id' => $request->id
+ ];
+ Table::updateOrCreate($where, $update_data);
- return redirect()->to(route('admin.' . $this->handle_name_plural . '.index'))->with('success', 'New ' . ucfirst($this->handle_name) . ' has been added.');
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
+ return redirect()->to(route('admin.' . $this->handle_name_plural . '.index'))->with('success', 'New ' . ucfirst($this->handle_name) . ' has been added.');
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
+ }
}
public function ajax(Request $request) {
- $edit_route = route('admin.' . $this->handle_name_plural . '.edit');
- $current_page = $request->page_number;
- if (isset($request->limit)) {
- $limit = $request->limit;
- } else {
- $limit = 10;
- }
- $offset = (($current_page - 1) * $limit);
- $modalObject = new Table();
- if (isset($request->string)) {
- $string = $request->string;
- $modalObject = $modalObject->where('key', 'like', "%" . $request->string . "%");
- }
+ $edit_route = route('admin.' . $this->handle_name_plural . '.edit');
+ $current_page = $request->page_number;
+ if (isset($request->limit)) {
+ $limit = $request->limit;
+ } else {
+ $limit = 10;
+ }
+ $offset = (($current_page - 1) * $limit);
+ $modalObject = new Table();
+ if (isset($request->string)) {
+ $string = $request->string;
+ $modalObject = $modalObject->where('key', 'like', "%" . $request->string . "%");
+ }
- $all_trashed = $request->all_trashed;
- if ($all_trashed == "trashed") {
- $modalObject = $modalObject->onlyTrashed();
- }
+ $all_trashed = $request->all_trashed;
+ if ($all_trashed == "trashed") {
+ $modalObject = $modalObject->onlyTrashed();
+ }
- $total_records = $modalObject->count();
- $modalObject = $modalObject->offset($offset);
- $modalObject = $modalObject->take($limit);
- $data = $modalObject->get();
+ $total_records = $modalObject->count();
+ $modalObject = $modalObject->offset($offset);
+ $modalObject = $modalObject->take($limit);
+ $data = $modalObject->get();
- if (isset($request->page_number) && $request->page_number != 1) {
- $page_number = $request->page_number + $limit - 1;
- } else {
- $page_number = 1;
- }
- $pagination = array(
- "offset" => $offset,
- "total_records" => $total_records,
- "item_per_page" => $limit,
- "total_pages" => ceil($total_records / $limit),
- "current_page" => $current_page,
- );
+ if (isset($request->page_number) && $request->page_number != 1) {
+ $page_number = $request->page_number + $limit - 1;
+ } else {
+ $page_number = 1;
+ }
+ $pagination = array(
+ "offset" => $offset,
+ "total_records" => $total_records,
+ "item_per_page" => $limit,
+ "total_pages" => ceil($total_records / $limit),
+ "current_page" => $current_page,
+ );
- return kview($this->handle_name_plural . '.ajax', compact('edit_route', 'data', 'page_number', 'limit', 'offset', 'pagination'));
+ return kview($this->handle_name_plural . '.ajax', compact('edit_route', 'data', 'page_number', 'limit', 'offset', 'pagination'));
}
public function delete(Request $request) {
- if (isset($request->action)) {
- $action = $request->action;
- $is_bulk = $request->is_bulk;
- $data_id = $request->data_id;
- }
- switch ($action) {
- case 'restore':
- try {
- if ($is_bulk == 1) {
- $data_id = explode(",", $data_id);
- $table = Table::onlyTrashed()->whereIn('id', $data_id);
- $table->restore();
- return 1;
- } else {
- $table = Table::onlyTrashed()->find($data_id);
- $table->restore();
- return 1;
- }
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
- break;
- case 'trash':
- try {
- if ($is_bulk == 1) {
- $data_id = explode(",", $data_id);
- $table = Table::whereIn('id', $data_id);
- $table->delete();
- return 1;
- } else {
- $table = Table::find($data_id);
- $table->delete();
- return 1;
- }
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
- break;
- case 'delete':
- try {
- if ($is_bulk == 1) {
- $data_id = explode(",", $data_id);
- $table = Table::withTrashed()->whereIn('id', $data_id)->get();
- foreach ($table as $tbl) {
- // $detach_relationship = $tbl->relationship()->detach();
- $tbl->forceDelete();
- }
- return 1;
- } else {
- $table = Table::withTrashed()->find($data_id);
- // $detach_relationship = $table->relationship()->detach();
- $data = $table->forceDelete();
- return 1;
- }
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
- break;
- default:
- return 0;
- }
+ if (isset($request->action)) {
+ $action = $request->action;
+ $is_bulk = $request->is_bulk;
+ $data_id = $request->data_id;
+ }
+ switch ($action) {
+ case 'restore':
+ try {
+ if ($is_bulk == 1) {
+ $data_id = explode(",", $data_id);
+ $table = Table::onlyTrashed()->whereIn('id', $data_id);
+ $table->restore();
+ return 1;
+ } else {
+ $table = Table::onlyTrashed()->find($data_id);
+ $table->restore();
+ return 1;
+ }
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
+ }
+ break;
+ case 'trash':
+ try {
+ if ($is_bulk == 1) {
+ $data_id = explode(",", $data_id);
+ $table = Table::whereIn('id', $data_id);
+ $table->delete();
+ return 1;
+ } else {
+ $table = Table::find($data_id);
+ $table->delete();
+ return 1;
+ }
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
+ }
+ break;
+ case 'delete':
+ try {
+ if ($is_bulk == 1) {
+ $data_id = explode(",", $data_id);
+ $table = Table::withTrashed()->whereIn('id', $data_id)->get();
+ foreach ($table as $tbl) {
+ // $detach_relationship = $tbl->relationship()->detach();
+ $tbl->forceDelete();
+ }
+ return 1;
+ } else {
+ $table = Table::withTrashed()->find($data_id);
+ // $detach_relationship = $table->relationship()->detach();
+ $data = $table->forceDelete();
+ return 1;
+ }
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
+ }
+ break;
+ default:
+ return 0;
+ }
}
}
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 459b3d7..870c5a4 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -6,34 +6,35 @@
use App\Models\User;
use App\Providers\RouteServiceProvider;
-class HomeController extends Controller
-{
- /**
- * Create a new controller instance.
- *
- * @return void
- */
- public function __construct()
- {
- $this->middleware('auth');
- }
+class HomeController extends Controller {
+ /**
+ * Create a new controller instance.
+ *
+ * @return void
+ */
+ public function __construct() {
+ $this->middleware('auth');
+ }
- /**
- * Show the application dashboard.
- *
- * @return \Illuminate\Contracts\Support\Renderable
- */
- public function index()
- {
+ /**
+ * Show the application dashboard.
+ *
+ * @return \Illuminate\Contracts\Support\Renderable
+ */
+ public function index() {
- // Preparing count for Dashboard Array
- $users = User::count();
+ // Preparing count for Dashboard Array
+ $users = User::count();
- // Preparing Dashboard card Array.
- $dashboard_cards = [
- ['Users', $users, Route('admin.users.index'),'fa fa-dashboard'],
- // ['News', $news, 'news.index'],
- ];
- return kview('home',compact('dashboard_cards'));
- }
+ // Preparing Dashboard card Array.
+ $dashboard_cards = [
+ ['Users', $users, Route('admin.users.index'), 'fa fa-dashboard'],
+ // ['News', $news, 'news.index'],
+ ];
+ $module_names = [
+ 'singular' => 'dashboard',
+ 'plural' => 'dashboard',
+ ];
+ return kview('home', compact('dashboard_cards', 'module_names'));
+ }
}
diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php
index d79b45f..2673e02 100644
--- a/app/Http/Controllers/IndexController.php
+++ b/app/Http/Controllers/IndexController.php
@@ -5,18 +5,18 @@
use Illuminate\Http\Request;
class IndexController extends Controller {
- /**
- * Create a new controller instance.
- *
- * @return void
- */
+ /**
+ * Create a new controller instance.
+ *
+ * @return void
+ */
- /**
- * Show the application dashboard.
- *
- * @return \Illuminate\Contracts\Support\Renderable
- */
- public function index() {
- return view('welcome');
- }
+ /**
+ * Show the application dashboard.
+ *
+ * @return \Illuminate\Contracts\Support\Renderable
+ */
+ public function index() {
+ return view('welcome');
+ }
}
diff --git a/app/Http/Controllers/RoleController.php b/app/Http/Controllers/RoleController.php
index 0118eb9..1cf9679 100644
--- a/app/Http/Controllers/RoleController.php
+++ b/app/Http/Controllers/RoleController.php
@@ -9,153 +9,165 @@
use Auth;
class RoleController extends Controller {
- protected $handle_name = "role";
- protected $handle_name_plural = "roles";
+ protected $handle_name = "role";
+ protected $handle_name_plural = "roles";
- public function index() {
- $all_count = Table::count();
- return kview($this->handle_name_plural . '.index', [
- 'ajax_route' => route('admin.' . $this->handle_name_plural . '.ajax'),
- 'delete_route' => route('admin.' . $this->handle_name_plural . '.delete'),
- 'create_route' => route('admin.' . $this->handle_name_plural . '.create'),
- 'all_count' => $all_count,
- ]);
- }
- public function create() {
- return kview($this->handle_name_plural . '.manage', [
- 'form_action' => route('admin.' . $this->handle_name_plural . '.store'),
- 'edit' => 0,
- ]);
- }
- public function edit(Request $request) {
- return kview($this->handle_name_plural . '.manage', [
- 'form_action' => route('admin.' . $this->handle_name_plural . '.update'),
- 'edit' => 1,
- 'data' => Table::where('id', '=', $request->id)->first(),
- ]);
- }
- public function store(Request $request) {
- try {
- $role = Table::create([
- 'name' => $request->name,
- ]);
+ public function index() {
+ $all_count = Table::count();
+ return kview($this->handle_name_plural . '.index', [
+ 'ajax_route' => route('admin.' . $this->handle_name_plural . '.ajax'),
+ 'delete_route' => route('admin.' . $this->handle_name_plural . '.delete'),
+ 'create_route' => route('admin.' . $this->handle_name_plural . '.create'),
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ 'all_count' => $all_count,
+ ]);
+ }
+ public function create() {
+ return kview($this->handle_name_plural . '.manage', [
+ 'form_action' => route('admin.' . $this->handle_name_plural . '.store'),
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ 'edit' => 0,
+ ]);
+ }
+ public function edit(Request $request) {
+ return kview($this->handle_name_plural . '.manage', [
+ 'form_action' => route('admin.' . $this->handle_name_plural . '.update'),
+ 'edit' => 1,
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ 'data' => Table::where('id', '=', $request->id)->first(),
+ ]);
+ }
+ public function store(Request $request) {
+ try {
+ $role = Table::create([
+ 'name' => $request->name,
+ ]);
- $permissions = $request->permissions;
- $addPermissions = [];
- if ($permissions) {
- foreach ($permissions as $key => $value) {
- if ($value == "on") {
- $existingPermission = Permission::where('name', $key)->count();
- if ($existingPermission == 0) {
- Permission::create(['name' => $key]);
- }
- array_push($addPermissions, $key);
- }
- }
- $role->syncPermissions($addPermissions);
+ $permissions = $request->permissions;
+ $addPermissions = [];
+ if ($permissions) {
+ foreach ($permissions as $key => $value) {
+ if ($value == "on") {
+ $existingPermission = Permission::where('name', $key)->count();
+ if ($existingPermission == 0) {
+ Permission::create(['name' => $key]);
}
-
- return redirect()->to(route('admin.' . $this->handle_name_plural . '.index'))->with('success', 'New ' . ucfirst($this->handle_name) . ' has been added.');
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
+ array_push($addPermissions, $key);
+ }
}
+ $role->syncPermissions($addPermissions);
+ }
+
+ return redirect()->to(route('admin.' . $this->handle_name_plural . '.index'))->with('success', 'New ' . ucfirst($this->handle_name) . ' has been added.');
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
}
- public function update(Request $request) {
- try {
+ }
+ public function update(Request $request) {
+ try {
- $update_data = [
- 'name' => $request->name,
- ];
- $where = [
- 'id' => $request->id
- ];
- $role = Table::updateOrCreate($where, $update_data);
+ $update_data = [
+ 'name' => $request->name,
+ ];
+ $where = [
+ 'id' => $request->id
+ ];
+ $role = Table::updateOrCreate($where, $update_data);
- $permissions = $request->permissions;
- $addPermissions = [];
- if ($permissions) {
- foreach ($permissions as $key => $value) {
- if ($value == "on") {
- $existingPermission = Permission::where('name', $key)->count();
- if ($existingPermission == 0) {
- Permission::create(['name' => $key]);
- }
- array_push($addPermissions, $key);
- }
- }
- $role->syncPermissions($addPermissions);
+ $permissions = $request->permissions;
+ $addPermissions = [];
+ if ($permissions) {
+ foreach ($permissions as $key => $value) {
+ if ($value == "on") {
+ $existingPermission = Permission::where('name', $key)->count();
+ if ($existingPermission == 0) {
+ Permission::create(['name' => $key]);
}
-
- return redirect()->back()->with('success', ucfirst($this->handle_name) . ' has been updated');
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
+ array_push($addPermissions, $key);
+ }
}
+ $role->syncPermissions($addPermissions);
+ }
+
+ return redirect()->back()->with('success', ucfirst($this->handle_name) . ' has been updated');
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
+ }
+ }
+ public function ajax(Request $request) {
+ $edit_route = route('admin.' . $this->handle_name_plural . '.edit');
+ $current_page = $request->page_number;
+ if (isset($request->limit)) {
+ $limit = $request->limit;
+ } else {
+ $limit = 10;
+ }
+ $offset = (($current_page - 1) * $limit);
+ $modalObject = new Table();
+ if (isset($request->string)) {
+ $string = $request->string;
+ $modalObject = $modalObject->where('name', 'like', "%" . $request->string . "%");
+ // $modalObject = $modalObject->orWhere('name','like',"%".$request->string."%");
}
- public function ajax(Request $request) {
- $edit_route = route('admin.' . $this->handle_name_plural . '.edit');
- $current_page = $request->page_number;
- if (isset($request->limit)) {
- $limit = $request->limit;
- } else {
- $limit = 10;
- }
- $offset = (($current_page - 1) * $limit);
- $modalObject = new Table();
- if (isset($request->string)) {
- $string = $request->string;
- $modalObject = $modalObject->where('name', 'like', "%" . $request->string . "%");
- // $modalObject = $modalObject->orWhere('name','like',"%".$request->string."%");
- }
- $all_trashed = $request->all_trashed;
- if ($all_trashed == "trashed") {
- $modalObject = $modalObject->onlyTrashed();
- }
+ $all_trashed = $request->all_trashed;
+ if ($all_trashed == "trashed") {
+ $modalObject = $modalObject->onlyTrashed();
+ }
- $total_records = $modalObject->count();
- $modalObject = $modalObject->offset($offset);
- $modalObject = $modalObject->take($limit);
- $data = $modalObject->get();
+ $total_records = $modalObject->count();
+ $modalObject = $modalObject->offset($offset);
+ $modalObject = $modalObject->take($limit);
+ $data = $modalObject->get();
- if (isset($request->page_number) && $request->page_number != 1) {
- $page_number = $request->page_number + $limit - 1;
- } else {
- $page_number = 1;
- }
- $pagination = array(
- "offset" => $offset,
- "total_records" => $total_records,
- "item_per_page" => $limit,
- "total_pages" => ceil($total_records / $limit),
- "current_page" => $current_page,
- );
+ if (isset($request->page_number) && $request->page_number != 1) {
+ $page_number = $request->page_number + $limit - 1;
+ } else {
+ $page_number = 1;
+ }
+ $pagination = array(
+ "offset" => $offset,
+ "total_records" => $total_records,
+ "item_per_page" => $limit,
+ "total_pages" => ceil($total_records / $limit),
+ "current_page" => $current_page,
+ );
- return kview($this->handle_name_plural . '.ajax', compact('edit_route', 'data', 'page_number', 'limit', 'offset', 'pagination'));
+ return kview($this->handle_name_plural . '.ajax', compact('edit_route', 'data', 'page_number', 'limit', 'offset', 'pagination'));
+ }
+ public function delete(Request $request) {
+ if (isset($request->action)) {
+ $action = $request->action;
+ $is_bulk = $request->is_bulk;
+ $data_id = $request->data_id;
}
- public function delete(Request $request) {
- if (isset($request->action)) {
- $action = $request->action;
- $is_bulk = $request->is_bulk;
- $data_id = $request->data_id;
- }
- switch ($action) {
- case 'delete':
- try {
- if ($is_bulk == 1) {
- $data_id = explode(",", $data_id);
- $table = Table::whereIn('id', $data_id)->delete();
- return 1;
- } else {
- $table = Table::find($data_id);
- $data = $table->delete();
- return 1;
- }
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
- break;
- default:
- return 0;
+ switch ($action) {
+ case 'delete':
+ try {
+ if ($is_bulk == 1) {
+ $data_id = explode(",", $data_id);
+ $table = Table::whereIn('id', $data_id)->delete();
+ return 1;
+ } else {
+ $table = Table::find($data_id);
+ $data = $table->delete();
+ return 1;
+ }
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
}
+ break;
+ default:
+ return 0;
}
+ }
}
diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php
deleted file mode 100644
index 22dce38..0000000
--- a/app/Http/Controllers/SettingController.php
+++ /dev/null
@@ -1,63 +0,0 @@
-middleware('auth');
- }
-
- public function index() {
- $settings = getSettings();
- return kview('settings.general', [
- 'form_action' => route('admin.settings.update'),
- 'edit' => 1,
- 'settings' => $settings,
- ]);
- }
- public function edit_profile() {
- $user = Auth::user();
- $roles = Role::get();
- return kview('users.manage', [
- 'form_action' => route('admin.users.update'),
- 'edit' => 1,
- 'data' => $user,
- 'roles' => $roles,
- ]);
- }
-
- public function update(Request $request) {
- if (isset($request->SITE_NAME)) {
- $this->updateSetting('SITE_NAME', $request->SITE_NAME);
- }
- if (isset($request->site_url)) {
- $this->updateSetting('site_url', $request->site_url);
- }
- if (isset($request->tagline)) {
- $this->updateSetting('tagline', $request->tagline);
- }
- if (isset($request->theme)) {
- $this->updateSetting('theme', $request->theme);
- }
- return redirect()->back()->with('success', 'Settings has been updated');
- }
- public function updateSetting($key, $value) {
- $where = [
- 'key' => $key,
- ];
- $update_array = [
- 'value' => $value,
- ];
- Table::updateOrCreate($where, $update_array);
- }
-}
diff --git a/app/Http/Controllers/TestController.php b/app/Http/Controllers/TestController.php
index 7bdc515..7e8770d 100644
--- a/app/Http/Controllers/TestController.php
+++ b/app/Http/Controllers/TestController.php
@@ -4,12 +4,11 @@
use Illuminate\Http\Request;
-class TestController extends Controller
-{
- public function someFunction(){
- return 1;
- }
- public function test(){
- return $this->someFunction();
- }
+class TestController extends Controller {
+ public function someFunction() {
+ return 1;
+ }
+ public function test() {
+ return $this->someFunction();
+ }
}
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 47d1c51..cae8592 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -15,211 +15,214 @@
use Auth;
use Illuminate\Support\Facades\Hash;
-class UserController extends Controller
-{
- protected $handle_name = "user";
- protected $handle_name_plural = "users";
-
- public function index()
- {
- $all_count = Table::count();
- $trashed_count = Table::onlyTrashed()->count();
- return kview($this->handle_name_plural.'.index', [
- 'ajax_route' => route('admin.'.$this->handle_name_plural.'.ajax'),
- 'delete_route'=> route('admin.'.$this->handle_name_plural.'.delete'),
- 'create_route' => route('admin.'.$this->handle_name_plural.'.create'),
- 'table_status'=> 'all', //all , trashed
- 'all_count'=>$all_count,
- 'trashed_count'=>$trashed_count,
- ]);
+class UserController extends Controller {
+ protected $handle_name = "user";
+ protected $handle_name_plural = "users";
- }
- public function create()
- {
- $roles = Role::get();
- return kview($this->handle_name_plural.'.manage', [
- 'form_action' => route('admin.'.$this->handle_name_plural.'.store'),
- 'edit' => 0,
- 'roles'=>$roles,
- ]);
- }
- public function edit(Request $request)
- {
- $roles = Role::get();
- return kview($this->handle_name_plural.'.manage', [
- 'form_action' => route('admin.'.$this->handle_name_plural.'.update'),
- 'edit' => 1,
- 'data' => Table::where('id', '=', $request->id)->first(),
- 'roles'=>$roles,
- ]);
- }
- public function store(AddRequest $request)
- {
- try {
- if(isset($request->two_factor_enable) && $request->two_factor_enable=="on"){
- $two_factor_enable = 1;
- }else{
- $two_factor_enable = 0;
- }
+ public function index() {
+ $all_count = Table::count();
+ $trashed_count = Table::onlyTrashed()->count();
+ return kview($this->handle_name_plural . '.index', [
+ 'ajax_route' => route('admin.' . $this->handle_name_plural . '.ajax'),
+ 'delete_route' => route('admin.' . $this->handle_name_plural . '.delete'),
+ 'create_route' => route('admin.' . $this->handle_name_plural . '.create'),
+ 'table_status' => 'all', //all , trashed
+ 'all_count' => $all_count,
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ 'trashed_count' => $trashed_count,
+ ]);
+ }
+ public function create() {
+ $roles = Role::get();
+ return kview($this->handle_name_plural . '.manage', [
+ 'form_action' => route('admin.' . $this->handle_name_plural . '.store'),
+ 'edit' => 0,
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ 'roles' => $roles,
+ ]);
+ }
+ public function edit(Request $request) {
+ $roles = Role::get();
+ return kview($this->handle_name_plural . '.manage', [
+ 'form_action' => route('admin.' . $this->handle_name_plural . '.update'),
+ 'edit' => 1,
+ 'data' => Table::where('id', '=', $request->id)->first(),
+ 'module_names' => [
+ 'singular' => $this->handle_name,
+ 'plural' => $this->handle_name_plural,
+ ],
+ 'roles' => $roles,
+ ]);
+ }
+ public function store(AddRequest $request) {
+ try {
+ if (isset($request->two_factor_enable) && $request->two_factor_enable == "on") {
+ $two_factor_enable = 1;
+ } else {
+ $two_factor_enable = 0;
+ }
- $table = Table::create([
- 'name'=>$request->name,
- 'email'=>$request->email,
- 'password'=>bcrypt($request->password),
- 'two_factor_enable'=>$two_factor_enable
- ]);
+ $table = Table::create([
+ 'name' => $request->name,
+ 'email' => $request->email,
+ 'password' => bcrypt($request->password),
+ 'two_factor_enable' => $two_factor_enable
+ ]);
- if(isset($request->role)){
- $table->syncRoles($request->role);
- }
-
- return redirect()->to(route('admin.'.$this->handle_name_plural.'.index'))->with('success', 'New '.ucfirst($this->handle_name).' has been added.');
- } catch (Exception $e) {
- return $e->getMessage();
- return redirect()->back()->with('error', $e->getMessage());
- }
+ if (isset($request->role)) {
+ $table->syncRoles($request->role);
+ }
+
+ return redirect()->to(route('admin.' . $this->handle_name_plural . '.index'))->with('success', 'New ' . ucfirst($this->handle_name) . ' has been added.');
+ } catch (Exception $e) {
+ return $e->getMessage();
+ return redirect()->back()->with('error', $e->getMessage());
}
- public function update(UpdateRequest $request)
- {
- try {
- if(isset($request->two_factor_enable) && $request->two_factor_enable=="on"){
- $two_factor_enable = 1;
- }else{
- $two_factor_enable = 0;
- }
- $update_data = [
- 'name'=>$request->name,
- 'email'=>$request->email,
- 'two_factor_enable'=>$two_factor_enable,
- ];
+ }
+ public function update(UpdateRequest $request) {
+ try {
+ if (isset($request->two_factor_enable) && $request->two_factor_enable == "on") {
+ $two_factor_enable = 1;
+ } else {
+ $two_factor_enable = 0;
+ }
+ $update_data = [
+ 'name' => $request->name,
+ 'email' => $request->email,
+ 'two_factor_enable' => $two_factor_enable,
+ ];
- if(isset($request->old_password)){
- // $password= Hash::make($request->password);
- $userObj = Table::where([
- 'id'=>$request->id,
- ])->first();
- if (Hash::check($request->old_password, $userObj->password)) {
- $update_data['password'] = bcrypt($request->password);
- }else{
- return redirect()->back()->with('error', "Old password is incorrect.");
- }
- }
- $where = [
- 'id'=>$request->id
- ];
+ if (isset($request->old_password)) {
+ // $password= Hash::make($request->password);
+ $userObj = Table::where([
+ 'id' => $request->id,
+ ])->first();
+ if (Hash::check($request->old_password, $userObj->password)) {
+ $update_data['password'] = bcrypt($request->password);
+ } else {
+ return redirect()->back()->with('error', "Old password is incorrect.");
+ }
+ }
+ $where = [
+ 'id' => $request->id
+ ];
- $user = Table::updateOrCreate($where,$update_data);
- if(isset($request->role)){
- $user->syncRoles($request->role);
- }
+ $user = Table::updateOrCreate($where, $update_data);
+ if (isset($request->role)) {
+ $user->syncRoles($request->role);
+ }
- return redirect()->back()->with('success', ucfirst($this->handle_name).' has been updated');
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
+ return redirect()->back()->with('success', ucfirst($this->handle_name) . ' has been updated');
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
+ }
+ }
+ public function ajax(Request $request) {
+ $edit_route = route('admin.' . $this->handle_name_plural . '.edit');
+ $current_page = $request->page_number;
+ if (isset($request->limit)) {
+ $limit = $request->limit;
+ } else {
+ $limit = 10;
+ }
+ $offset = (($current_page - 1) * $limit);
+ $modalObject = new Table();
+ if (isset($request->string)) {
+ $string = $request->string;
+ $modalObject = $modalObject->where('name', 'like', "%" . $request->string . "%");
+ // $modalObject = $modalObject->orWhere('name','like',"%".$request->string."%");
}
- public function ajax(Request $request)
- {
- $edit_route = route('admin.'.$this->handle_name_plural.'.edit');
- $current_page = $request->page_number;
- if (isset($request->limit)) {
- $limit = $request->limit;
- } else {
- $limit = 10;
- }
- $offset = (($current_page - 1) * $limit);
- $modalObject = new Table();
- if (isset($request->string)) {
- $string = $request->string;
- $modalObject = $modalObject->where('name', 'like', "%" . $request->string . "%");
- // $modalObject = $modalObject->orWhere('name','like',"%".$request->string."%");
- }
-
- $all_trashed = $request->all_trashed;
- if($all_trashed=="trashed"){
- $modalObject = $modalObject->onlyTrashed();
- }
- $total_records = $modalObject->count();
- $modalObject = $modalObject->offset($offset);
- $modalObject = $modalObject->take($limit);
- $data = $modalObject->get();
-
- if (isset($request->page_number) && $request->page_number != 1) {
- $page_number = $request->page_number + $limit - 1;
- } else {
- $page_number = 1;
- }
- $pagination = array(
- "offset" => $offset,
- "total_records" => $total_records,
- "item_per_page" => $limit,
- "total_pages" => ceil($total_records / $limit),
- "current_page" => $current_page,
- );
+ $all_trashed = $request->all_trashed;
+ if ($all_trashed == "trashed") {
+ $modalObject = $modalObject->onlyTrashed();
+ }
+
+ $total_records = $modalObject->count();
+ $modalObject = $modalObject->offset($offset);
+ $modalObject = $modalObject->take($limit);
+ $data = $modalObject->get();
+
+ if (isset($request->page_number) && $request->page_number != 1) {
+ $page_number = $request->page_number + $limit - 1;
+ } else {
+ $page_number = 1;
+ }
+ $pagination = array(
+ "offset" => $offset,
+ "total_records" => $total_records,
+ "item_per_page" => $limit,
+ "total_pages" => ceil($total_records / $limit),
+ "current_page" => $current_page,
+ );
- return kview($this->handle_name_plural.'.ajax', compact('edit_route', 'data', 'page_number', 'limit', 'offset', 'pagination'));
+ return kview($this->handle_name_plural . '.ajax', compact('edit_route', 'data', 'page_number', 'limit', 'offset', 'pagination'));
+ }
+ public function delete(Request $request) {
+ if (isset($request->action)) {
+ $action = $request->action;
+ $is_bulk = $request->is_bulk;
+ $data_id = $request->data_id;
}
- public function delete(Request $request)
- {
- if(isset($request->action)){
- $action = $request->action;
- $is_bulk = $request->is_bulk;
- $data_id = $request->data_id;
+ switch ($action) {
+ case 'restore':
+ try {
+ if ($is_bulk == 1) {
+ $data_id = explode(",", $data_id);
+ $table = Table::onlyTrashed()->whereIn('id', $data_id);
+ $table->restore();
+ return 1;
+ } else {
+ $table = Table::onlyTrashed()->find($data_id);
+ $table->restore();
+ return 1;
+ }
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
}
- switch ($action){
- case 'restore':
- try{
- if($is_bulk==1){
- $data_id = explode(",",$data_id);
- $table = Table::onlyTrashed()->whereIn('id',$data_id);
- $table->restore();
- return 1;
- }else{
- $table = Table::onlyTrashed()->find($data_id);
- $table->restore();
- return 1;
- }
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
- break;
- case 'trash' :
- try{
- if($is_bulk==1){
- $data_id = explode(",",$data_id);
- $table = Table::whereIn('id',$data_id);
- $table->delete();
- return 1;
- }else{
- $table = Table::find($data_id);
- $table->delete();
- return 1;
- }
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
- break;
- case 'delete' :
- try{
- if($is_bulk==1){
- $data_id = explode(",",$data_id);
- $table = Table::withTrashed()->whereIn('id',$data_id)->get();
- foreach($table as $tbl){
- $tbl->forceDelete();
- }
- return 1;
- }else{
- $table = Table::withTrashed()->find($data_id);
- $data = $table->forceDelete();
- return 1;
- }
- } catch (Exception $e) {
- return redirect()->back()->with('error', $e->getMessage());
- }
- break;
- default :
- return 0;
+ break;
+ case 'trash':
+ try {
+ if ($is_bulk == 1) {
+ $data_id = explode(",", $data_id);
+ $table = Table::whereIn('id', $data_id);
+ $table->delete();
+ return 1;
+ } else {
+ $table = Table::find($data_id);
+ $table->delete();
+ return 1;
+ }
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
+ }
+ break;
+ case 'delete':
+ try {
+ if ($is_bulk == 1) {
+ $data_id = explode(",", $data_id);
+ $table = Table::withTrashed()->whereIn('id', $data_id)->get();
+ foreach ($table as $tbl) {
+ $tbl->forceDelete();
+ }
+ return 1;
+ } else {
+ $table = Table::withTrashed()->find($data_id);
+ $data = $table->forceDelete();
+ return 1;
+ }
+ } catch (Exception $e) {
+ return redirect()->back()->with('error', $e->getMessage());
}
+ break;
+ default:
+ return 0;
}
+ }
}
diff --git a/resources/views/backend/home.blade.php b/resources/views/backend/home.blade.php
index 2c9130c..f4f45fc 100644
--- a/resources/views/backend/home.blade.php
+++ b/resources/views/backend/home.blade.php
@@ -2,6 +2,7 @@
@section('content')
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if (session('status'))
diff --git a/resources/views/backend/layouts/partial/breadcrumb.blade.php b/resources/views/backend/layouts/partial/breadcrumb.blade.php
new file mode 100644
index 0000000..b026583
--- /dev/null
+++ b/resources/views/backend/layouts/partial/breadcrumb.blade.php
@@ -0,0 +1,22 @@
+@php
+$currentRoute = Request::route()->getName();
+$excluded = explode(".",$currentRoute);
+if (count($excluded) > 2 && isset($excluded[2])) {
+$page = $excluded[2];
+$page_name = "";
+if ($page == 'index') {
+$page_name = "List ".ucwords($module_names['plural']);
+} else if ($page == 'edit') {
+$page_name = "Edit ".ucwords($module_names['singular']);
+} else if ($page == 'create'){
+$page_name = "Add ".ucwords($module_names['singular']);
+} else {
+$page_name = "";
+}
+@endphp
+
+
{{ $page_name }}
+
+@php
+}
+@endphp
\ No newline at end of file
diff --git a/resources/views/backend/modules/index.blade.php b/resources/views/backend/modules/index.blade.php
index a8768af..e2a4c5f 100644
--- a/resources/views/backend/modules/index.blade.php
+++ b/resources/views/backend/modules/index.blade.php
@@ -5,6 +5,7 @@
?>
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if ($errors->any())
diff --git a/resources/views/backend/pages/index.blade.php b/resources/views/backend/pages/index.blade.php
index 3f29bae..14c909d 100644
--- a/resources/views/backend/pages/index.blade.php
+++ b/resources/views/backend/pages/index.blade.php
@@ -5,6 +5,7 @@
?>
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if ($errors->any())
diff --git a/resources/views/backend/pages/manage.blade.php b/resources/views/backend/pages/manage.blade.php
index e67fcc7..c5e95b3 100644
--- a/resources/views/backend/pages/manage.blade.php
+++ b/resources/views/backend/pages/manage.blade.php
@@ -2,6 +2,7 @@
@section('content')
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if ($errors->any())
diff --git a/resources/views/backend/roles/index.blade.php b/resources/views/backend/roles/index.blade.php
index 2d54263..34f61dc 100644
--- a/resources/views/backend/roles/index.blade.php
+++ b/resources/views/backend/roles/index.blade.php
@@ -5,6 +5,7 @@
?>
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if ($errors->any())
diff --git a/resources/views/backend/roles/manage.blade.php b/resources/views/backend/roles/manage.blade.php
index 679c783..8c00e2d 100644
--- a/resources/views/backend/roles/manage.blade.php
+++ b/resources/views/backend/roles/manage.blade.php
@@ -2,6 +2,7 @@
@section('content')
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if ($errors->any())
diff --git a/resources/views/backend/settings/general.blade.php b/resources/views/backend/settings/general.blade.php
index d3bf521..a5f43f0 100644
--- a/resources/views/backend/settings/general.blade.php
+++ b/resources/views/backend/settings/general.blade.php
@@ -2,6 +2,7 @@
@section('content')
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if ($errors->any())
diff --git a/resources/views/backend/settings/index.blade.php b/resources/views/backend/settings/index.blade.php
index 3f29bae..14c909d 100644
--- a/resources/views/backend/settings/index.blade.php
+++ b/resources/views/backend/settings/index.blade.php
@@ -5,6 +5,7 @@
?>
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if ($errors->any())
diff --git a/resources/views/backend/settings/manage.blade.php b/resources/views/backend/settings/manage.blade.php
index d3b97cf..898b6c5 100644
--- a/resources/views/backend/settings/manage.blade.php
+++ b/resources/views/backend/settings/manage.blade.php
@@ -2,6 +2,7 @@
@section('content')
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if ($errors->any())
diff --git a/resources/views/backend/users/index.blade.php b/resources/views/backend/users/index.blade.php
index 3f29bae..14c909d 100644
--- a/resources/views/backend/users/index.blade.php
+++ b/resources/views/backend/users/index.blade.php
@@ -5,6 +5,7 @@
?>
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if ($errors->any())
diff --git a/resources/views/backend/users/manage.blade.php b/resources/views/backend/users/manage.blade.php
index 3b10df2..0df23c0 100644
--- a/resources/views/backend/users/manage.blade.php
+++ b/resources/views/backend/users/manage.blade.php
@@ -2,6 +2,7 @@
@section('content')
+ @include($theme_name.'.layouts.partial.breadcrumb')
@if ($errors->any())
diff --git a/routes/web.php b/routes/web.php
index 7681405..03a842e 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -30,9 +30,6 @@
// Test Route
Route::get('/test', "TestController@test")->name('admin.test');
- // For Settings
- Route::get('/settings/edit_profile', "SettingController@edit_profile")->name('admin.settings.edit_profile');
-
// For Dashboard
Route::get('/dashboard', 'HomeController@index')->name('admin.dashboard');
@@ -76,6 +73,7 @@
Route::get('/settings', 'Admin\SettingController@index')->name('admin.settings.index');
Route::get('/settings/add', "Admin\SettingController@create")->name('admin.settings.create');
Route::get('/settings/edit', "Admin\SettingController@edit")->name('admin.settings.edit');
+ Route::get('/settings/edit_profile', "Admin\SettingController@edit_profile")->name('admin.settings.edit_profile');
Route::post('/settings/store', "Admin\SettingController@store")->name('admin.settings.store');
Route::post('/settings/update', "Admin\SettingController@update")->name('admin.settings.update');
Route::get('/settings/ajax', "Admin\SettingController@ajax")->name('admin.settings.ajax');