From 50df646636d00d526be6c42db2aeb4c794496aa9 Mon Sep 17 00:00:00 2001 From: ConsoleTVs <ConsoleTVs@gmail.com> Date: Sun, 19 Jun 2016 21:35:42 +0200 Subject: [PATCH] Added Developer Mode --- .../Controllers/Admin/Data/Create/DevGet.php | 164 +++++ .../Controllers/Admin/Data/Create/DevSave.php | 86 +++ .../Controllers/Admin/Data/Create/Get.php | 4 +- .../Admin/Data/Create/SimpleGet.php | 8 +- app/Http/Controllers/Admin/Data/Data.php | 2 + app/Http/Controllers/Admin/Data/DevData.php | 89 +++ .../Controllers/Admin/Data/Edit/DevGet.php | 168 +++++ .../Controllers/Admin/Data/Edit/DevSave.php | 86 +++ app/Http/Controllers/Admin/Data/Edit/Get.php | 3 +- .../Controllers/Admin/Data/Edit/SimpleGet.php | 1 + .../Controllers/Admin/DeveloperController.php | 233 ++++++ app/Http/Controllers/Auth/AuthController.php | 3 +- app/Http/routes.php | 14 + composer.lock | 681 ++++++++++++++---- ...016_02_10_150405_Create_Users_Settings.php | 5 +- ...6_02_10_151500_Create_Permission_Types.php | 5 + .../2016_02_10_152932_Create_Permissions.php | 8 + .../admin/blogs/posts/graphics.blade.php | 6 +- .../views/admin/developer/create.blade.php | 37 + .../views/admin/developer/index.blade.php | 41 ++ resources/views/admin/developer/row.blade.php | 37 + .../views/admin/developer/table.blade.php | 86 +++ resources/views/admin/forms/master.blade.php | 5 +- resources/views/auth/register.blade.php | 24 - resources/views/layouts/admin/index.blade.php | 1 + 25 files changed, 1616 insertions(+), 181 deletions(-) create mode 100644 app/Http/Controllers/Admin/Data/Create/DevGet.php create mode 100644 app/Http/Controllers/Admin/Data/Create/DevSave.php create mode 100644 app/Http/Controllers/Admin/Data/DevData.php create mode 100644 app/Http/Controllers/Admin/Data/Edit/DevGet.php create mode 100644 app/Http/Controllers/Admin/Data/Edit/DevSave.php create mode 100644 app/Http/Controllers/Admin/DeveloperController.php create mode 100644 resources/views/admin/developer/create.blade.php create mode 100644 resources/views/admin/developer/index.blade.php create mode 100644 resources/views/admin/developer/row.blade.php create mode 100644 resources/views/admin/developer/table.blade.php diff --git a/app/Http/Controllers/Admin/Data/Create/DevGet.php b/app/Http/Controllers/Admin/Data/Create/DevGet.php new file mode 100644 index 0000000..589eb31 --- /dev/null +++ b/app/Http/Controllers/Admin/Data/Create/DevGet.php @@ -0,0 +1,164 @@ +<?php + +/* ++---------------------------------------------------------------------------+ +| Laralum Developer Data Fetcher | ++---------------------------------------------------------------------------+ +| | +| * Requires: | +| | +| $row - The row information | +| | +| * Available variables: | +| | +| $data - The table settings | +| $table - The table name +-------------+ +| $hidden: Columns that will not be displayed in the edit form, and they won't be updated +----------------------------+ +| $empty: Columns that will not have their current value when editing them (eg: password field is hidden in the model) | +| $confirmed: fields that will need to be confirmed twice +-+ +| $encrypted: Fields that will be encrypted using: Crypt::encrypt(); when they are saved and decrypted when editing them +---------------------------+ +| $hashed: Fields that will be hashed when they are saved in the database, will be empty on editing, and if saved as empty they will not be modified | +| $masked: Fields that will be displayed as a type='password', so their content when beeing modified won't be visible +------------------------------+ +| $default_random: Fields that if no data is set, they will be randomly generated (10 characters) +-------------------+ +| $su_hidden: Columns that will be added to the hidden array if the user is su +------------------+ +| $columns: the row columns +--+ +| $fields: get the available fields | +| | ++---------------------------------------------------------------------------+ +| | +| This file creates the variables nessesary to make | +| the dynamic field edition avialable to all the controllers | +| regardless of it's differences. | +| | ++---------------------------------------------------------------------------+ +*/ + +require('../app/Http/Controllers/Admin/Data/DevData.php'); + + + + +if(array_key_exists($name, $data)) { + $data = $data[$name]; + if(!array_key_exists('create', $data)){ + $data['create'] = []; + } + if(!array_key_exists('edit', $data)){ + $data['edit'] = []; + } +} else { + $data = ['create' => [], 'edit' => []]; +} + + + + +# Get the table data +$table = $name; + + + +if(array_key_exists('allow', $data['create'])) { + $allow = $data['create']['allow']; +} else { + $allow = true; +} + +$su_hidden = []; +$empty = []; + +if(array_key_exists('hidden', $data['create'])) { + $hidden = $data['create']['hidden']; +} else { + $hidden = []; +} + +if(array_key_exists('default_random', $data['create'])) { + $default_random = $data['create']['default_random']; +} else { + $default_random = []; +} + +if(array_key_exists('confirmed', $data['create'])) { + $confirmed = $data['create']['confirmed']; +} else { + $confirmed = []; +} + +if(array_key_exists('encrypted', $data['create'])) { + $encrypted = $data['create']['encrypted']; +} else { + $encrypted = []; +} + +if(array_key_exists('hashed', $data['create'])) { + $hashed = $data['create']['hashed']; +} else { + $hashed = []; +} + +if(array_key_exists('masked', $data['create'])) { + $masked = $data['create']['masked']; +} else { + $masked = []; +} + +if(array_key_exists('validator', $data['create'])) { + $validator = $data['create']['validator']; +} else { + $validator = []; +} + +if(array_key_exists('code', $data['edit'])) { + $code = $data['edit']['code']; +} else { + $code = []; +} + +if(array_key_exists('wysiwyg', $data['create'])) { + $wysiwyg = $data['create']['wysiwyg']; +} else { + $wysiwyg = []; +} + + + + + + + + + + + + + + + + + +# Get the row table columns +$columns = Schema::getColumnListing($table); + +# Add su_hidden to hidden if the row is su +if(Schema::hasColumn($table, 'su') and $row->su) { + # Add the su_hidden fields to the hiden variable + foreach($su_hidden as $su_hid) { + array_push($hidden, $su_hid); + } +} + +# Gets the fields available to edit / update +$final_columns = []; +foreach($columns as $column) { + $add = true; + foreach($hidden as $hide) { + if($column == $hide) { + $add = false; + } + } + if($add) { + array_push($final_columns, $column); + } +} +$fields = $final_columns; diff --git a/app/Http/Controllers/Admin/Data/Create/DevSave.php b/app/Http/Controllers/Admin/Data/Create/DevSave.php new file mode 100644 index 0000000..f70f7f7 --- /dev/null +++ b/app/Http/Controllers/Admin/Data/Create/DevSave.php @@ -0,0 +1,86 @@ +<?php + +/* ++---------------------------------------------------------------------------+ +| Laralum Data Saver | ++---------------------------------------------------------------------------+ +| | +| * Requires: | +| | +| $row - The row information | +| $request - The form requrest information | +| | ++---------------------------------------------------------------------------+ +| | +| This files saves the new information to the database | | +| | ++---------------------------------------------------------------------------+ +*/ + +include('DevGet.php'); + +# Validate The Request +$this->validate($request, $validator); + +# Update the row +foreach($fields as $field) { + + $save = true; + + # Check the field type + $type = Schema::getColumnType($table, $field); + + # Get the value + $value = $request->input($field); + + if($type == 'string' or $type == 'integer') { + + # Check if it's a default_random field + foreach($default_random as $random) { + if($random == $field) { + if(!$value) { + $value = str_random(10); + } + } + } + + # Check if it's a hashed field + foreach($hashed as $hash) { + if($hash == $field) { + if($value) { + $value = Hash::make($value); + } else { + $save = false; + } + } + } + + # Check if it's an encrypted field + foreach($encrypted as $encrypt) { + if($encrypt == $field) { + $value = Crypt::encrypt($value); + } + } + + # Save it + if($save) { + $update[$field] = $value; + } + + } elseif($type == 'boolean') { + + # Save it + if($value) { + $update[$field] = true; + } else { + $update[$field] = false; + } + + } else { + # Save it + $update[$field] = $value; + } +} + +# Save the row +DB::table($name)->insert($update); diff --git a/app/Http/Controllers/Admin/Data/Create/Get.php b/app/Http/Controllers/Admin/Data/Create/Get.php index 0128585..ec2b354 100644 --- a/app/Http/Controllers/Admin/Data/Create/Get.php +++ b/app/Http/Controllers/Admin/Data/Create/Get.php @@ -8,6 +8,7 @@ | * Requires: | | | | $row - The row information | +| $data_index - The Data array index for the table configuration | | | | * Available variables: | | | @@ -20,8 +21,7 @@ | $hashed: Fields that will be hashed when they are saved in the database, will be empty on editing, and if saved as empty they will not be modified | | $masked: Fields that will be displayed as a type='password', so their content when beeing modified won't be visible +------------------------------+ | $default_random: Fields that if no data is set, they will be randomly generated (10 characters) +-------------------+ -| $su_hidden: Columns that will be added to the hidden array if the user is su +------------------+ -| $columns: the row columns +--+ +| $columns: the row columns +---------------------+ | $fields: get the available fields | | | +---------------------------------------------------------------------------+ diff --git a/app/Http/Controllers/Admin/Data/Create/SimpleGet.php b/app/Http/Controllers/Admin/Data/Create/SimpleGet.php index 8b0b066..9523c28 100644 --- a/app/Http/Controllers/Admin/Data/Create/SimpleGet.php +++ b/app/Http/Controllers/Admin/Data/Create/SimpleGet.php @@ -5,6 +5,11 @@ | Laralum Simple Data Fetcher | +---------------------------------------------------------------------------+ | | +| * Requires: | +| | +| $row - The row information | +| $data_index - The Data array index for the table configuration | +| | | * Available variables: | | | | $data - The table settings | @@ -15,8 +20,7 @@ | $hashed: Fields that will be hashed when they are saved in the database, will be empty on editing, and if saved as empty they will not be modified | | $masked: Fields that will be displayed as a type='password', so their content when beeing modified won't be visible +------------------------------+ | $default_random: Fields that if no data is set, they will be randomly generated (10 characters) +-------------------+ -| $su_hidden: Columns that will be added to the hidden array if the user is su +------------------+ -| +--+ +| +---------------------+ +---------------------------------------------------------------------------+ | | | This file creates the variables nessesary to make | diff --git a/app/Http/Controllers/Admin/Data/Data.php b/app/Http/Controllers/Admin/Data/Data.php index b3922f5..b82ffa9 100644 --- a/app/Http/Controllers/Admin/Data/Data.php +++ b/app/Http/Controllers/Admin/Data/Data.php @@ -20,6 +20,8 @@ | wysiwyg: Fields that can be edited using a wysiwyg editor | | validator: validator settings when executing: $this->validate(); | | | +| Note: Do not change the first index | +| | +---------------------------------------------------------------------------+ | | | This file allows you to setup all the information | diff --git a/app/Http/Controllers/Admin/Data/DevData.php b/app/Http/Controllers/Admin/Data/DevData.php new file mode 100644 index 0000000..08a6b4e --- /dev/null +++ b/app/Http/Controllers/Admin/Data/DevData.php @@ -0,0 +1,89 @@ + +<?php +/* ++---------------------------------------------------------------------------+ +| Laralum Developer Data Configuration | ++---------------------------------------------------------------------------+ +| | +| * Available settings: | +| | +| hide_display: Hides the field when the table is displayed | +| table: The table name +-------------+ +| hidden: Columns that will not be displayed in the edit form, and they won't be updated +----------------------------+ +| empty: Columns that will not have their current value when editing them (eg: password field is hidden in the model) | +| confirmed: fields that will need to be confirmed twice +-+ +| encrypted: Fields that will be encrypted using: Crypt::encrypt(); when they are saved and decrypted when editing them +---------------------------+ +| hashed: Fields that will be hashed when they are saved in the database, will be empty on editing, and if saved as empty they will not be modified | +| masked: Fields that will be displayed as a type='password', so their content when beeing modified won't be visible +------------------------------+ +| default_random: Fields that if no data is set, they will be randomly generated (10 characters) +-------------------+ +| su_hidden: Columns that will be added to the hidden array if the user is su +------------------+ +| code: Fields that can be edited using a code editor +-+ +| wysiwyg: Fields that can be edited using a wysiwyg editor | +| validator: validator settings when executing: $this->validate(); | +| allow: allows to create/edit the row | +| delete: allows to delete the row | +| | +| Note: The first index indicates the table name | +| | ++---------------------------------------------------------------------------+ +| | +| This file allows you to setup all the information | +| to be able to manage your app without problems | +| | ++---------------------------------------------------------------------------+ +*/ + +if(!isset($row)){ + # the row will be the user logged in if no row is set + $row = Auth::user(); +} + +$data = [ + + + 'users' => [ + + 'hide_display' => ['password'], + 'delete' => false, + 'create' => [ + 'allowed' => true, + 'hidden' => ['id', 'su', 'active', 'banned', 'register_ip', 'activation_key', 'remember_token', 'created_at', 'updated_at'], + 'default_random' => ['password'], + 'confirmed' => ['password'], + 'encrypted' => [], + 'hashed' => ['password'], + 'masked' => ['password'], + 'code' => [], + 'wysiwyg' => [], + 'validator' => [ + 'name' => 'required|max:255', + 'email' => 'required|email|unique:users', + 'password' => 'confirmed|min:6', + 'country_code' => 'required', + ], + ], + 'edit' => [ + 'hidden' => ['id', 'su', 'email', 'register_ip', 'activation_key', 'remember_token', 'created_at', 'updated_at'], + 'su_hidden' => ['name', 'active', 'banned', 'password', 'country_code'], + 'empty' => ['password'], + 'default_random' => [], + 'confirmed' => ['password'], + 'encrypted' => [], + 'hashed' => ['password'], + 'masked' => ['password'], + 'code' => [], + 'wysiwyg' => [], + 'validator' => [ + 'name' => 'sometimes|required|max:255', + 'password' => 'sometimes|confirmed|min:6', + 'country_code' => 'sometimes|required', + ], + ], + ], + + 'settings' => [ + 'create' => [ + 'allow' => false, + ], + ] +]; diff --git a/app/Http/Controllers/Admin/Data/Edit/DevGet.php b/app/Http/Controllers/Admin/Data/Edit/DevGet.php new file mode 100644 index 0000000..a8991ed --- /dev/null +++ b/app/Http/Controllers/Admin/Data/Edit/DevGet.php @@ -0,0 +1,168 @@ +<?php + +/* ++---------------------------------------------------------------------------+ +| Laralum Developer Data Fetcher | ++---------------------------------------------------------------------------+ +| | +| * Requires: | +| | +| $row - The row information | +| | +| * Available variables: | +| | +| $data - The table settings | +| $table - The table name +-------------+ +| $hidden: Columns that will not be displayed in the edit form, and they won't be updated +----------------------------+ +| $empty: Columns that will not have their current value when editing them (eg: password field is hidden in the model) | +| $confirmed: fields that will need to be confirmed twice +-+ +| $encrypted: Fields that will be encrypted using: Crypt::encrypt(); when they are saved and decrypted when editing them +---------------------------+ +| $hashed: Fields that will be hashed when they are saved in the database, will be empty on editing, and if saved as empty they will not be modified | +| $masked: Fields that will be displayed as a type='password', so their content when beeing modified won't be visible +------------------------------+ +| $default_random: Fields that if no data is set, they will be randomly generated (10 characters) +-------------------+ +| $su_hidden: Columns that will be added to the hidden array if the user is su +------------------+ +| $columns: the row columns +--+ +| $fields: get the available fields | +| | ++---------------------------------------------------------------------------+ +| | +| This file creates the variables nessesary to make | +| the dynamic field edition avialable to all the controllers | +| regardless of it's differences. | +| | ++---------------------------------------------------------------------------+ +*/ + +require('../app/Http/Controllers/Admin/Data/DevData.php'); + + +if(array_key_exists($name, $data)) { + $data = $data[$name]; + if(!array_key_exists('create', $data)){ + $data['create'] = []; + } + if(!array_key_exists('edit', $data)){ + $data['edit'] = []; + } +} else { + $data = ['create' => [], 'edit' => []]; +} + + + + +# Get the table data +$table = $name; + +if(array_key_exists('allow', $data['edit'])) { + $allow = $data['edit']['allow']; +} else { + $allow = true; +} + +if(array_key_exists('hidden', $data['edit'])) { + $hidden = $data['edit']['hidden']; +} else { + $hidden = []; +} + +if(array_key_exists('empty', $data['edit'])) { + $empty = $data['edit']['empty']; +} else { + $empty = []; +} + +if(array_key_exists('default_random', $data['edit'])) { + $default_random = $data['edit']['default_random']; +} else { + $default_random = []; +} + +if(array_key_exists('confirmed', $data['edit'])) { + $confirmed = $data['edit']['confirmed']; +} else { + $confirmed = []; +} + +if(array_key_exists('encrypted', $data['edit'])) { + $encrypted = $data['edit']['encrypted']; +} else { + $encrypted = []; +} + +if(array_key_exists('hashed', $data['edit'])) { + $hashed = $data['edit']['hashed']; +} else { + $hashed = []; +} + +if(array_key_exists('masked', $data['edit'])) { + $masked = $data['edit']['masked']; +} else { + $masked = []; +} + +if(array_key_exists('validator', $data['edit'])) { + $validator = $data['edit']['validator']; +} else { + $validator = []; +} + +if(array_key_exists('su_hidden', $data['edit'])) { + $su_hidden = $data['edit']['su_hidden']; +} else { + $su_hidden = []; +} + +if(array_key_exists('code', $data['edit'])) { + $code = $data['edit']['code']; +} else { + $code = []; +} + +if(array_key_exists('wysiwyg', $data['edit'])) { + $wysiwyg = $data['edit']['wysiwyg']; +} else { + $wysiwyg = []; +} + + + + + + + + + + + + + + + + +# Get the row table columns +$columns = Schema::getColumnListing($table); + +# Add su_hidden to hidden if the row is su +if(Schema::hasColumn($table, 'su') and $row->su) { + # Add the su_hidden fields to the hiden variable + foreach($su_hidden as $su_hid) { + array_push($hidden, $su_hid); + } +} + +# Gets the fields available to edit / update +$final_columns = []; +foreach($columns as $column) { + $add = true; + foreach($hidden as $hide) { + if($column == $hide) { + $add = false; + } + } + if($add) { + array_push($final_columns, $column); + } +} +$fields = $final_columns; diff --git a/app/Http/Controllers/Admin/Data/Edit/DevSave.php b/app/Http/Controllers/Admin/Data/Edit/DevSave.php new file mode 100644 index 0000000..d4d0f1d --- /dev/null +++ b/app/Http/Controllers/Admin/Data/Edit/DevSave.php @@ -0,0 +1,86 @@ +<?php + +/* ++---------------------------------------------------------------------------+ +| Laralum Data Saver | ++---------------------------------------------------------------------------+ +| | +| * Requires: | +| | +| $row - The row information | +| $request - The form requrest information | +| | ++---------------------------------------------------------------------------+ +| | +| This files saves the new information to the database | | +| | ++---------------------------------------------------------------------------+ +*/ + +include('DevGet.php'); + +# Validate The Request +$this->validate($request, $validator); + +# Update the row +foreach($fields as $field) { + + $save = true; + + # Check the field type + $type = Schema::getColumnType($table, $field); + + # Get the value + $value = $request->input($field); + + if($type == 'string' or $type == 'integer') { + + # Check if it's a default_random field + foreach($default_random as $random) { + if($random == $field) { + if(!$value) { + $value = str_random(10); + } + } + } + + # Check if it's a hashed field + foreach($hashed as $hash) { + if($hash == $field) { + if($value) { + $value = Hash::make($value); + } else { + $save = false; + } + } + } + + # Check if it's an encrypted field + foreach($encrypted as $encrypt) { + if($encrypt == $field) { + $value = Crypt::encrypt($value); + } + } + + # Save it + if($save) { + $update[$field] = $value; + } + + } elseif($type == 'boolean') { + + # Save it + if($value) { + $update[$field] = true; + } else { + $update[$field] = false; + } + + } else { + # Save it + $update[$field] = $value; + } +} + +# Save the row +DB::table($name)->where('id', $id)->update($update); diff --git a/app/Http/Controllers/Admin/Data/Edit/Get.php b/app/Http/Controllers/Admin/Data/Edit/Get.php index a9f896a..07da4d6 100644 --- a/app/Http/Controllers/Admin/Data/Edit/Get.php +++ b/app/Http/Controllers/Admin/Data/Edit/Get.php @@ -8,6 +8,7 @@ | * Requires: | | | | $row - The row information | +| $data_index - The Data array index for the table configuration | | | | * Available variables: | | | @@ -39,7 +40,7 @@ $columns = Schema::getColumnListing($table); # Add su_hidden to hidden if the row is su -if($row->su) { +if(Schema::hasColumn($table, 'su') and $row->su) { # Add the su_hidden fields to the hiden variable foreach($su_hidden as $su_hid) { array_push($hidden, $su_hid); diff --git a/app/Http/Controllers/Admin/Data/Edit/SimpleGet.php b/app/Http/Controllers/Admin/Data/Edit/SimpleGet.php index f5ec804..706bff0 100644 --- a/app/Http/Controllers/Admin/Data/Edit/SimpleGet.php +++ b/app/Http/Controllers/Admin/Data/Edit/SimpleGet.php @@ -8,6 +8,7 @@ | * Requires: | | | | $row - The row information | +| $data_index - The Data array index for the table configuration | | | | * Available variables: | | | diff --git a/app/Http/Controllers/Admin/DeveloperController.php b/app/Http/Controllers/Admin/DeveloperController.php new file mode 100644 index 0000000..6b55b9a --- /dev/null +++ b/app/Http/Controllers/Admin/DeveloperController.php @@ -0,0 +1,233 @@ +<?php + +namespace App\Http\Controllers\Admin; + +use Illuminate\Http\Request; + +use App\Http\Requests; +use App\Http\Controllers\Controller; +use DB; +use Schema; +use Auth; + +class DeveloperController extends Controller +{ + public function __construct() + { + # Check permissions + if(!Auth::user()->has('admin.developer.access')) { + return redirect('/admin')->with('warning', "You are not allowed to perform this action")->send(); + } + } + + public function index() + { + # Get all the tables + $table_list = []; + $tables = DB::select('SHOW TABLES'); + foreach ($tables as $table){ + foreach ($table as $key => $value){ + array_push($table_list, $value); + } + } + return view('admin/developer/index', ['tables' => $table_list]); + } + + public function table($name) + { + # Check if table exists + if(!Schema::hasTable($name)) { + abort(404); + } + $columns = Schema::getColumnListing($name); + $rows = DB::table($name)->get(); + return view('admin/developer/table', ['columns' => $columns, 'rows' => $rows, 'name' => $name]); + } + + public function dump($name, $id) + { + # Check if table exists + if(!Schema::hasTable($name)) { + abort(404); + } + + # Check if column exists + if(!Schema::hasColumn($name, 'id')) { + abort(404); + } + + # Check if row exists + if(!DB::table($name)->where('id', $id)->get()) { + abort(404); + } + return dd(DB::table($name)->where('id', $id)->get()); + } + + public function row($name, $id) + { + # Check if you're allowed to edit rows + require('Data/Edit/DevGet.php'); + if(!$allow) { + abort(404); + } + + # Check if table exists + if(!Schema::hasTable($name)) { + abort(404); + } + + # Check if column exists + if(!Schema::hasColumn($name, 'id')) { + abort(404); + } + + # Check if row exists + if(!DB::table($name)->where('id', $id)->get()) { + abort(404); + } + + $row = DB::table($name)->where('id', $id)->first(); + + # Get all the data + require('Data/Edit/DevGet.php'); + + return view('admin/developer/row', [ + 'row' => $row, + 'name' => $name, + 'fields' => $fields, + 'confirmed' => $confirmed, + 'empty' => $empty, + 'encrypted' => $encrypted, + 'hashed' => $hashed, + 'masked' => $masked, + 'table' => $table, + 'code' => $code, + 'wysiwyg' => $wysiwyg, + ]); + } + + public function saveRow($name, $id, Request $request) + { + # Check if you're allowed to edit rows + require('Data/Edit/DevGet.php'); + if(!$allow) { + abort(404); + } + + # Check if table exists + if(!Schema::hasTable($name)) { + abort(404); + } + + # Check if column exists + if(!Schema::hasColumn($name, 'id')) { + abort(404); + } + + # Check if row exists + if(!DB::table($name)->where('id', $id)->get()) { + abort(404); + } + + $row = DB::table($name)->where('id', $id)->first(); + + # Save all the data + require('Data/Edit/DevSave.php'); + + return redirect(url('admin/developer', [$name]))->with('success', "The row #$id has been saved!"); + } + + public function createRow($name, Request $request) + { + # Check if you're allowed to create rows + require('Data/Create/DevGet.php'); + if(!$allow) { + abort(404); + } + + # Check if table exists + if(!Schema::hasTable($name)) { + abort(404); + } + + # Check if column exists + if(!Schema::hasColumn($name, 'id')) { + abort(404); + } + + # Get all the data + require('Data/Create/DevSave.php'); + + return redirect(url('admin/developer', [$name]))->with('success', "The row has been created"); + } + + public function create($name) + { + # Check if you're allowed to create rows + require('Data/Create/DevGet.php'); + if(!$allow) { + abort(404); + } + + # Check if table exists + if(!Schema::hasTable($name)) { + abort(404); + } + + # Check if column exists + if(!Schema::hasColumn($name, 'id')) { + abort(404); + } + + # Get all the data + require('Data/Create/DevGet.php'); + + return view('admin/developer/create', [ + 'name' => $name, + 'fields' => $fields, + 'confirmed' => $confirmed, + 'empty' => $empty, + 'encrypted' => $encrypted, + 'hashed' => $hashed, + 'masked' => $masked, + 'table' => $table, + 'code' => $code, + 'wysiwyg' => $wysiwyg, + ]); + } + + public function deleteRow($name, $id) + { + + # Check if table exists + if(!Schema::hasTable($name)) { + abort(404); + } + + # Check if column exists + if(!Schema::hasColumn($name, 'id')) { + abort(404); + } + + # Check if you're allowed to delete rows + require('Data/DevData.php'); + if(array_key_exists($name, $data)){ + if(array_key_exists('delete', $data[$name])) { + if(!$data[$name]['delete']){ + abort(404); + } + } + } + + $row = DB::table($name)->where('id', $id)->first(); + + # Check if su + if($row->su){ + return redirect(url('admin/developer', [$name]))->with('info', "You're not allowed to delete this row"); + } + + DB::table($name)->where('id', $id)->delete(); + + return redirect(url('admin/developer', [$name]))->with("success", "The row has been deleted"); + } +} diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 1ec6aa8..99b0f48 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -11,6 +11,7 @@ use Request; use Mail; use App\Users_Settings; +use Location; class AuthController extends Controller { @@ -115,7 +116,7 @@ protected function create(array $data) 'password' => bcrypt($data['password']), 'active' => $active, 'activation_key' => $activation_key, - 'country_code' => $data['country_code'], + 'country_code' => Location::get($register_ip)->countryCode, 'register_ip' => $register_ip, ]); diff --git a/app/Http/routes.php b/app/Http/routes.php index 45aaea1..9c09d48 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -192,4 +192,18 @@ Route::get('/posts/{id}/delete', 'SecurityController@confirm'); Route::post('/posts/{id}/delete', 'PostsController@destroy'); + # Developer Mode + Route::get('/developer', 'DeveloperController@index'); + + Route::get('/developer/{table}', 'DeveloperController@table'); + + Route::get('/developer/{table}/create', 'DeveloperController@create'); + Route::post('/developer/{table}/create', 'DeveloperController@createRow'); + + Route::get('/developer/{table}/{id}', 'DeveloperController@row'); + Route::post('/developer/{table}/{id}', 'DeveloperController@saveRow'); + + Route::get('/developer/{table}/{id}/delete', 'SecurityController@confirm'); + Route::post('/developer/{table}/{id}/delete', 'DeveloperController@deleteRow'); + }); diff --git a/composer.lock b/composer.lock index 56a55f8..0f08076 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "3a1d002b57b2e73b8888bc990ec10a57", - "content-hash": "4e7495ef43ef59ea0e38c166c3ab193a", + "hash": "8fe8652cc6dcf35e59b32ab30b3efff2", + "content-hash": "c166c3ed36156fc97a57c158ed7543b4", "packages": [ { "name": "classpreloader/classpreloader", @@ -563,18 +563,70 @@ ], "time": "2014-09-09 13:34:57" }, + { + "name": "geoip2/geoip2", + "version": "v2.1.1", + "source": { + "type": "git", + "url": "https://github.com/maxmind/GeoIP2-php.git", + "reference": "01f58d749b715f30c99d1b19a965ce5b93813656" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/01f58d749b715f30c99d1b19a965ce5b93813656", + "reference": "01f58d749b715f30c99d1b19a965ce5b93813656", + "shasum": "" + }, + "require": { + "guzzle/guzzle": "3.*", + "maxmind-db/reader": "~1.0", + "php": ">=5.3.1" + }, + "require-dev": { + "phpunit/phpunit": "4.2.*", + "satooshi/php-coveralls": "dev-master" + }, + "type": "library", + "autoload": { + "psr-0": { + "GeoIp2": "src/", + "JsonSerializable": "compat/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Gregory J. Oschwald", + "email": "goschwald@maxmind.com", + "homepage": "http://www.maxmind.com/" + } + ], + "description": "MaxMind GeoIP2 PHP API", + "homepage": "https://github.com/maxmind/GeoIP2-php", + "keywords": [ + "IP", + "geoip", + "geoip2", + "geolocation", + "maxmind" + ], + "time": "2014-12-03 14:59:16" + }, { "name": "graham-campbell/exceptions", - "version": "v8.4.0", + "version": "v8.6.1", "source": { "type": "git", "url": "https://github.com/GrahamCampbell/Laravel-Exceptions.git", - "reference": "91eacead72ec6c02bb231e3ed401bc228271fa74" + "reference": "40e6208cff22859cd63788fee19a8c15aebc1ef9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Laravel-Exceptions/zipball/91eacead72ec6c02bb231e3ed401bc228271fa74", - "reference": "91eacead72ec6c02bb231e3ed401bc228271fa74", + "url": "https://api.github.com/repos/GrahamCampbell/Laravel-Exceptions/zipball/40e6208cff22859cd63788fee19a8c15aebc1ef9", + "reference": "40e6208cff22859cd63788fee19a8c15aebc1ef9", "shasum": "" }, "require": { @@ -598,7 +650,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.4-dev" + "dev-master": "8.6-dev" } }, "autoload": { @@ -630,7 +682,99 @@ "laravel", "whoops" ], - "time": "2016-04-26 14:23:03" + "time": "2016-06-04 20:20:48" + }, + { + "name": "guzzle/guzzle", + "version": "v3.8.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/4de0618a01b34aa1c8c33a3f13f396dcd3882eba", + "reference": "4de0618a01b34aa1c8c33a3f13f396dcd3882eba", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.3", + "symfony/event-dispatcher": ">=2.1" + }, + "replace": { + "guzzle/batch": "self.version", + "guzzle/cache": "self.version", + "guzzle/common": "self.version", + "guzzle/http": "self.version", + "guzzle/inflection": "self.version", + "guzzle/iterator": "self.version", + "guzzle/log": "self.version", + "guzzle/parser": "self.version", + "guzzle/plugin": "self.version", + "guzzle/plugin-async": "self.version", + "guzzle/plugin-backoff": "self.version", + "guzzle/plugin-cache": "self.version", + "guzzle/plugin-cookie": "self.version", + "guzzle/plugin-curlauth": "self.version", + "guzzle/plugin-error-response": "self.version", + "guzzle/plugin-history": "self.version", + "guzzle/plugin-log": "self.version", + "guzzle/plugin-md5": "self.version", + "guzzle/plugin-mock": "self.version", + "guzzle/plugin-oauth": "self.version", + "guzzle/service": "self.version", + "guzzle/stream": "self.version" + }, + "require-dev": { + "doctrine/cache": "*", + "monolog/monolog": "1.*", + "phpunit/phpunit": "3.7.*", + "psr/log": "1.0.*", + "symfony/class-loader": "*", + "zendframework/zend-cache": "<2.3", + "zendframework/zend-log": "<2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.8-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle": "src/", + "Guzzle\\Tests": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Guzzle Community", + "homepage": "https://github.com/guzzle/guzzle/contributors" + } + ], + "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2014-01-28 22:29:15" }, { "name": "jakub-onderka/php-console-color", @@ -779,16 +923,16 @@ }, { "name": "laravel/framework", - "version": "v5.2.31", + "version": "v5.2.37", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "2fa2797604bf54b06faf7bb139a9fc0d66826fea" + "reference": "bf199036b0e222a27e2133d841aee0d4238f804d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/2fa2797604bf54b06faf7bb139a9fc0d66826fea", - "reference": "2fa2797604bf54b06faf7bb139a9fc0d66826fea", + "url": "https://api.github.com/repos/laravel/framework/zipball/bf199036b0e222a27e2133d841aee0d4238f804d", + "reference": "bf199036b0e222a27e2133d841aee0d4238f804d", "shasum": "" }, "require": { @@ -904,20 +1048,20 @@ "framework", "laravel" ], - "time": "2016-04-27 13:02:09" + "time": "2016-06-10 22:38:47" }, { "name": "league/flysystem", - "version": "1.0.22", + "version": "1.0.24", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "bd73a91703969a2d20ab4bfbf971d6c2cbe36612" + "reference": "9aca859a303fdca30370f42b8c611d9cf0dedf4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/bd73a91703969a2d20ab4bfbf971d6c2cbe36612", - "reference": "bd73a91703969a2d20ab4bfbf971d6c2cbe36612", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9aca859a303fdca30370f42b8c611d9cf0dedf4b", + "reference": "9aca859a303fdca30370f42b8c611d9cf0dedf4b", "shasum": "" }, "require": { @@ -987,7 +1131,57 @@ "sftp", "storage" ], - "time": "2016-04-28 06:53:12" + "time": "2016-06-03 19:11:39" + }, + { + "name": "maxmind-db/reader", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git", + "reference": "1383655533aa2f13a990b27b075fdde8b7bdd5ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/1383655533aa2f13a990b27b075fdde8b7bdd5ff", + "reference": "1383655533aa2f13a990b27b075fdde8b7bdd5ff", + "shasum": "" + }, + "require": { + "php": ">=5.3.1" + }, + "require-dev": { + "phpunit/phpunit": "4.2.*", + "satooshi/php-coveralls": "dev-master", + "squizlabs/php_codesniffer": "2.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "MaxMind": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Gregory J. Oschwald", + "email": "goschwald@maxmind.com", + "homepage": "http://www.maxmind.com/" + } + ], + "description": "MaxMind DB Reader API", + "homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php", + "keywords": [ + "database", + "geoip", + "geoip2", + "geolocation", + "maxmind" + ], + "time": "2016-01-04 15:38:11" }, { "name": "monolog/monolog", @@ -1367,6 +1561,56 @@ ], "time": "2016-03-09 05:03:14" }, + { + "name": "stevebauman/location", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/stevebauman/location.git", + "reference": "7a9fdaa7591c556f49f86cdf82d2f9f480419d6b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/stevebauman/location/zipball/7a9fdaa7591c556f49f86cdf82d2f9f480419d6b", + "reference": "7a9fdaa7591c556f49f86cdf82d2f9f480419d6b", + "shasum": "" + }, + "require": { + "geoip2/geoip2": "2.1.*", + "illuminate/support": "5.*", + "php": ">=5.5.9" + }, + "require-dev": { + "orchestra/testbench": "3.1.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Stevebauman\\Location\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Steve Bauman", + "email": "steven_bauman@outlook.com" + } + ], + "description": "Retrieve a users location by their IP Address using Laravel 4 / 5", + "keywords": [ + "IP", + "geo", + "geo-location", + "geoip", + "laravel", + "location", + "php" + ], + "time": "2015-12-01 15:29:14" + }, { "name": "swiftmailer/swiftmailer", "version": "v5.4.2", @@ -1422,16 +1666,16 @@ }, { "name": "symfony/console", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "34a214710e0714b6efcf40ba3cd1e31373a97820" + "reference": "382fc9ed852edabd6133e34f8549d7a7d99db115" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/34a214710e0714b6efcf40ba3cd1e31373a97820", - "reference": "34a214710e0714b6efcf40ba3cd1e31373a97820", + "url": "https://api.github.com/repos/symfony/console/zipball/382fc9ed852edabd6133e34f8549d7a7d99db115", + "reference": "382fc9ed852edabd6133e34f8549d7a7d99db115", "shasum": "" }, "require": { @@ -1478,20 +1722,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-04-28 09:48:42" + "time": "2016-06-06 15:08:35" }, { "name": "symfony/debug", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "a06d10888a45afd97534506afb058ec38d9ba35b" + "reference": "e67e1552dd7313df1cf6535cb606751899e0e727" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/a06d10888a45afd97534506afb058ec38d9ba35b", - "reference": "a06d10888a45afd97534506afb058ec38d9ba35b", + "url": "https://api.github.com/repos/symfony/debug/zipball/e67e1552dd7313df1cf6535cb606751899e0e727", + "reference": "e67e1552dd7313df1cf6535cb606751899e0e727", "shasum": "" }, "require": { @@ -1535,20 +1779,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-03-30 10:41:14" + "time": "2016-06-06 15:08:35" }, { "name": "symfony/event-dispatcher", - "version": "v3.0.5", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "17b04e6b1ede45b57d3ad5146abe50df6c3968b4" + "reference": "0343b2cedd0edb26cdc791212a8eb645c406018b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/17b04e6b1ede45b57d3ad5146abe50df6c3968b4", - "reference": "17b04e6b1ede45b57d3ad5146abe50df6c3968b4", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0343b2cedd0edb26cdc791212a8eb645c406018b", + "reference": "0343b2cedd0edb26cdc791212a8eb645c406018b", "shasum": "" }, "require": { @@ -1568,7 +1812,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1595,20 +1839,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-04-12 18:09:53" + "time": "2016-04-12 18:27:47" }, { "name": "symfony/finder", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "c54e407b35bc098916704e9fd090da21da4c4f52" + "reference": "39e5f3d533d07b5416b9d7aad53a27f939d4f811" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/c54e407b35bc098916704e9fd090da21da4c4f52", - "reference": "c54e407b35bc098916704e9fd090da21da4c4f52", + "url": "https://api.github.com/repos/symfony/finder/zipball/39e5f3d533d07b5416b9d7aad53a27f939d4f811", + "reference": "39e5f3d533d07b5416b9d7aad53a27f939d4f811", "shasum": "" }, "require": { @@ -1644,20 +1888,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-03-10 11:13:05" + "time": "2016-05-13 18:03:36" }, { "name": "symfony/http-foundation", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "18b24bc32d2495ae79d76e777368786a6536fe31" + "reference": "d268a643884f85e91d6ba11ca68de96833f3f6e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/18b24bc32d2495ae79d76e777368786a6536fe31", - "reference": "18b24bc32d2495ae79d76e777368786a6536fe31", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d268a643884f85e91d6ba11ca68de96833f3f6e5", + "reference": "d268a643884f85e91d6ba11ca68de96833f3f6e5", "shasum": "" }, "require": { @@ -1697,20 +1941,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2016-04-12 18:09:53" + "time": "2016-06-06 11:33:26" }, { "name": "symfony/http-kernel", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "1aa25588241f915cf176b7c371e5d629dfff8b43" + "reference": "97cc1c15e3406e7a2adf14ad6b0e41a04d4a6fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1aa25588241f915cf176b7c371e5d629dfff8b43", - "reference": "1aa25588241f915cf176b7c371e5d629dfff8b43", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/97cc1c15e3406e7a2adf14ad6b0e41a04d4a6fc4", + "reference": "97cc1c15e3406e7a2adf14ad6b0e41a04d4a6fc4", "shasum": "" }, "require": { @@ -1779,20 +2023,20 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2016-05-03 05:58:27" + "time": "2016-06-06 16:52:35" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.1.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "1289d16209491b584839022f29257ad859b8532d" + "reference": "dff51f72b0706335131b00a7f49606168c582594" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d", - "reference": "1289d16209491b584839022f29257ad859b8532d", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", + "reference": "dff51f72b0706335131b00a7f49606168c582594", "shasum": "" }, "require": { @@ -1804,7 +2048,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -1838,20 +2082,20 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/polyfill-php56", - "version": "v1.1.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "4d891fff050101a53a4caabb03277284942d1ad9" + "reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/4d891fff050101a53a4caabb03277284942d1ad9", - "reference": "4d891fff050101a53a4caabb03277284942d1ad9", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/3edf57a8fbf9a927533344cef65ad7e1cf31030a", + "reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a", "shasum": "" }, "require": { @@ -1861,7 +2105,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -1894,20 +2138,20 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/polyfill-util", - "version": "v1.1.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-util.git", - "reference": "8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4" + "reference": "ef830ce3d218e622b221d6bfad42c751d974bf99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4", - "reference": "8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/ef830ce3d218e622b221d6bfad42c751d974bf99", + "reference": "ef830ce3d218e622b221d6bfad42c751d974bf99", "shasum": "" }, "require": { @@ -1916,7 +2160,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -1946,20 +2190,20 @@ "polyfill", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/process", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "53f9407c0bb1c5a79127db8f7bfe12f0f6f3dcdb" + "reference": "bf6e2d1fa8b93fdd7cca6b684c0ea213cf0255dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/53f9407c0bb1c5a79127db8f7bfe12f0f6f3dcdb", - "reference": "53f9407c0bb1c5a79127db8f7bfe12f0f6f3dcdb", + "url": "https://api.github.com/repos/symfony/process/zipball/bf6e2d1fa8b93fdd7cca6b684c0ea213cf0255dd", + "reference": "bf6e2d1fa8b93fdd7cca6b684c0ea213cf0255dd", "shasum": "" }, "require": { @@ -1995,20 +2239,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-04-14 15:30:28" + "time": "2016-06-06 11:33:26" }, { "name": "symfony/routing", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "6ab6fd5ee754fb53a303a5621ae35f3afd5970ac" + "reference": "c780454838a1131adc756d737a4b4cc1d18f8c64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/6ab6fd5ee754fb53a303a5621ae35f3afd5970ac", - "reference": "6ab6fd5ee754fb53a303a5621ae35f3afd5970ac", + "url": "https://api.github.com/repos/symfony/routing/zipball/c780454838a1131adc756d737a4b4cc1d18f8c64", + "reference": "c780454838a1131adc756d737a4b4cc1d18f8c64", "shasum": "" }, "require": { @@ -2070,20 +2314,20 @@ "uri", "url" ], - "time": "2016-04-28 09:48:42" + "time": "2016-05-30 06:58:27" }, { "name": "symfony/translation", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "f7a07af51ea067745a521dab1e3152044a2fb1f2" + "reference": "2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/f7a07af51ea067745a521dab1e3152044a2fb1f2", - "reference": "f7a07af51ea067745a521dab1e3152044a2fb1f2", + "url": "https://api.github.com/repos/symfony/translation/zipball/2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7", + "reference": "2b0aacaa613c0ec1ad8046f972d8abdcb19c1db7", "shasum": "" }, "require": { @@ -2134,20 +2378,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-03-25 01:41:20" + "time": "2016-06-06 11:33:26" }, { "name": "symfony/var-dumper", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "0e918c269093ba4c77fca14e9424fa74ed16f1a6" + "reference": "d8bb851da153d97abe7c2b71a65dee19f324bcf7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0e918c269093ba4c77fca14e9424fa74ed16f1a6", - "reference": "0e918c269093ba4c77fca14e9424fa74ed16f1a6", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/d8bb851da153d97abe7c2b71a65dee19f324bcf7", + "reference": "d8bb851da153d97abe7c2b71a65dee19f324bcf7", "shasum": "" }, "require": { @@ -2197,7 +2441,7 @@ "debug", "dump" ], - "time": "2016-04-25 11:17:47" + "time": "2016-05-24 10:03:10" }, { "name": "vlucas/phpdotenv", @@ -2460,16 +2704,16 @@ }, { "name": "mockery/mockery", - "version": "0.9.4", + "version": "0.9.5", "source": { "type": "git", "url": "https://github.com/padraic/mockery.git", - "reference": "70bba85e4aabc9449626651f48b9018ede04f86b" + "reference": "4db079511a283e5aba1b3c2fb19037c645e70fc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/padraic/mockery/zipball/70bba85e4aabc9449626651f48b9018ede04f86b", - "reference": "70bba85e4aabc9449626651f48b9018ede04f86b", + "url": "https://api.github.com/repos/padraic/mockery/zipball/4db079511a283e5aba1b3c2fb19037c645e70fc2", + "reference": "4db079511a283e5aba1b3c2fb19037c645e70fc2", "shasum": "" }, "require": { @@ -2521,41 +2765,138 @@ "test double", "testing" ], - "time": "2015-04-02 19:54:00" + "time": "2016-05-22 21:52:33" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27 11:43:31" }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + "reference": "9270140b940ff02e58ec577c237274e92cd40cdd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", + "reference": "9270140b940ff02e58ec577c237274e92cd40cdd", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-06-10 09:48:41" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ + "psr-4": { + "phpDocumentor\\Reflection\\": [ "src/" ] } @@ -2567,39 +2908,39 @@ "authors": [ { "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "email": "me@mikevanriel.com" } ], - "time": "2015-02-03 12:10:50" + "time": "2016-06-10 07:14:17" }, { "name": "phpspec/prophecy", - "version": "v1.6.0", + "version": "v1.6.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972" + "reference": "58a8137754bc24b25740d4281399a4a3596058e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972", - "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1", - "sebastian/recursion-context": "~1.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", + "sebastian/recursion-context": "^1.0" }, "require-dev": { - "phpspec/phpspec": "~2.0" + "phpspec/phpspec": "^2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -2632,7 +2973,7 @@ "spy", "stub" ], - "time": "2016-02-15 07:46:21" + "time": "2016-06-07 08:13:47" }, { "name": "phpunit/php-code-coverage", @@ -2786,21 +3127,24 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "1.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, "type": "library", "autoload": { "classmap": [ @@ -2823,7 +3167,7 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2016-05-12 18:03:57" }, { "name": "phpunit/php-token-stream", @@ -2876,16 +3220,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.24", + "version": "4.8.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a1066c562c52900a142a0e2bbf0582994671385e" + "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1066c562c52900a142a0e2bbf0582994671385e", - "reference": "a1066c562c52900a142a0e2bbf0582994671385e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc1d8cd5b5de11625979125c5639347896ac2c74", + "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74", "shasum": "" }, "require": { @@ -2899,7 +3243,7 @@ "phpunit/php-code-coverage": "~2.1", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", + "phpunit/php-timer": "^1.0.6", "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.1", "sebastian/diff": "~1.2", @@ -2944,7 +3288,7 @@ "testing", "xunit" ], - "time": "2016-03-14 06:16:08" + "time": "2016-05-17 03:09:28" }, { "name": "phpunit/phpunit-mock-objects", @@ -3120,16 +3464,16 @@ }, { "name": "sebastian/environment", - "version": "1.3.6", + "version": "1.3.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "2292b116f43c272ff4328083096114f84ea46a56" + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/2292b116f43c272ff4328083096114f84ea46a56", - "reference": "2292b116f43c272ff4328083096114f84ea46a56", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", "shasum": "" }, "require": { @@ -3166,7 +3510,7 @@ "environment", "hhvm" ], - "time": "2016-05-04 07:59:13" + "time": "2016-05-17 03:18:57" }, { "name": "sebastian/exporter", @@ -3375,16 +3719,16 @@ }, { "name": "symfony/css-selector", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0" + "reference": "e8a66c51bf65f188c02f8120c0748b2291d3a2d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/65e764f404685f2dc20c057e889b3ad04b2e2db0", - "reference": "65e764f404685f2dc20c057e889b3ad04b2e2db0", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/e8a66c51bf65f188c02f8120c0748b2291d3a2d0", + "reference": "e8a66c51bf65f188c02f8120c0748b2291d3a2d0", "shasum": "" }, "require": { @@ -3424,11 +3768,11 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2016-03-04 07:55:57" + "time": "2016-06-06 11:33:26" }, { "name": "symfony/dom-crawler", - "version": "v3.0.5", + "version": "v3.0.7", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -3484,16 +3828,16 @@ }, { "name": "symfony/yaml", - "version": "v3.0.5", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "0047c8366744a16de7516622c5b7355336afae96" + "reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/0047c8366744a16de7516622c5b7355336afae96", - "reference": "0047c8366744a16de7516622c5b7355336afae96", + "url": "https://api.github.com/repos/symfony/yaml/zipball/eca51b7b65eb9be6af88ad7cc91685f1556f5c9a", + "reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a", "shasum": "" }, "require": { @@ -3502,7 +3846,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -3529,7 +3873,56 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-03-04 07:55:57" + "time": "2016-05-26 21:46:24" + }, + { + "name": "webmozart/assert", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", + "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2015-08-24 13:29:44" } ], "aliases": [], diff --git a/database/migrations/2016_02_10_150405_Create_Users_Settings.php b/database/migrations/2016_02_10_150405_Create_Users_Settings.php index e59a9e2..fcb1895 100644 --- a/database/migrations/2016_02_10_150405_Create_Users_Settings.php +++ b/database/migrations/2016_02_10_150405_Create_Users_Settings.php @@ -17,10 +17,9 @@ public function up() Schema::create('users_settings', function (Blueprint $table) { $table->increments('id'); $table->integer('default_role'); - $table->boolean('register_enabled'); + $table->boolean('register_enabled')->comment = "0: off, 1: on";; $table->integer('default_active')->comment = "0: off, 1: email, 2: on"; - $table->boolean('welcome_email'); - $table->timestamps(); + $table->boolean('welcome_email')->comment = "0: off, 1: on"; }); $settings = new Users_Settings; diff --git a/database/migrations/2016_02_10_151500_Create_Permission_Types.php b/database/migrations/2016_02_10_151500_Create_Permission_Types.php index 30d4654..247de06 100644 --- a/database/migrations/2016_02_10_151500_Create_Permission_Types.php +++ b/database/migrations/2016_02_10_151500_Create_Permission_Types.php @@ -49,6 +49,11 @@ public function up() $type->type = "Post Administration"; $type->su = true; $type->save(); + + $type = new Permission_types; + $type->type = "Developer Mode"; + $type->su = true; + $type->save(); } /** diff --git a/database/migrations/2016_02_10_152932_Create_Permissions.php b/database/migrations/2016_02_10_152932_Create_Permissions.php index b8a4575..8221d6a 100644 --- a/database/migrations/2016_02_10_152932_Create_Permissions.php +++ b/database/migrations/2016_02_10_152932_Create_Permissions.php @@ -264,6 +264,14 @@ public function up() $perm->su = true; $perm->save(); + $perm = new Permission; + $perm->slug = 'admin.developer.access'; + $perm->name = 'Developer Access'; + $perm->info = 'Grants access to developer mode'; + $perm->type_id = Permission_Types::where('type', 'Developer Mode')->first()->id; + $perm->su = true; + $perm->save(); + } /** diff --git a/resources/views/admin/blogs/posts/graphics.blade.php b/resources/views/admin/blogs/posts/graphics.blade.php index 7a3c0ec..994e69c 100644 --- a/resources/views/admin/blogs/posts/graphics.blade.php +++ b/resources/views/admin/blogs/posts/graphics.blade.php @@ -1,7 +1,7 @@ @extends('layouts.admin.index') @section('title', $post->name . ' Graphics') @section('content') - <a href="{{ url('admin/blogs', [$post->blog->id]) }}" class="btn btn-primary" role="button">Back</a><br><br> +<a href="{{ url('admin/blogs', [$post->blog->id]) }}" class="btn btn-primary" role="button">Back</a><br><br> <div class="row"> <div class="col-sm-12 col-md-6"> <div class="panel panel-default"> @@ -44,7 +44,7 @@ @if(count($labels) > 0) labels: [@foreach($labels as $label) '{{ $countries[$label] }}', @endforeach], datasets: [{ - data: [@foreach($labels as $label) {{ count(App\Post_View::where('country_code', $label)->get()) }}, @endforeach], + data: [@foreach($labels as $label) {{ count(App\Post_View::whereCountry_codeAndPost_id($label, $post->id)->get()) }}, @endforeach], backgroundColor: [@foreach($labels as $label) '{{ sprintf('#%06X', mt_rand(0, 0xFFFFFF)) }}', @endforeach] }] @else @@ -58,7 +58,7 @@ options: { title: { display: true, - text: 'Total post views on countries', + text: "Total post views on countries ({{ count(App\Post_View::where('post_id', $post->id)->get()) }} Views)", fontSize: 20, } } diff --git a/resources/views/admin/developer/create.blade.php b/resources/views/admin/developer/create.blade.php new file mode 100644 index 0000000..196a0de --- /dev/null +++ b/resources/views/admin/developer/create.blade.php @@ -0,0 +1,37 @@ +@extends('layouts.admin.index') +@section('title', "Create Row") +@section('content') + <div class="row"> + + + <div class="col-md-2 col-lg-4"></div> + <div class="col-md-8 col-lg-4"> + <div class="panel panel-default"> + <div class="panel-body"> + <br> + <center> + <h3> + <span>Create Row</span> + </h3> + </center> + <br> + <form method="POST"> + {{ csrf_field() }} + + @include('admin/forms/master') + + <br> + <div class="form-group "> + <a href="{{ url('admin/developer', $name) }}" class="btn btn-primary">Back</a> + <button type="submit" class="btn btn-primary pull-right">Create</button> + </div> + </form> + </div> + </div> + </div> + <div class="col-md-2 col-lg-4"></div> + + + </div> + +@endsection diff --git a/resources/views/admin/developer/index.blade.php b/resources/views/admin/developer/index.blade.php new file mode 100644 index 0000000..639fb03 --- /dev/null +++ b/resources/views/admin/developer/index.blade.php @@ -0,0 +1,41 @@ +@extends('layouts.admin.index') +@section('title', "Blogs") +@section('content') + <div class="row"> + <div class="col-sm-12"> + <center> + <h3>Developer Mode</h3><br> + </center> + </div> + <div class="col-sm-12 col-md-6 col-md-offset-3"> + <div class="panel panel-default"> + <div class="panel-body"> + <div class="table-responsive"> + <table class="table table-striped table-hover center"> + <thead> + <tr> + <th class="text-center">Table</th> + <th class="text-center">Columns</th> + <th class="text-center">Rows</th> + <th class="text-center">Edit</th> + </tr> + </thead> + <tbody> + @foreach($tables as $table) + <tr> + <td class="text-center">{{ $table }}</td> + <td class="text-center">{{ count(\Schema::getColumnListing($table)) }}</td> + <td class="text-center">{{ count(\DB::table($table)->get()) }}</td> + <td class="text-center"> + <a href="{{ url('admin/developer', $table) }}" class="btn btn-primary btn-sm">Edit</a> + </td> + </tr> + @endforeach + </tbody> + </table> + </div> + </div> + </div> + </div> + </div> +@endsection diff --git a/resources/views/admin/developer/row.blade.php b/resources/views/admin/developer/row.blade.php new file mode 100644 index 0000000..23b3619 --- /dev/null +++ b/resources/views/admin/developer/row.blade.php @@ -0,0 +1,37 @@ +@extends('layouts.admin.index') +@section('title', "Edit Row #".$row->id) +@section('content') + <div class="row"> + + + <div class="col-md-2 col-lg-4"></div> + <div class="col-md-8 col-lg-4"> + <div class="panel panel-default"> + <div class="panel-body"> + <br> + <center> + <h3> + <span>Edit Row #{{ $row->id }}</span> + </h3> + </center> + <br> + <form method="POST"> + {{ csrf_field() }} + + @include('admin/forms/master') + + <br> + <div class="form-group "> + <a href="{{ url('admin/developer', $name) }}" class="btn btn-primary">Back</a> + <button type="submit" class="btn btn-primary pull-right">Save changes</button> + </div> + </form> + </div> + </div> + </div> + <div class="col-md-2 col-lg-4"></div> + + + </div> + +@endsection diff --git a/resources/views/admin/developer/table.blade.php b/resources/views/admin/developer/table.blade.php new file mode 100644 index 0000000..411f0ce --- /dev/null +++ b/resources/views/admin/developer/table.blade.php @@ -0,0 +1,86 @@ +@extends('layouts.admin.index') +@section('title', "Edit ". $name) +@section('content') + <a href="{{ url('admin/developer') }}" class="btn btn-primary" role="button">Back</a><br><br> + <div class="row"> + <div class="col-sm-12"> + <center> + <h3>Edit {{ $name }}</h3><br> + </center> + </div> + <?php require(app_path() . '/Http/Controllers/Admin/Data/Edit/DevGet.php'); $allow_edit = $allow; ?> + <?php require(app_path() . '/Http/Controllers/Admin/Data/Create/DevGet.php'); ?> + <div class="col-sm-12"> + <div class="panel panel-default"> + <div class="panel-body"> + @if($allow) + <a href="{{ url('admin/developer', [$name, 'create']) }}" class="btn btn-primary btn-sm">Create</a><br> + @else + <a disabled class="btn btn-primary btn-sm">Create</a><br> + @endif + <div class="table-responsive"> + <table class="table table-striped table-hover center"> + <thead> + <tr> + @foreach($columns as $column) + <th class="text-center">{{$column}}</th> + @endforeach + <th class="text-center">Edit</th> + <th class="text-center">Delete</th> + </tr> + </thead> + <tbody> + <?php + require(app_path() . '/Http/Controllers/Admin/Data/DevData.php'); + $hide = []; + if(array_key_exists($name, $data)){ + if(array_key_exists('hide_display', $data[$name])){ + $hide = $data[$name]['hide_display']; + } + } + ?> + @foreach($rows as $row) + <tr> + @foreach($columns as $column) + <td class="text-center">@if(in_array($column,$hide))<i>HIDDEN</i>@else @if($row->$column == "")<i>EMPTY</i>@else {{ $row->$column }} @endif @endif</td> + @endforeach + @if($allow_edit and \Schema::hasColumn($name, 'id')) + <td class="text-center"> + <a href="{{ url('admin/developer', [$name, $row->id]) }}" class="btn btn-primary btn-sm">Edit</a> + </td> + @else + <td class="text-center"> + <a disabled class="btn btn-primary btn-sm">Edit</a> + </td> + @endif + <?php + # Check if you're allowed to delete rows + require(app_path() . '/Http/Controllers/Admin/Data/DevData.php'); + $del = true; + if(array_key_exists($name, $data)){ + if(array_key_exists('delete', $data[$name])) { + if(!$data[$name]['delete']){ + $del = false; + } + } + } + ?> + @if($del) + <td class="text-center"> + <a href="" class="btn btn-danger btn-sm">Delete</a> + </td> + @else + <td class="text-center"> + <a disabled class="btn btn-danger btn-sm">Delete</a> + </td> + @endif + </tr> + @endforeach + </tbody> + </table> + </div> + </div> + </div> + </div> + </div> +@endsection diff --git a/resources/views/admin/forms/master.blade.php b/resources/views/admin/forms/master.blade.php index f782a5f..2f96f67 100644 --- a/resources/views/admin/forms/master.blade.php +++ b/resources/views/admin/forms/master.blade.php @@ -1,4 +1,4 @@ -<fieldset> + <fieldset> @if(!$fields) <div class="row"> <div class="lateral-spacer"> @@ -65,11 +65,14 @@ $type = Schema::getColumnType($table, $field); + # Set the input type if($type == 'string') { $input_type = "text"; } elseif($type == 'integer') { $input_type = "number"; + } else { + $input_type = "text"; } # Check if it needs to be masked diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 63ba3c7..25faf29 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -66,30 +66,6 @@ </div> </div> - - <div class="form-group{{ $errors->has('country_code') ? ' has-error' : '' }}"> - <label class="col-md-4 control-label">Country</label> - - <div class="col-md-6"> - <select class="form-control" name="country_code" id="country_code"> - <option disabled selected value="">Select the country</option> - <?php - $json = file_get_contents('admin_panel/assets/countries/names.json'); - $countries = json_decode($json, true); - ?> - @foreach($countries as $country) - <option value="{{ array_search($country, $countries) }}">{{ $country }}</option> - @endforeach - </select> - - @if ($errors->has('country_code')) - <span class="help-block"> - <strong>{{ $errors->first('country_code') }}</strong> - </span> - @endif - </div> - </div> - <div class="form-group"> <div class="col-md-6 col-md-offset-4"> <button type="submit" class="btn btn-primary"> diff --git a/resources/views/layouts/admin/index.blade.php b/resources/views/layouts/admin/index.blade.php index a34ef56..e38921f 100644 --- a/resources/views/layouts/admin/index.blade.php +++ b/resources/views/layouts/admin/index.blade.php @@ -120,6 +120,7 @@ <li><a href="{{ url('admin/blogs') }}">Blog</a></li> </ul> <ul class="nav navbar-nav navbar-right"> + <li><a href="{{ url('admin/developer') }}">Developer Mode</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{ Auth::user()->name }} <span class="caret"></span></a> <ul class="dropdown-menu" role="menu">