Commit dab13cf3 authored by Viral Solani's avatar Viral Solani Committed by GitHub

Merge pull request #10 from bvipul/vs_module_manager

Refactored the Module Manager Controller
parents 1d1e002b 42febb2d
......@@ -22,3 +22,5 @@ Todo.rtf
npm-debug.log
yarn-error.log
phpunit.txt
public/css
public/js
......@@ -45,7 +45,7 @@ class DummyRepoName extends BaseRepository
public function create(array $input)
{
$dummy_small_model_name = self::MODEL;
if ($dummy_small_model_name->save()) {
if ($dummy_small_model_name->save($input)) {
return true;
}
throw new GeneralException(trans('exceptions.backend.dummy_small_plural_model_name.create_error'));
......@@ -61,7 +61,7 @@ class DummyRepoName extends BaseRepository
*/
public function update(dummy_model_name $dummy_small_model_name, array $input)
{
if ($dummy_small_model_name->update())
if ($dummy_small_model_name->update($input))
return true;
throw new GeneralException(trans('exceptions.backend.dummy_small_plural_model_name.update_error'));
......
This diff is collapsed.
......@@ -42,29 +42,33 @@ class ModuleRepository extends BaseRepository
*
* @return bool
*/
public function create(array $input)
public function create(array $input, array $permissions)
{
$module = Module::where('name', $input['name'])->first();
if (!$module) {
$name = $input['model_name'];
$model = strtolower($name);
$permissions =
[
['name' => "view-$model-permission", 'display_name' => 'View '.ucwords($model).' Permission'],
['name' => "create-$model-permission", 'display_name' => 'Create '.ucwords($model).' Permission'],
['name' => "edit-$model-permission", 'display_name' => 'Edit '.ucwords($model).' Permission'],
['name' => "delete-$model-permission", 'display_name' => 'Delete '.ucwords($model).' Permission'],
];
// $permissions =
// [
// ['name' => "view-$model-permission", 'display_name' => 'View '.ucwords($model).' Permission'],
// ['name' => "create-$model-permission", 'display_name' => 'Create '.ucwords($model).' Permission'],
// ['name' => "edit-$model-permission", 'display_name' => 'Edit '.ucwords($model).' Permission'],
// ['name' => "delete-$model-permission", 'display_name' => 'Delete '.ucwords($model).' Permission'],
// ];
foreach ($permissions as $permission) {
$perm = [
'name' => $permission,
'display_name' => title_case( str_replace( '-', ' ', $permission ) ) . " Permission"
];
//Creating Permission
$per = Permission::firstOrCreate($permission);
$per = Permission::firstOrCreate($perm);
}
$mod = [
'view_permission_id' => "view-$model-permission",
'name' => $input['name'],
'url' => 'admin.'.str_plural($model).'.index',
'url' => 'admin.' . str_plural( $model ) . '.index',
'created_by' => access()->user()->id,
];
......
......@@ -81,11 +81,11 @@
dom: 'lBfrtip',
buttons: {
buttons: [
{ extend: 'copy', className: 'copyButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'csv', className: 'csvButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'excel', className: 'excelButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'pdf', className: 'pdfButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'print', className: 'printButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }}
{ extend: 'copy', className: 'copyButton', exportOptions: {columns: [ 0, 1, 2 ] }},
{ extend: 'csv', className: 'csvButton', exportOptions: {columns: [ 0, 1, 2 ] }},
{ extend: 'excel', className: 'excelButton', exportOptions: {columns: [ 0, 1, 2 ] }},
{ extend: 'pdf', className: 'pdfButton', exportOptions: {columns: [ 0, 1, 2 ] }},
{ extend: 'print', className: 'printButton', exportOptions: {columns: [ 0, 1, 2 ] }}
]
}
});
......
......@@ -178,6 +178,10 @@
$(document).on('blur', "input[name=table_name]", function(e){
checkTableExists($(this));
});
//Events Change Event
$(document).on('change', "input[name='event[]']", function(e){
getFilesGenerated();
});
});
function checkModelExists(model) {
......
@extends ('backend.layouts.app')
@section ('title', '')
@section('after-styles')
{{-- {{ Html::style("css/backend/plugin/datatables/dataTables.bootstrap.min.css") }} --}}
@endsection
@section('page-header')
<h1></h1>
@endsection
@section('content')
@endsection
@section('after-scripts')
@endsection
\ No newline at end of file
@extends ('backend.layouts.app')
@section ('title', '')
@section('after-styles')
{{-- {{ Html::style("css/backend/plugin/datatables/dataTables.bootstrap.min.css") }} --}}
@endsection
@section('page-header')
<h1></h1>
@endsection
@section('content')
@endsection
@section('after-scripts')
@endsection
\ No newline at end of file
@extends ('backend.layouts.app')
@section ('title', '')
@section('after-styles')
{{-- {{ Html::style("css/backend/plugin/datatables/dataTables.bootstrap.min.css") }} --}}
@endsection
@section('page-header')
<h1></h1>
@endsection
@section('content')
@endsection
@section('after-scripts')
@endsection
\ No newline at end of file
@extends ('backend.layouts.app')
@section ('title', '')
@section('after-styles')
{{-- {{ Html::style("css/backend/plugin/datatables/dataTables.bootstrap.min.css") }} --}}
@endsection
@section('page-header')
<h1></h1>
@endsection
@section('content')
@endsection
@section('after-scripts')
@endsection
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment