- We publish articles on a number of topics. We encourage you to read our posts and let us know your feedback. It would be really help us to move forward.
-
- @foreach ($$module_name_singular->tags as $tag)
- {{$tag->name}}
- @endforeach
-
-
-
-
- @endforeach
-
-
-
- {{$$module_name->links()}}
-
-
-
-@endif
-
-@endsection
diff --git a/Modules/Article/Routes/.gitkeep b/Modules/Article/Routes/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/Modules/Article/Routes/api.php b/Modules/Article/Routes/api.php
deleted file mode 100644
index c946b66..0000000
--- a/Modules/Article/Routes/api.php
+++ /dev/null
@@ -1,18 +0,0 @@
-get('/article', function (Request $request) {
-// return $request->user();
-// });
diff --git a/Modules/Article/Routes/web.php b/Modules/Article/Routes/web.php
deleted file mode 100644
index d65197c..0000000
--- a/Modules/Article/Routes/web.php
+++ /dev/null
@@ -1,84 +0,0 @@
- LaravelLocalization::setLocale(),
- 'middleware' => [ 'localeSessionRedirect', 'localizationRedirect', 'localeViewPath']], function(){
-
- Route::group(['namespace' => '\Modules\Article\Http\Controllers\Frontend', 'as' => 'frontend.', 'middleware' => 'web', 'prefix' => ''], function () {
-
- /*
- *
- * Posts Routes
- *
- * ---------------------------------------------------------------------
- */
- $module_name = 'posts';
- $controller_name = 'PostsController';
- Route::get("$module_name", ['as' => "$module_name.index", 'uses' => "$controller_name@index"]);
- Route::get("$module_name/{id}/{slug?}", ['as' => "$module_name.show", 'uses' => "$controller_name@show"]);
-
- /*
- *
- * Categories Routes
- *
- * ---------------------------------------------------------------------
- */
- $module_name = 'categories';
- $controller_name = 'CategoriesController';
- Route::get("$module_name", ['as' => "$module_name.index", 'uses' => "$controller_name@index"]);
- Route::get("$module_name/{id}/{slug?}", ['as' => "$module_name.show", 'uses' => "$controller_name@show"]);
- });
-
-/*
-*
-* Backend Routes
-*
-* --------------------------------------------------------------------
-*/
-
- Route::group(['namespace' => '\Modules\Article\Http\Controllers\Backend', 'as' => 'backend.', 'middleware' => ['web', 'auth', 'can:view_backend'], 'prefix' => 'admin'], function () {
- /*
- * These routes need view-backend permission
- * (good if you want to allow more than one group in the backend,
- * then limit the backend features by different roles or permissions)
- *
- * Note: Administrator has all permissions so you do not have to specify the administrator role everywhere.
- */
-
- /*
- *
- * Posts Routes
- *
- * ---------------------------------------------------------------------
- */
- $module_name = 'posts';
- $controller_name = 'PostsController';
- Route::get("$module_name/index_list", ['as' => "$module_name.index_list", 'uses' => "$controller_name@index_list"]);
- Route::get("$module_name/index_data", ['as' => "$module_name.index_data", 'uses' => "$controller_name@index_data"]);
- Route::get("$module_name/trashed", ['as' => "$module_name.trashed", 'uses' => "$controller_name@trashed"]);
- Route::patch("$module_name/trashed/{id}", ['as' => "$module_name.restore", 'uses' => "$controller_name@restore"]);
- Route::resource("$module_name", "$controller_name");
-
- /*
- *
- * Categories Routes
- *
- * ---------------------------------------------------------------------
- */
- $module_name = 'categories';
- $controller_name = 'CategoriesController';
- Route::get("$module_name/index_list", ['as' => "$module_name.index_list", 'uses' => "$controller_name@index_list"]);
- Route::get("$module_name/index_data", ['as' => "$module_name.index_data", 'uses' => "$controller_name@index_data"]);
- Route::get("$module_name/trashed", ['as' => "$module_name.trashed", 'uses' => "$controller_name@trashed"]);
- Route::patch("$module_name/trashed/{id}", ['as' => "$module_name.restore", 'uses' => "$controller_name@restore"]);
- Route::resource("$module_name", "$controller_name");
- });
-
-}); // END LOCALIZED Routes
diff --git a/Modules/Article/Tests/Feature/.gitkeep b/Modules/Article/Tests/Feature/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/Modules/Article/Tests/Unit/.gitkeep b/Modules/Article/Tests/Unit/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/Modules/Article/composer.json b/Modules/Article/composer.json
deleted file mode 100644
index 28f4e95..0000000
--- a/Modules/Article/composer.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "nasirkhan/article-module",
- "description": "Article module with Posts, Categories, Tags, Comments. It works with nasirkhan/laravel-starter",
- "type": "laravel-module",
- "version": "v1.0.0",
- "authors": [
- {
- "name": "Nasir Khan",
- "email": "nasir8891@gmail.com"
- }
- ],
- "extra": {
- "laravel": {
- "providers": [
- "Modules\\Article\\Providers\\ArticleServiceProvider"
- ],
- "aliases": {
-
- }
- }
- },
- "autoload": {
- "psr-4": {
- "Modules\\Article\\": ""
- }
- }
-}
diff --git a/Modules/Article/module.json b/Modules/Article/module.json
deleted file mode 100644
index 926570c..0000000
--- a/Modules/Article/module.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "Article",
- "alias": "article",
- "description": "",
- "keywords": [],
- "order": 0,
- "providers": [
- "Modules\\Article\\Providers\\ArticleServiceProvider",
- "Modules\\Article\\Providers\\EventServiceProvider"
- ],
- "aliases": {},
- "files": [],
- "requires": []
-}
diff --git a/Modules/Article/package.json b/Modules/Article/package.json
deleted file mode 100644
index 67dd768..0000000
--- a/Modules/Article/package.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "private": true,
- "scripts": {
- "dev": "npm run development",
- "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
- "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
- "watch-poll": "npm run watch -- --watch-poll",
- "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
- "prod": "npm run production",
- "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
- },
- "devDependencies": {
- "cross-env": "^5.1.4",
- "laravel-mix": "^4.0.7",
- "laravel-mix-merge-manifest": "^0.1.2"
- }
-}
diff --git a/Modules/Article/webpack.mix.js b/Modules/Article/webpack.mix.js
deleted file mode 100644
index 48d94b7..0000000
--- a/Modules/Article/webpack.mix.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const mix = require('laravel-mix');
-require('laravel-mix-merge-manifest');
-
-mix.setPublicPath('../../public').mergeManifest();
-
-mix.js(__dirname + '/Resources/assets/js/app.js', 'js/article.js')
- .sass( __dirname + '/Resources/assets/sass/app.scss', 'css/article.css');
-
-if (mix.inProduction()) {
- mix.version();
-}
\ No newline at end of file
diff --git a/Modules/Blog/.editorconfig b/Modules/Blog/.editorconfig
new file mode 100644
index 0000000..6537ca4
--- /dev/null
+++ b/Modules/Blog/.editorconfig
@@ -0,0 +1,15 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 4
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[*.{yml,yaml}]
+indent_size = 2
diff --git a/Modules/Blog/.gitattributes b/Modules/Blog/.gitattributes
new file mode 100644
index 0000000..967315d
--- /dev/null
+++ b/Modules/Blog/.gitattributes
@@ -0,0 +1,5 @@
+* text=auto
+*.css linguist-vendored
+*.scss linguist-vendored
+*.js linguist-vendored
+CHANGELOG.md export-ignore
diff --git a/Modules/Blog/.gitignore b/Modules/Blog/.gitignore
new file mode 100644
index 0000000..b4d687d
--- /dev/null
+++ b/Modules/Blog/.gitignore
@@ -0,0 +1,13 @@
+/node_modules
+/public/hot
+/public/storage
+/storage/*.key
+/vendor
+.env
+.env.backup
+.phpunit.result.cache
+Homestead.json
+Homestead.yaml
+npm-debug.log
+yarn-error.log
+.php_cs.cache
diff --git a/Modules/Blog/.php_cs b/Modules/Blog/.php_cs
new file mode 100644
index 0000000..ffe6e5b
--- /dev/null
+++ b/Modules/Blog/.php_cs
@@ -0,0 +1,22 @@
+notPath('bootstrap')
+ ->notPath('storage')
+ ->notPath('vendor')
+ ->in(__DIR__)
+ ->name('*.php')
+ ->name('_ide_helper')
+ ->notName('*.blade.php')
+ ->ignoreDotFiles(true)
+ ->ignoreVCS(true);
+
+
+return PhpCsFixer\Config::create()
+ ->setRules([
+ '@PSR2' => true,
+ 'array_syntax' => ['syntax' => 'short'],
+ 'ordered_imports' => ['sortAlgorithm' => 'alpha'],
+ 'no_unused_imports' => true,
+ ])
+ ->setFinder($finder);
diff --git a/Modules/Blog/LICENSE.md b/Modules/Blog/LICENSE.md
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/Modules/Blog/LICENSE.md
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/Modules/Blog/README.md b/Modules/Blog/README.md
new file mode 100644
index 0000000..f93ec32
--- /dev/null
+++ b/Modules/Blog/README.md
@@ -0,0 +1,198 @@
+
+
+
+
+
+
+# Based on Laravel8.x
+laravel starter Template, to save your time when You start with new scalable Laravel projects with many features.
+
+# [Live Demo](https://larastarter.me)
+you can see all things in live demo
+
+```
+Dashboard Creditional
+Super Admin
+User: super@admin.com
+Pass: secret
+
+User
+User: user@user.com
+Pass: secret
+
+```
+
+
+
+# Requirements
+
+please be careful about the Requirements:-
+- Highly Recommended to use it with PHP v7.4 or up, and ensure that , the version used by composer is 7.4 to Avoid any problems with contianed packages.
+- All packages work probably with PHP 7.2, BUT PHP7.4 and The exif extension is required for Spatie Media Library.
+
+## IMPORTANT NOTE
+if you have PHP7.4 you will use this template with all features without any problems, but if your PHP under 7.4 you Can NOT use it with Spatie Media Library, SO you must uninstall Spatie Media Library or Upgrade your php to 7.4 or UP [see more about Spatie Media Library here](https://spatie.be/docs/laravel-medialibrary/v9/introduction)
+
+# Custom Commands
+
+I have created a number of custom commands for the project. The commands are listed below with a brief about the use of it.
+
+## Clear All Cache
+
+`composer clear-all`
+
+this is a shortcut command clear all cache including config, route and more
+
+## Code Style Fix
+
+`composer fix-cs`
+
+apply the code style fix by this command.
+
+
+# Features
+
+The `laravel-starter-template` comes with a number of features which are the most common in almost all the applications. It is a template project which means it is intended to build in a way that it can be used for other projects.
+
+It is a modular application, and a number of modules are installed by default. It will be helpful to use it as a base for the future applications.
+
+* Admin feature and public views are completely separated as `Backend` and `Frontend` namespace.
+* Major feature are developed as `Modules`. Module like Posts, Comments, Tags are separated from the core features like User, Role, Permission
+
+## Core Features
+
+* User Authentication
+* Social Login
+ * Google
+ * Facebook
+ * Github
+ * Build in a way adding more is much easy now
+* User Profile with Avatar
+ * Separate User Profile table
+* Role-Permissions for Users
+* Dynamic Menu System
+* Backend Theme
+ * Bootstrap 4, CoreUI
+ * Fontawesome 5
+* Frontend Theme
+ * Bootstrap 4, Impact Design Kit
+ * Fontawesome 5
+* Article Module
+ * Posts
+ * Categories
+ * Tags
+ * Comments
+ * wysiwyg editor
+ * File browser
+* Application Settings
+* External Libraries
+ * Bootstrap 4
+ * Fontawesome 5
+ * CoreUI
+ * Impact Design Kit
+ * Select2
+ * Date Time Picker
+* Backup (Source, Files, Database as Zip)
+* Log Viewer
+* Built by Modules (microservices) Archticture
+* Notification
+ * Dashboard and details view
+* RSS Feed
+
+## Additional features
+
+* Well Structure of Scalable Laravel Projects (Modules Structure, Folders,Routes,Controllers,Views)
+* Language Switcher Frontend and Backend (with middleware)
+* RTL Support by one click ,Just change language to Arabic , it will change Direction to RTL
+* Eloquent models translatable with [spatie/laravel-translatable](https://github.com/spatie/laravel-translatable)
+* SEO Friendly by Forcing all frontend routes with locale prefix
+* with Spatie Media Library and conversitions
+* with [Yajra DataTables](https://github.com/yajra/laravel-datatables)
+* with [infyom Laravel Generator](https://github.com/InfyOmLabs/laravel-generator)
+* with [laravel fractal](https://github.com/spatie/laravel-fractal)
+* All Stubs are ready to customize
+* Notifications for Admin
+
+
+# User Guide
+
+## Installation
+
+Follow the steps mentioned below to install and run the project.
+
+1. Clone or download the repository `git clone https://github.com/omaralalwi/laravel-starter-template`
+2. Go to the project directory and run `composer install`
+3. Create `.env` file by copying the `.env.example`. You may use the command to do that `cp .env.example .env`
+4. Update the database name and credentials in `.env` file
+5. Run the command `php artisan migrate --seed`
+6. Link storage directory: `php artisan storage:link`
+7. generate encryption key to app: `php artisan key:generate`
+8. You may create a virtualhost entry to access the application or run `php artisan serve` from the project root and visit `http://127.0.0.1:8000`
+9. Login to Admin Panel `localhost:8000/admin/dashboard` Username: super@admin.com Password: secret
+
+
+*After creating the new permissions use the following commands to update cashed permissions.*
+
+`php artisan cache:forget spatie.permission.cache`
+
+## Icons
+FontAwesome & CoreUI Icons, two different font icon library is installed for the Backend theme and only FontAwesome for the Frontend. For both of the cases we used the free version. You may install the pro version separately for your own project.
+
+* **FontAwesome** - https://fontawesome.com/icons?d=gallery&m=free
+* **CoreUI Icons** - https://icons.coreui.io/icons/
+
+## Making a model translatable
+ According to spaite pakcage:-
+- to make default local open config/translatable and edit 'fallback_locale' => null, to your prefferd local like: 'fallback_locale' => ar, if you prefer Arabic.
+- NOTE: This prefferd local for translated models not for App local, this mean if you insert product with many languages the primary language will be ar.
+
+- All Toturials for Translation package [here](https://github.com/spatie/laravel-translatable) , you do't need to install it , it is preinstalled, Just see Toturials.
+
+# insert Demo Data in DB
+
+to login with Admin You must add it by run the follwing command
+```
+php artisan db:seed
+```
+
+Then insert Demo Data For Posts and comments and Tags and another Models , Run the follwing Command
+
+```
+php artisan starter:insert-demo-data --fresh
+
+```
+
+## Screenshots
+
+these some screenshotes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Development
+
+This project will continue to evolve and grow, until it becomes the first Laravel Starter Template, follwo me to still up to date.
+
+## Credits
+
+- [Omar Alalwi](https://github.com/omaralalwi)
+
+Contact ME [ Twitter ](https://twitter.com/omaralalwi2013)
+OR Hire me on [ Freelancer ](https://www.freelancer.com/u/omaralwi2010)
+OR Hire me on [ UpWork ](https://www.upwork.com/fl/omaralalwi)
+OR Contact by [ Email ](mailto:Contact@omaralalwi.info)
+
+## License
+
+This Project is open sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
diff --git a/Modules/Blog/app/Authorizable.php b/Modules/Blog/app/Authorizable.php
new file mode 100644
index 0000000..0df72e8
--- /dev/null
+++ b/Modules/Blog/app/Authorizable.php
@@ -0,0 +1,58 @@
+ 'view',
+ 'index_data' => 'view',
+ 'index_list' => 'view',
+ 'edit' => 'edit',
+ 'show' => 'view',
+ 'update' => 'edit',
+ 'create' => 'add',
+ 'store' => 'add',
+ 'destroy' => 'delete',
+ 'restore' => 'restore',
+ 'trashed' => 'restore',
+ ];
+
+ /**
+ * Override of callAction to perform the authorization before.
+ *
+ *
+ * @return mixed
+ */
+ public function callAction($method, $parameters)
+ {
+ if ($ability = $this->getAbility($method)) {
+ $this->authorize($ability);
+ }
+
+ return parent::callAction($method, $parameters);
+ }
+
+ public function getAbility($method)
+ {
+ $routeName = explode('.', \Request::route()->getName());
+ $action = Arr::get($this->getAbilities(), $method);
+
+ return $action ? $action.'_'.$routeName[1] : null;
+ }
+
+ private function getAbilities()
+ {
+ return $this->abilities;
+ }
+
+ public function setAbilities($abilities)
+ {
+ $this->abilities = $abilities;
+ }
+}
diff --git a/app/Console/Commands/AuthPermissionCommand.php b/Modules/Blog/app/Console/Commands/AuthPermissionCommand.php
similarity index 97%
rename from app/Console/Commands/AuthPermissionCommand.php
rename to Modules/Blog/app/Console/Commands/AuthPermissionCommand.php
index d0fe5e3..11ec53d 100644
--- a/app/Console/Commands/AuthPermissionCommand.php
+++ b/Modules/Blog/app/Console/Commands/AuthPermissionCommand.php
@@ -35,10 +35,8 @@ public function __construct()
/**
* Execute the console command.
- *
- * @return mixed
*/
- public function handle()
+ public function handle(): void
{
$permissions = $this->generatePermissions();
diff --git a/Modules/Blog/app/Console/Kernel.php b/Modules/Blog/app/Console/Kernel.php
new file mode 100644
index 0000000..dab565b
--- /dev/null
+++ b/Modules/Blog/app/Console/Kernel.php
@@ -0,0 +1,37 @@
+command('inspire')
+ // ->hourly();
+ }
+
+ /**
+ * Register the commands for the application.
+ */
+ protected function commands(): void
+ {
+ $this->load(__DIR__.'/Commands');
+
+ require base_path('routes/console.php');
+ }
+}
diff --git a/app/Events/Backend/UserCreated.php b/Modules/Blog/app/Events/Backend/UserCreated.php
similarity index 99%
rename from app/Events/Backend/UserCreated.php
rename to Modules/Blog/app/Events/Backend/UserCreated.php
index 3c63496..0202d15 100644
--- a/app/Events/Backend/UserCreated.php
+++ b/Modules/Blog/app/Events/Backend/UserCreated.php
@@ -13,6 +13,7 @@ class UserCreated
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
+
public $user;
/**
diff --git a/Modules/Blog/app/Events/Backend/UserProfileUpdated.php b/Modules/Blog/app/Events/Backend/UserProfileUpdated.php
new file mode 100644
index 0000000..e8f0356
--- /dev/null
+++ b/Modules/Blog/app/Events/Backend/UserProfileUpdated.php
@@ -0,0 +1,38 @@
+user_profile = $user_profile;
+ }
+
+ /**
+ * Get the channels the event should broadcast on.
+ *
+ * @return \Illuminate\Broadcasting\Channel|array
+ */
+ public function broadcastOn()
+ {
+ return new PrivateChannel('channel-name');
+ }
+}
diff --git a/Modules/Blog/app/Events/Backend/UserUpdated.php b/Modules/Blog/app/Events/Backend/UserUpdated.php
new file mode 100644
index 0000000..791c430
--- /dev/null
+++ b/Modules/Blog/app/Events/Backend/UserUpdated.php
@@ -0,0 +1,38 @@
+user = $user;
+ }
+
+ /**
+ * Get the channels the event should broadcast on.
+ *
+ * @return \Illuminate\Broadcasting\Channel|array
+ */
+ public function broadcastOn()
+ {
+ return new PrivateChannel('channel-name');
+ }
+}
diff --git a/Modules/Blog/app/Events/Frontend/UserProfileUpdated.php b/Modules/Blog/app/Events/Frontend/UserProfileUpdated.php
new file mode 100644
index 0000000..44af9fb
--- /dev/null
+++ b/Modules/Blog/app/Events/Frontend/UserProfileUpdated.php
@@ -0,0 +1,38 @@
+user_profile = $user_profile;
+ }
+
+ /**
+ * Get the channels the event should broadcast on.
+ *
+ * @return \Illuminate\Broadcasting\Channel|array
+ */
+ public function broadcastOn()
+ {
+ return new PrivateChannel('channel-name');
+ }
+}
diff --git a/app/Events/Frontend/UserRegistered.php b/Modules/Blog/app/Events/Frontend/UserRegistered.php
similarity index 99%
rename from app/Events/Frontend/UserRegistered.php
rename to Modules/Blog/app/Events/Frontend/UserRegistered.php
index c653fe1..97c0eb1 100644
--- a/app/Events/Frontend/UserRegistered.php
+++ b/Modules/Blog/app/Events/Frontend/UserRegistered.php
@@ -13,7 +13,7 @@ class UserRegistered
use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
-
+
public $user;
/**
diff --git a/Modules/Blog/app/Events/Frontend/UserUpdated.php b/Modules/Blog/app/Events/Frontend/UserUpdated.php
new file mode 100644
index 0000000..6977f82
--- /dev/null
+++ b/Modules/Blog/app/Events/Frontend/UserUpdated.php
@@ -0,0 +1,38 @@
+user = $user;
+ }
+
+ /**
+ * Get the channels the event should broadcast on.
+ *
+ * @return \Illuminate\Broadcasting\Channel|array
+ */
+ public function broadcastOn()
+ {
+ return new PrivateChannel('channel-name');
+ }
+}
diff --git a/Modules/Blog/app/Exceptions/Handler.php b/Modules/Blog/app/Exceptions/Handler.php
new file mode 100644
index 0000000..5ad50bd
--- /dev/null
+++ b/Modules/Blog/app/Exceptions/Handler.php
@@ -0,0 +1,52 @@
+ true,
+ 'message' => $message,
+ ], 200);
+ }
+}
diff --git a/Modules/Blog/app/Http/Controllers/Auth/AuthenticatedSessionController.php b/Modules/Blog/app/Http/Controllers/Auth/AuthenticatedSessionController.php
new file mode 100644
index 0000000..bbfa545
--- /dev/null
+++ b/Modules/Blog/app/Http/Controllers/Auth/AuthenticatedSessionController.php
@@ -0,0 +1,54 @@
+authenticate();
+
+ $request->session()->regenerate();
+
+ $redirectTo = request()->redirectTo;
+
+ if ($redirectTo) {
+ return redirect($redirectTo);
+ } else {
+ return redirect(AppServiceProvider::HOME);
+ }
+ }
+
+ /**
+ * Destroy an authenticated session.
+ */
+ public function destroy(Request $request): RedirectResponse
+ {
+ Auth::logout();
+
+ $request->session()->invalidate();
+
+ $request->session()->regenerateToken();
+
+ return redirect('/');
+ }
+}
diff --git a/Modules/Blog/app/Http/Controllers/Auth/ConfirmablePasswordController.php b/Modules/Blog/app/Http/Controllers/Auth/ConfirmablePasswordController.php
new file mode 100644
index 0000000..7564c83
--- /dev/null
+++ b/Modules/Blog/app/Http/Controllers/Auth/ConfirmablePasswordController.php
@@ -0,0 +1,40 @@
+ $request->user()->email,
+ 'password' => $request->password,
+ ])) {
+ return back()->withErrors([
+ 'password' => __('auth.password'),
+ ]);
+ }
+
+ $request->session()->put('auth.password_confirmed_at', time());
+
+ return redirect()->intended(AppServiceProvider::HOME);
+ }
+}
diff --git a/app/Http/Controllers/Auth/EmailVerificationNotificationController.php b/Modules/Blog/app/Http/Controllers/Auth/EmailVerificationNotificationController.php
similarity index 77%
rename from app/Http/Controllers/Auth/EmailVerificationNotificationController.php
rename to Modules/Blog/app/Http/Controllers/Auth/EmailVerificationNotificationController.php
index 79b3f43..d3fc1d6 100644
--- a/app/Http/Controllers/Auth/EmailVerificationNotificationController.php
+++ b/Modules/Blog/app/Http/Controllers/Auth/EmailVerificationNotificationController.php
@@ -3,7 +3,7 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
-use App\Providers\RouteServiceProvider;
+use App\Providers\AppServiceProvider;
use Illuminate\Http\Request;
class EmailVerificationNotificationController extends Controller
@@ -11,13 +11,12 @@ class EmailVerificationNotificationController extends Controller
/**
* Send a new email verification notification.
*
- * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
if ($request->user()->hasVerifiedEmail()) {
- return redirect()->intended(RouteServiceProvider::HOME);
+ return redirect()->intended(AppServiceProvider::HOME);
}
$request->user()->sendEmailVerificationNotification();
diff --git a/Modules/Blog/app/Http/Controllers/Auth/EmailVerificationPromptController.php b/Modules/Blog/app/Http/Controllers/Auth/EmailVerificationPromptController.php
new file mode 100644
index 0000000..383445c
--- /dev/null
+++ b/Modules/Blog/app/Http/Controllers/Auth/EmailVerificationPromptController.php
@@ -0,0 +1,22 @@
+user()->hasVerifiedEmail()
+ ? redirect()->intended(AppServiceProvider::HOME)
+ : view('auth.verify-email');
+ }
+}
diff --git a/app/Http/Controllers/Auth/NewPasswordController.php b/Modules/Blog/app/Http/Controllers/Auth/NewPasswordController.php
similarity index 86%
rename from app/Http/Controllers/Auth/NewPasswordController.php
rename to Modules/Blog/app/Http/Controllers/Auth/NewPasswordController.php
index cb881f3..bd94e9a 100644
--- a/app/Http/Controllers/Auth/NewPasswordController.php
+++ b/Modules/Blog/app/Http/Controllers/Auth/NewPasswordController.php
@@ -4,19 +4,19 @@
use App\Http\Controllers\Controller;
use Illuminate\Auth\Events\PasswordReset;
+use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
+use Illuminate\View\View;
class NewPasswordController extends Controller
{
/**
* Display the password reset view.
- *
- * @return \Illuminate\View\View
*/
- public function create(Request $request)
+ public function create(Request $request): View
{
return view('auth.reset-password', ['request' => $request]);
}
@@ -24,12 +24,10 @@ public function create(Request $request)
/**
* Handle an incoming new password request.
*
- * @param \Illuminate\Http\Request $request
- * @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
- public function store(Request $request)
+ public function store(Request $request): RedirectResponse
{
$request->validate([
'token' => 'required',
@@ -58,6 +56,6 @@ function ($user) use ($request) {
return $status == Password::PASSWORD_RESET
? redirect()->route('login')->with('status', __($status))
: back()->withInput($request->only('email'))
- ->withErrors(['email' => __($status)]);
+ ->withErrors(['email' => __($status)]);
}
}
diff --git a/app/Http/Controllers/Auth/PasswordResetLinkController.php b/Modules/Blog/app/Http/Controllers/Auth/PasswordResetLinkController.php
similarity index 83%
rename from app/Http/Controllers/Auth/PasswordResetLinkController.php
rename to Modules/Blog/app/Http/Controllers/Auth/PasswordResetLinkController.php
index 2973509..95317f0 100644
--- a/app/Http/Controllers/Auth/PasswordResetLinkController.php
+++ b/Modules/Blog/app/Http/Controllers/Auth/PasswordResetLinkController.php
@@ -3,17 +3,17 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
+use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
+use Illuminate\View\View;
class PasswordResetLinkController extends Controller
{
/**
* Display the password reset link request view.
- *
- * @return \Illuminate\View\View
*/
- public function create()
+ public function create(): View
{
return view('auth.forgot-password');
}
@@ -21,12 +21,10 @@ public function create()
/**
* Handle an incoming password reset link request.
*
- * @param \Illuminate\Http\Request $request
- * @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
- public function store(Request $request)
+ public function store(Request $request): RedirectResponse
{
$request->validate([
'email' => 'required|email',
diff --git a/Modules/Blog/app/Http/Controllers/Auth/RegisteredUserController.php b/Modules/Blog/app/Http/Controllers/Auth/RegisteredUserController.php
new file mode 100644
index 0000000..92dec63
--- /dev/null
+++ b/Modules/Blog/app/Http/Controllers/Auth/RegisteredUserController.php
@@ -0,0 +1,61 @@
+validate([
+ 'first_name' => 'required|string|max:191',
+ 'last_name' => 'required|string|max:191',
+ 'email' => 'required|string|email|max:191|unique:users',
+ 'password' => 'required|string|confirmed|min:8',
+ ]);
+
+ $user = User::create([
+ 'first_name' => $request->first_name,
+ 'last_name' => $request->last_name,
+ 'name' => $request->first_name.' '.$request->last_name,
+ 'email' => $request->email,
+ 'password' => Hash::make($request->password),
+ ]);
+
+ // username
+ $username = config('app.initial_username') + $user->id;
+ $user->username = $username;
+ $user->save();
+
+ Auth::login($user);
+
+ event(new Registered($user));
+ event(new UserRegistered($user));
+
+ return redirect(AppServiceProvider::HOME);
+ }
+}
diff --git a/Modules/Blog/app/Http/Controllers/Auth/SocialLoginController.php b/Modules/Blog/app/Http/Controllers/Auth/SocialLoginController.php
new file mode 100644
index 0000000..9c8b5ab
--- /dev/null
+++ b/Modules/Blog/app/Http/Controllers/Auth/SocialLoginController.php
@@ -0,0 +1,133 @@
+redirectTo;
+
+ if ($redirectTo) {
+ return $redirectTo;
+ } else {
+ return AppServiceProvider::HOME;
+ }
+ }
+
+ /**
+ * Redirect the user to the Provider (Facebook, Google, GitHub...) authentication page.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function redirectToProvider($provider)
+ {
+ return Socialite::driver($provider)->redirect();
+ }
+
+ /**
+ * Obtain the user information from Provider (Facebook, Google, GitHub...).
+ */
+ public function handleProviderCallback($provider): RedirectResponse
+ {
+ try {
+ $user = Socialite::driver($provider)->user();
+
+ $authUser = $this->findOrCreateUser($user, $provider);
+
+ Auth::login($authUser, true);
+ } catch (Exception $e) {
+ return redirect('/');
+ }
+
+ return redirect()->intended(AppServiceProvider::HOME);
+ }
+
+ /**
+ * Return user if exists; create and return if doesn't.
+ *
+ * @param $githubUser
+ */
+ private function findOrCreateUser($socialUser, $provider): User
+ {
+ if ($authUser = UserProvider::where('provider_id', $socialUser->getId())->first()) {
+ $authUser = User::findOrFail($authUser->user->id);
+
+ return $authUser;
+ } elseif ($authUser = User::where('email', $socialUser->getEmail())->first()) {
+ UserProvider::create([
+ 'user_id' => $authUser->id,
+ 'provider_id' => $socialUser->getId(),
+ 'avatar' => $socialUser->getAvatar(),
+ 'provider' => $provider,
+ ]);
+
+ return $authUser;
+ } else {
+ $name = $socialUser->getName();
+
+ $name_parts = $this->split_name($name);
+ $first_name = $name_parts[0];
+ $last_name = $name_parts[1];
+ $email = $socialUser->getEmail();
+
+ if ($email == '') {
+ Log::error('Social Login does not have email!');
+
+ flash('Email address is required!')->error()->important();
+
+ return redirect()->intended(AppServiceProvider::HOME);
+ }
+
+ $user = User::create([
+ 'first_name' => $first_name,
+ 'last_name' => $last_name,
+ 'name' => $name,
+ 'email' => $email,
+ ]);
+
+ $media = $user->addMediaFromUrl($socialUser->getAvatar())->toMediaCollection('users');
+ $user->avatar = $media->getUrl();
+ $user->save();
+
+ event(new UserRegistered($user));
+
+ UserProvider::create([
+ 'user_id' => $user->id,
+ 'provider_id' => $socialUser->getId(),
+ 'avatar' => $socialUser->getAvatar(),
+ 'provider' => $provider,
+ ]);
+
+ return $user;
+ }
+ }
+
+ /**
+ * Split Name into first name and last name
+ */
+ public function split_name($name)
+ {
+ $name = trim($name);
+
+ $last_name = (strpos($name, ' ') === false) ? '' : preg_replace('#.*\s([\w-]*)$#', '$1', $name);
+ $first_name = trim(preg_replace('#'.$last_name.'#', '', $name));
+
+ return [$first_name, $last_name];
+ }
+}
diff --git a/Modules/Blog/app/Http/Controllers/Auth/VerifyEmailController.php b/Modules/Blog/app/Http/Controllers/Auth/VerifyEmailController.php
new file mode 100644
index 0000000..c93b024
--- /dev/null
+++ b/Modules/Blog/app/Http/Controllers/Auth/VerifyEmailController.php
@@ -0,0 +1,28 @@
+user()->hasVerifiedEmail()) {
+ return redirect()->intended(AppServiceProvider::HOME.'?verified=1');
+ }
+
+ if ($request->user()->markEmailAsVerified()) {
+ event(new Verified($request->user()));
+ }
+
+ return redirect()->intended(AppServiceProvider::HOME.'?verified=1');
+ }
+}
diff --git a/app/Http/Controllers/Backend/BackendBaseController.php b/Modules/Blog/app/Http/Controllers/Backend/BackendBaseController.php
similarity index 77%
rename from app/Http/Controllers/Backend/BackendBaseController.php
rename to Modules/Blog/app/Http/Controllers/Backend/BackendBaseController.php
index 83dca33..4f587c0 100644
--- a/app/Http/Controllers/Backend/BackendBaseController.php
+++ b/Modules/Blog/app/Http/Controllers/Backend/BackendBaseController.php
@@ -5,10 +5,13 @@
use App\Authorizable;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
+use Illuminate\Http\JsonResponse;
+use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
+use Illuminate\View\View;
use Yajra\DataTables\DataTables;
class BackendBaseController extends Controller
@@ -35,10 +38,8 @@ public function __construct()
/**
* Display a listing of the resource.
- *
- * @return Response
*/
- public function index()
+ public function index(): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -61,11 +62,8 @@ public function index()
/**
* Select Options for Select 2 Request/ Response.
- *
- * @return Response
*/
-
- public function index_list(Request $request)
+ public function index_list(Request $request): JsonResponse
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -88,7 +86,7 @@ public function index_list(Request $request)
foreach ($query_data as $row) {
$$module_name[] = [
- 'id' => $row->id,
+ 'id' => $row->id,
'text' => $row->name.' (Slug: '.$row->slug.')',
];
}
@@ -115,34 +113,32 @@ public function index_data()
$data = $$module_name;
return Datatables::of($$module_name)
- ->addColumn('action', function ($data) {
- $module_name = $this->module_name;
-
- return view('backend.includes.action_column', compact('module_name', 'data'));
- })
- ->editColumn('name', '{{$name}}')
- ->editColumn('updated_at', function ($data) {
- $module_name = $this->module_name;
-
- $diff = Carbon::now()->diffInHours($data->updated_at);
-
- if ($diff < 25) {
- return $data->updated_at->diffForHumans();
- } else {
- return $data->updated_at->isoFormat('llll');
- }
- })
- ->rawColumns(['name', 'action'])
- ->orderColumns(['id'], '-:column $1')
- ->make(true);
+ ->addColumn('action', function ($data) {
+ $module_name = $this->module_name;
+
+ return view('backend.includes.action_column', compact('module_name', 'data'));
+ })
+ ->editColumn('name', '{{$name}}')
+ ->editColumn('updated_at', function ($data) {
+ $module_name = $this->module_name;
+
+ $diff = Carbon::now()->diffInHours($data->updated_at);
+
+ if ($diff < 25) {
+ return $data->updated_at->diffForHumans();
+ } else {
+ return $data->updated_at->isoFormat('llll');
+ }
+ })
+ ->rawColumns(['name', 'action'])
+ ->orderColumns(['id'], '-:column $1')
+ ->make(true);
}
/**
* Show the form for creating a new resource.
- *
- * @return Response
*/
- public function create()
+ public function create(): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -163,12 +159,8 @@ public function create()
/**
* Store a newly created resource in storage.
- *
- * @param Request $request
- *
- * @return Response
*/
- public function store(Request $request)
+ public function store(Request $request): RedirectResponse
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -183,19 +175,15 @@ public function store(Request $request)
flash(" New '".Str::singular($module_title)."' Added")->success()->important();
- logUserAccess($module_title.' '.$module_action. " | Id: ". $$module_name_singular->id);
+ logUserAccess($module_title.' '.$module_action.' | Id: '.$$module_name_singular->id);
return redirect("admin/$module_name");
}
/**
* Display the specified resource.
- *
- * @param int $id
- *
- * @return Response
*/
- public function show($id)
+ public function show(int $id): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -208,7 +196,7 @@ public function show($id)
$$module_name_singular = $module_model::findOrFail($id);
- logUserAccess($module_title.' '.$module_action. " | Id: ". $$module_name_singular->id);
+ logUserAccess($module_title.' '.$module_action.' | Id: '.$$module_name_singular->id);
return view(
"$module_path.$module_name.show",
@@ -218,12 +206,8 @@ public function show($id)
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- *
- * @return Response
*/
- public function edit($id)
+ public function edit(int $id): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -236,7 +220,7 @@ public function edit($id)
$$module_name_singular = $module_model::findOrFail($id);
- logUserAccess($module_title.' '.$module_action. " | Id: ". $$module_name_singular->id);
+ logUserAccess($module_title.' '.$module_action.' | Id: '.$$module_name_singular->id);
return view(
"$module_path.$module_name.edit",
@@ -246,13 +230,8 @@ public function edit($id)
/**
* Update the specified resource in storage.
- *
- * @param Request $request
- * @param int $id
- *
- * @return Response
*/
- public function update(Request $request, $id)
+ public function update(Request $request, int $id): RedirectResponse
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -269,19 +248,15 @@ public function update(Request $request, $id)
flash(" '".Str::singular($module_title)."' Updated Successfully")->success()->important();
- logUserAccess($module_title.' '.$module_action. " | Id: ". $$module_name_singular->id);
+ logUserAccess($module_title.' '.$module_action.' | Id: '.$$module_name_singular->id);
return redirect()->back();
}
/**
* Remove the specified resource from storage.
- *
- * @param int $id
- *
- * @return Response
*/
- public function destroy($id)
+ public function destroy(int $id): RedirectResponse
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -298,7 +273,7 @@ public function destroy($id)
flash(' '.label_case($module_name_singular).' Deleted Successfully!')->success()->important();
- logUserAccess($module_title.' '.$module_action. " | Id: ". $$module_name_singular->id);
+ logUserAccess($module_title.' '.$module_action.' | Id: '.$$module_name_singular->id);
return redirect("admin/$module_name");
}
@@ -306,10 +281,8 @@ public function destroy($id)
/**
* List of trashed ertries
* works if the softdelete is enabled.
- *
- * @return Response
*/
- public function trashed()
+ public function trashed(): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -333,12 +306,9 @@ public function trashed()
/**
* Restore a soft deleted entry.
*
- * @param Request $request
- * @param int $id
- *
- * @return Response
+ * @param Request $request
*/
- public function restore($id)
+ public function restore(int $id): RedirectResponse
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -354,7 +324,7 @@ public function restore($id)
flash(' '.label_case($module_name_singular).' Data Restoreded Successfully!')->success()->important();
- logUserAccess($module_title.' '.$module_action. " | Id: ". $$module_name_singular->id);
+ logUserAccess($module_title.' '.$module_action.' | Id: '.$$module_name_singular->id);
return redirect("admin/$module_name");
}
diff --git a/app/Http/Controllers/Backend/BackendController.php b/Modules/Blog/app/Http/Controllers/Backend/BackendController.php
similarity index 75%
rename from app/Http/Controllers/Backend/BackendController.php
rename to Modules/Blog/app/Http/Controllers/Backend/BackendController.php
index 541e9e5..eec2a1f 100644
--- a/app/Http/Controllers/Backend/BackendController.php
+++ b/Modules/Blog/app/Http/Controllers/Backend/BackendController.php
@@ -3,15 +3,14 @@
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
+use Illuminate\View\View;
class BackendController extends Controller
{
/**
* Show the application dashboard.
- *
- * @return \Illuminate\Http\Response
*/
- public function index()
+ public function index(): View
{
return view('backend.index');
}
diff --git a/app/Http/Controllers/Backend/BackupController.php b/Modules/Blog/app/Http/Controllers/Backend/BackupController.php
similarity index 81%
rename from app/Http/Controllers/Backend/BackupController.php
rename to Modules/Blog/app/Http/Controllers/Backend/BackupController.php
index 6544df8..a5fd935 100644
--- a/app/Http/Controllers/Backend/BackupController.php
+++ b/Modules/Blog/app/Http/Controllers/Backend/BackupController.php
@@ -6,7 +6,9 @@
use App\Http\Controllers\Controller;
use Artisan;
use Carbon\Carbon;
+use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Str;
+use Illuminate\View\View;
use Log;
use Storage;
@@ -31,10 +33,8 @@ public function __construct()
/**
* Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
*/
- public function index()
+ public function index(): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -55,13 +55,13 @@ public function index()
// only take the zip files into account
if (substr($f, -4) == '.zip' && $disk->exists($f)) {
$$module_name[] = [
- 'file_path' => $f,
- 'file_name' => str_replace(str_replace(' ', '-', config('backup.backup.name')).'/', '', $f),
- 'file_size_byte' => $disk->size($f),
- 'file_size' => humanFilesize($disk->size($f)),
+ 'file_path' => $f,
+ 'file_name' => str_replace(str_replace(' ', '-', config('backup.backup.name')).'/', '', $f),
+ 'file_size_byte' => $disk->size($f),
+ 'file_size' => humanFilesize($disk->size($f)),
'last_modified_timestamp' => $disk->lastModified($f),
- 'date_created' => Carbon::createFromTimestamp($disk->lastModified($f))->isoFormat('llll'),
- 'date_ago' => Carbon::createFromTimestamp($disk->lastModified($f))->diffForHumans(Carbon::now()),
+ 'date_created' => Carbon::createFromTimestamp($disk->lastModified($f))->isoFormat('llll'),
+ 'date_ago' => Carbon::createFromTimestamp($disk->lastModified($f))->diffForHumans(Carbon::now()),
];
}
}
@@ -79,8 +79,7 @@ public function index()
/**
* Store a newly created resource in storage.
*
- * @param \Illuminate\Http\Request $request
- *
+ * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function create()
@@ -120,8 +119,8 @@ public function download($file_name)
return \Response::stream(function () use ($stream) {
fpassthru($stream);
}, 200, [
- 'Content-Type' => $fs->getMimetype($file),
- 'Content-Length' => $fs->getSize($file),
+ 'Content-Type' => $fs->getMimetype($file),
+ 'Content-Length' => $fs->getSize($file),
'Content-disposition' => 'attachment; filename="'.basename($file).'"',
]);
} else {
@@ -132,7 +131,7 @@ public function download($file_name)
/**
* Deletes a backup file.
*/
- public function delete($file_name)
+ public function delete($file_name): RedirectResponse
{
$disk = Storage::disk(config('backup.backup.destination.disks')[0]);
diff --git a/Modules/Blog/app/Http/Controllers/Backend/LanguageController.php b/Modules/Blog/app/Http/Controllers/Backend/LanguageController.php
new file mode 100644
index 0000000..e79c40f
--- /dev/null
+++ b/Modules/Blog/app/Http/Controllers/Backend/LanguageController.php
@@ -0,0 +1,25 @@
+setLocale($language);
+
+ session()->put('locale', $language);
+
+ setlocale(LC_TIME, $language);
+
+ Carbon::setLocale($language);
+
+ flash()->success(__('oa_locales.messages.success_chang').' '.__('oa_locales.names.'.$language))->important();
+
+ return redirect()->back();
+ }
+}
diff --git a/app/Http/Controllers/Backend/NotificationsController.php b/Modules/Blog/app/Http/Controllers/Backend/NotificationsController.php
similarity index 94%
rename from app/Http/Controllers/Backend/NotificationsController.php
rename to Modules/Blog/app/Http/Controllers/Backend/NotificationsController.php
index ce627f6..7b05645 100644
--- a/app/Http/Controllers/Backend/NotificationsController.php
+++ b/Modules/Blog/app/Http/Controllers/Backend/NotificationsController.php
@@ -9,6 +9,7 @@
use Flash;
use Illuminate\Http\Response;
use Illuminate\Support\Str;
+use Illuminate\View\View;
use Log;
class NotificationsController extends Controller
@@ -33,10 +34,8 @@ public function __construct()
/**
* Display a listing of the resource.
- *
- * @return Response
*/
- public function index()
+ public function index(): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -60,12 +59,8 @@ public function index()
/**
* Display the specified resource.
- *
- * @param int $id
- *
- * @return Response
*/
- public function show($id)
+ public function show(int $id): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -99,11 +94,9 @@ public function show($id)
/**
* Delete All the Notifications
*
- * @param int $id
- *
- * @return Response
+ * @param int $id
*/
- public function deleteAll()
+ public function deleteAll(): Response
{
$module_title = $this->module_title;
$module_name = $this->module_name;
diff --git a/app/Http/Controllers/Backend/RolesController.php b/Modules/Blog/app/Http/Controllers/Backend/RolesController.php
similarity index 90%
rename from app/Http/Controllers/Backend/RolesController.php
rename to Modules/Blog/app/Http/Controllers/Backend/RolesController.php
index 2b58ba2..62f6874 100644
--- a/app/Http/Controllers/Backend/RolesController.php
+++ b/Modules/Blog/app/Http/Controllers/Backend/RolesController.php
@@ -7,8 +7,10 @@
use App\Models\Permission;
use App\Models\Role;
use Flash;
+use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
+use Illuminate\View\View;
use Log;
class RolesController extends Controller
@@ -35,10 +37,8 @@ public function __construct()
/**
* Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
*/
- public function index()
+ public function index(): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -61,10 +61,8 @@ public function index()
/**
* Show the form for creating a new resource.
- *
- * @return \Illuminate\Http\Response
*/
- public function create()
+ public function create(): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -85,12 +83,8 @@ public function create()
/**
* Store a newly created resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- *
- * @return \Illuminate\Http\Response
*/
- public function store(Request $request)
+ public function store(Request $request): RedirectResponse
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -120,12 +114,8 @@ public function store(Request $request)
/**
* Display the specified resource.
- *
- * @param int $id
- *
- * @return \Illuminate\Http\Response
*/
- public function show($id)
+ public function show(int $id): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -148,12 +138,8 @@ public function show($id)
/**
* Show the form for editing the specified resource.
- *
- * @param int $id
- *
- * @return \Illuminate\Http\Response
*/
- public function edit($id)
+ public function edit(int $id): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -175,13 +161,8 @@ public function edit($id)
/**
* Update the specified resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @param int $id
- *
- * @return \Illuminate\Http\Response
*/
- public function update(Request $request, $id)
+ public function update(Request $request, int $id): RedirectResponse
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -195,7 +176,7 @@ public function update(Request $request, $id)
$$module_name_singular = $module_model::findOrFail($id);
$this->validate($request, [
- 'name' => 'required|max:20|unique:roles,name,'.$id,
+ 'name' => 'required|max:20|unique:roles,name,'.$id,
'permissions' => 'required',
]);
@@ -221,12 +202,8 @@ public function update(Request $request, $id)
/**
* Remove the specified resource from storage.
- *
- * @param int $id
- *
- * @return \Illuminate\Http\Response
*/
- public function destroy($id)
+ public function destroy(int $id): RedirectResponse
{
$module_title = $this->module_title;
$module_name = $this->module_name;
diff --git a/app/Http/Controllers/Backend/SettingController.php b/Modules/Blog/app/Http/Controllers/Backend/SettingController.php
similarity index 92%
rename from app/Http/Controllers/Backend/SettingController.php
rename to Modules/Blog/app/Http/Controllers/Backend/SettingController.php
index b8c8de8..f0c1b4d 100644
--- a/app/Http/Controllers/Backend/SettingController.php
+++ b/Modules/Blog/app/Http/Controllers/Backend/SettingController.php
@@ -5,8 +5,10 @@
use App\Http\Controllers\Controller;
use App\Models\Setting;
use Auth;
+use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
+use Illuminate\View\View;
use Log;
class SettingController extends Controller
@@ -31,10 +33,8 @@ public function __construct()
/**
* Display a listing of the resource.
- *
- * @return Response
*/
- public function index()
+ public function index(): View
{
$module_title = $this->module_title;
$module_name = $this->module_name;
@@ -55,7 +55,7 @@ public function index()
);
}
- public function store(Request $request)
+ public function store(Request $request): RedirectResponse
{
$rules = Setting::getValidationRules();
$data = $this->validate($request, $rules);
diff --git a/Modules/Blog/app/Http/Controllers/Backend/UserController.php b/Modules/Blog/app/Http/Controllers/Backend/UserController.php
new file mode 100644
index 0000000..3d10850
--- /dev/null
+++ b/Modules/Blog/app/Http/Controllers/Backend/UserController.php
@@ -0,0 +1,844 @@
+module_title = 'Users';
+
+ // module name
+ $this->module_name = 'users';
+
+ // directory path of the module
+ $this->module_path = 'users';
+
+ // module icon
+ $this->module_icon = 'c-icon cil-people';
+
+ // module model name, path
+ $this->module_model = "App\Models\User";
+ }
+
+ /**
+ * Display a listing of the resource.
+ */
+ public function index(): View
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'List';
+
+ $page_heading = ucfirst($module_title);
+ $title = $page_heading.' '.ucfirst($module_action);
+
+ $$module_name = $module_model::paginate();
+
+ Log::info("'$title' viewed by User:".auth()->user()->name.'(ID:'.auth()->user()->id.')');
+
+ return view(
+ "backend.$module_path.index_datatable",
+ compact('module_title', 'module_name', "$module_name", 'module_path', 'module_icon', 'module_action', 'module_name_singular', 'page_heading', 'title')
+ );
+ }
+
+ public function index_data()
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'List';
+
+ $$module_name = $module_model::select('id', 'name', 'username', 'email', 'email_verified_at', 'updated_at', 'status');
+
+ $data = $$module_name;
+
+ return Datatables::of($$module_name)
+ ->addColumn('action', function ($data) {
+ $module_name = $this->module_name;
+
+ return view('backend.includes.user_actions', compact('module_name', 'data'));
+ })
+ ->addColumn('user_roles', function ($data) {
+ $module_name = $this->module_name;
+
+ return view('backend.includes.user_roles', compact('module_name', 'data'));
+ })
+ ->editColumn('name', '{{$name}}')
+ ->editColumn('status', function ($data) {
+ $return_data = $data->status_label;
+ $return_data .= ' '.$data->confirmed_label;
+
+ return $return_data;
+ })
+ ->editColumn('updated_at', function ($data) {
+ $module_name = $this->module_name;
+
+ $diff = Carbon::now()->diffInHours($data->updated_at);
+
+ if ($diff < 25) {
+ return $data->updated_at->diffForHumans();
+ } else {
+ return $data->updated_at->isoFormat('LLLL');
+ }
+ })
+ ->rawColumns(['name', 'action', 'status', 'user_roles'])
+ ->orderColumns(['id'], '-:column $1')
+ ->make(true);
+ }
+
+ /**
+ * Select Options for Select 2 Request/ Response.
+ */
+ public function index_list(Request $request): JsonResponse
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'List';
+
+ $page_heading = label_case($module_title);
+ $title = $page_heading.' '.label_case($module_action);
+
+ $term = trim($request->q);
+
+ if (empty($term)) {
+ return response()->json([]);
+ }
+
+ $query_data = $module_model::where('name', 'LIKE', "%$term%")->orWhere('email', 'LIKE', "%$term%")->limit(10)->get();
+
+ $$module_name = [];
+
+ foreach ($query_data as $row) {
+ $$module_name[] = [
+ 'id' => $row->id,
+ 'text' => $row->name.' (Email: '.$row->email.')',
+ ];
+ }
+
+ return response()->json($$module_name);
+ }
+
+ /**
+ * Show the form for creating a new resource.
+ */
+ public function create(): View
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'Create';
+
+ $roles = Role::get();
+ $permissions = Permission::select('name', 'id')->get();
+
+ return view(
+ "backend.$module_name.create",
+ compact('module_title', 'module_name', 'module_path', 'module_icon', 'module_action', 'module_name_singular', 'roles', 'permissions')
+ );
+ }
+
+ /**
+ * Store a newly created resource in storage.
+ */
+ public function store(Request $request): RedirectResponse
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'Details';
+
+ $request->validate([
+ 'first_name' => 'required|min:3|max:191',
+ 'last_name' => 'required|min:3|max:191',
+ 'email' => 'email|unique:users',
+ 'password' => 'required|confirmed|min:4',
+ ]);
+
+ $data_array = $request->except('_token', 'roles', 'permissions', 'password_confirmation');
+ $data_array['name'] = $request->first_name.' '.$request->last_name;
+ $data_array['password'] = Hash::make($request->password);
+
+ if ($request->confirmed == 1) {
+ $data_array = Arr::add($data_array, 'email_verified_at', Carbon::now());
+ } else {
+ $data_array = Arr::add($data_array, 'email_verified_at', null);
+ }
+
+ $$module_name_singular = User::create($data_array);
+
+ $roles = $request['roles'];
+ $permissions = $request['permissions'];
+
+ // Sync Roles
+ if (isset($roles)) {
+ $$module_name_singular->syncRoles($roles);
+ } else {
+ $roles = [];
+ $$module_name_singular->syncRoles($roles);
+ }
+
+ // Sync Permissions
+ if (isset($permissions)) {
+ $$module_name_singular->syncPermissions($permissions);
+ } else {
+ $permissions = [];
+ $$module_name_singular->syncPermissions($permissions);
+ }
+
+ // Username
+ $id = $$module_name_singular->id;
+ $username = config('app.initial_username') + $id;
+ $$module_name_singular->username = $username;
+ $$module_name_singular->save();
+
+ event(new UserCreated($$module_name_singular));
+
+ Flash::success(" New '".Str::singular($module_title)."' Added")->important();
+
+ Log::info(label_case($module_title.' '.$module_action)." | '".$$module_name_singular->name.'(ID:'.$$module_name_singular->id.") ' by User:".auth()->user()->name.'(ID:'.auth()->user()->id.')');
+
+ return redirect("admin/$module_name");
+ }
+
+ /**
+ * Display the specified resource.
+ */
+ public function show(int $id): View
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'Show';
+
+ $$module_name_singular = $module_model::findOrFail($id);
+ $userprofile = Userprofile::where('user_id', $$module_name_singular->id)->first();
+
+ Log::info(label_case($module_title.' '.$module_action).' | User:'.auth()->user()->name.'(ID:'.auth()->user()->id.')');
+
+ return view(
+ "backend.$module_name.show",
+ compact('module_title', 'module_name', 'module_path', 'module_icon', 'module_action', 'module_name_singular', "$module_name_singular", 'userprofile')
+ );
+ }
+
+ /**
+ * Display Profile Details of Logged in user.
+ */
+ public function profile(Request $request, int $id): View
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+ $module_action = 'Profile Show';
+
+ $$module_name_singular = $module_model::with('roles', 'permissions')->findOrFail($id);
+
+ if ($$module_name_singular) {
+ $userprofile = Userprofile::where('user_id', $id)->first();
+ } else {
+ Log::error('UserProfile Exception for Username: '.$username);
+ abort(404);
+ }
+
+ Log::info(label_case($module_title.' '.$module_action).' | User:'.auth()->user()->name.'(ID:'.auth()->user()->id.')');
+
+ return view("backend.$module_name.profile", compact('module_name', 'module_name_singular', "$module_name_singular", 'module_icon', 'module_action', 'module_title', 'userprofile'));
+ }
+
+ /**
+ * Show the form for Profile Paeg Editing the specified resource.
+ */
+ public function profileEdit(int $id): View
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'Edit Profile';
+
+ if (! auth()->user()->can('edit_users')) {
+ $id = auth()->user()->id;
+ }
+
+ $$module_name_singular = $module_model::findOrFail($id);
+ $userprofile = Userprofile::where('user_id', $$module_name_singular->id)->first();
+
+ Log::info(label_case($module_title.' '.$module_action).' | User:'.auth()->user()->name.'(ID:'.auth()->user()->id.')');
+
+ return view(
+ "backend.$module_name.profileEdit",
+ compact('module_title', 'module_name', 'module_path', 'module_icon', 'module_action', 'module_name_singular', "$module_name_singular", 'userprofile')
+ );
+ }
+
+ /**
+ * Update the specified resource in storage.
+ */
+ public function profileUpdate(Request $request, int $id): RedirectResponse
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'Edit Profile';
+
+ $this->validate($request, [
+ 'avatar' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',
+ 'first_name' => 'required|min:3|max:191',
+ 'last_name' => 'required|min:3|max:191',
+ 'email' => 'email',
+ ]);
+
+ if (! auth()->user()->can('edit_users')) {
+ $id = auth()->user()->id;
+ }
+
+ $$module_name_singular = User::findOrFail($id);
+ $filename = $$module_name_singular->avatar;
+
+ // Handle Avatar upload
+ if ($request->hasFile('avatar')) {
+ if ($$module_name_singular->getMedia($module_name)->first()) {
+ $$module_name_singular->getMedia($module_name)->first()->delete();
+ }
+
+ $media = $$module_name_singular->addMediaFromRequest('avatar')->toMediaCollection($module_name);
+
+ $$module_name_singular->avatar = $media->getUrl();
+
+ $$module_name_singular->save();
+ }
+
+ $data_array = $request->except('avatar');
+ $data_array['avatar'] = $$module_name_singular->avatar;
+ $data_array['name'] = $request->first_name.' '.$request->last_name;
+
+ $user_profile = Userprofile::where('user_id', '=', $$module_name_singular->id)->first();
+ $user_profile->update($data_array);
+
+ event(new UserProfileUpdated($user_profile));
+
+ Flash::success(' '.label_case($module_name_singular).' Updated Successfully!')->important();
+
+ Log::info(label_case($module_title.' '.$module_action).' | User:'.auth()->user()->name.'(ID:'.auth()->user()->id.')');
+
+ return redirect(route('backend.users.profile', $$module_name_singular->id));
+ }
+
+ /**
+ * Show the form for Profile Paeg Editing the specified resource.
+ */
+ public function changeProfilePassword(int $id): View
+ {
+ if (! auth()->user()->can('edit_users')) {
+ $id = auth()->user()->id;
+ }
+
+ $title = $this->module_title;
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_name_singular = Str::singular($this->module_name);
+ $module_icon = $this->module_icon;
+ $module_action = 'Edit';
+
+ $$module_name_singular = User::findOrFail($id);
+
+ return view("backend.$module_name.changeProfilePassword", compact('module_name', 'module_title', "$module_name_singular", 'module_icon', 'module_action'));
+ }
+
+ /**
+ * Update the specified resource in storage.
+ */
+ public function changeProfilePasswordUpdate(Request $request, int $id): RedirectResponse
+ {
+ $this->validate($request, [
+ 'password' => 'required|confirmed|min:6',
+ ]);
+
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ if (! auth()->user()->can('edit_users')) {
+ $id = auth()->user()->id;
+ }
+
+ $$module_name_singular = User::findOrFail($id);
+
+ $request_data = $request->only('password');
+ $request_data['password'] = Hash::make($request_data['password']);
+
+ $$module_name_singular->update($request_data);
+
+ Flash::success(icon()." '".Str::singular($module_title)."' Updated Successfully")->important();
+
+ return redirect("admin/$module_name/profile/$id");
+ }
+
+ /**
+ * Show the form for Profile Paeg Editing the specified resource.
+ */
+ public function changePassword(int $id): View
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'Change Password';
+
+ $page_heading = label_case($module_title);
+ $title = $page_heading.' '.label_case($module_action);
+
+ if (! auth()->user()->can('edit_users')) {
+ $id = auth()->user()->id;
+ }
+
+ $$module_name_singular = $module_model::findOrFail($id);
+
+ return view(
+ "backend.$module_name.changePassword",
+ compact('module_title', 'module_name', 'module_path', 'module_icon', 'module_action', 'module_name_singular', "$module_name_singular")
+ );
+ }
+
+ /**
+ * Update the specified resource in storage.
+ */
+ public function changePasswordUpdate(Request $request, int $id): RedirectResponse
+ {
+ $this->validate($request, [
+ 'password' => 'required|confirmed|min:6',
+ ]);
+
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ if (! auth()->user()->can('edit_users')) {
+ $id = auth()->user()->id;
+ }
+
+ $$module_name_singular = User::findOrFail($id);
+
+ $request_data = $request->only('password');
+ $request_data['password'] = Hash::make($request_data['password']);
+
+ $$module_name_singular->update($request_data);
+
+ Flash::success(" '".Str::singular($module_title)."' Updated Successfully")->important();
+
+ return redirect("admin/$module_name");
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ */
+ public function edit(int $id): View
+ {
+ if (! auth()->user()->can('edit_users')) {
+ abort(404);
+ }
+
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'Edit';
+
+ $$module_name_singular = $module_model::findOrFail($id);
+
+ $userRoles = $$module_name_singular->roles->pluck('name')->all();
+ $userPermissions = $$module_name_singular->permissions->pluck('name')->all();
+
+ $roles = Role::get();
+ $permissions = Permission::select('name', 'id')->get();
+
+ Log::info(label_case($module_title.' '.$module_action)." | '".$$module_name_singular->name.'(ID:'.$$module_name_singular->id.") ' by User:".auth()->user()->name.'(ID:'.auth()->user()->id.')');
+
+ return view(
+ "backend.$module_name.edit",
+ compact('module_title', 'module_name', 'module_path', 'module_icon', 'module_action', 'module_name_singular', "$module_name_singular", 'roles', 'permissions', 'userRoles', 'userPermissions')
+ );
+ }
+
+ /**
+ * Update the specified resource in storage.
+ */
+ public function update(Request $request, int $id): RedirectResponse
+ {
+ if (! auth()->user()->can('edit_users')) {
+ abort(404);
+ }
+
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'Update';
+
+ $request->validate([
+ 'first_name' => 'required|min:3|max:191',
+ 'last_name' => 'required|min:3|max:191',
+ 'url_website' => 'nullable|min:3|max:191',
+ 'url_facebook' => 'nullable|min:3|max:191',
+ 'url_twitter' => 'nullable|min:3|max:191',
+ 'url_instagram' => 'nullable|min:3|max:191',
+ 'url_linkedin' => 'nullable|min:3|max:191',
+ ]);
+
+ $$module_name_singular = User::findOrFail($id);
+
+ $$module_name_singular->update($request->except(['roles', 'permissions']));
+
+ if ($id == 1) {
+ $user->syncRoles(['super admin']);
+
+ return redirect("admin/$module_name")->with('flash_success', 'Update successful!');
+ }
+
+ $roles = $request['roles'];
+ $permissions = $request['permissions'];
+
+ // Sync Roles
+ if (isset($roles)) {
+ $$module_name_singular->syncRoles($roles);
+ } else {
+ $roles = [];
+ $$module_name_singular->syncRoles($roles);
+ }
+
+ // Sync Permissions
+ if (isset($permissions)) {
+ $$module_name_singular->syncPermissions($permissions);
+ } else {
+ $permissions = [];
+ $$module_name_singular->syncPermissions($permissions);
+ }
+
+ event(new UserUpdated($$module_name_singular));
+
+ Flash::success(" '".Str::singular($module_title)."' Updated Successfully")->important();
+
+ Log::info(label_case($module_title.' '.$module_action)." | '".$$module_name_singular->name.'(ID:'.$$module_name_singular->id.") ' by User:".auth()->user()->name.'(ID:'.auth()->user()->id.')');
+
+ return redirect("admin/$module_name");
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ */
+ public function destroy(int $id): RedirectResponse
+ {
+ if (auth()->user()->id == $id || $id == 1) {
+ Flash::warning(" You can not delete this user!")->important();
+
+ Log::notice(label_case($module_title.' '.$module_action).' Failed | User:'.auth()->user()->name.'(ID:'.auth()->user()->id.')');
+ }
+
+ $module_name = $this->module_name;
+ $module_name_singular = Str::singular($this->module_name);
+ $module_path = $this->module_path;
+ $module_model = $this->module_model;
+
+ $module_action = 'destroy';
+
+ $$module_name_singular = $module_model::findOrFail($id);
+
+ $$module_name_singular->delete();
+
+ event(new UserUpdated($$module_name_singular));
+
+ flash(' '.$$module_name_singular->name.' User Successfully Deleted!')->success();
+
+ Log::info(label_case($module_action)." '$module_name': '".$$module_name_singular->name.', ID:'.$$module_name_singular->id." ' by User:".auth()->user()->name);
+
+ return redirect("admin/$module_name");
+ }
+
+ /**
+ * List of trashed ertries
+ * works if the softdelete is enabled.
+ */
+ public function trashed(): View
+ {
+ $module_name = $this->module_name;
+ $module_title = $this->module_title;
+ $module_name_singular = Str::singular($this->module_name);
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+
+ $module_action = 'List';
+ $page_heading = $module_title;
+
+ $$module_name = $module_model::onlyTrashed()->orderBy('deleted_at', 'desc')->paginate();
+
+ Log::info(label_case($module_action).' '.label_case($module_name).' by User:'.auth()->user()->name);
+
+ return view(
+ "backend.$module_name.trash",
+ compact('module_name', 'module_title', "$module_name", 'module_icon', 'page_heading', 'module_action')
+ );
+ }
+
+ /**
+ * Restore a soft deleted entry.
+ *
+ * @param Request $request
+ */
+ public function restore(int $id): RedirectResponse
+ {
+ $module_name = $this->module_name;
+ $module_title = $this->module_title;
+ $module_name_singular = Str::singular($this->module_name);
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+
+ $module_action = 'Restore';
+
+ $$module_name_singular = $module_model::withTrashed()->find($id);
+ $$module_name_singular->restore();
+
+ event(new UserUpdated($$module_name_singular));
+
+ flash(' '.$$module_name_singular->name.' Successfully Restoreded!')->success();
+
+ Log::info(label_case($module_action)." '$module_name': '".$$module_name_singular->name.', ID:'.$$module_name_singular->id." ' by User:".auth()->user()->name);
+
+ return redirect("admin/$module_name");
+ }
+
+ /**
+ * Block Any Specific User.
+ *
+ * @param int $id User Id
+ * @return Back To Previous Page
+ */
+ public function block(int $id): RedirectResponse
+ {
+ $module_name = $this->module_name;
+ $module_title = $this->module_title;
+ $module_name_singular = Str::singular($this->module_name);
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+
+ $module_action = 'Block';
+
+ if (auth()->user()->id == $id || $id == 1) {
+ Flash::warning(" You can not 'Block' this user!")->important();
+
+ Log::notice(label_case($module_title.' '.$module_action).' Failed | User:'.auth()->user()->name.'(ID:'.auth()->user()->id.')');
+ }
+
+ $$module_name_singular = User::withTrashed()->find($id);
+ // $$module_name_singular = $this->findOrThrowException($id);
+
+ try {
+ $$module_name_singular->status = 2;
+ $$module_name_singular->save();
+
+ event(new UserUpdated($$module_name_singular));
+
+ flash(' '.$$module_name_singular->name.' User Successfully Blocked!')->success();
+
+ return redirect()->back();
+ } catch (\Exception $e) {
+ throw new GeneralException('There was a problem updating this user. Please try again.');
+ }
+ }
+
+ /**
+ * Unblock Any Specific User.
+ *
+ * @param int $id User Id
+ * @return Back To Previous Page
+ */
+ public function unblock(int $id): RedirectResponse
+ {
+ $module_name = $this->module_name;
+ $module_title = $this->module_title;
+ $module_name_singular = Str::singular($this->module_name);
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+
+ $module_action = 'Unblock';
+
+ if (auth()->user()->id == $id || $id == 1) {
+ Flash::warning(" You can not 'Unblock' this user!")->important();
+
+ Log::notice(label_case($module_title.' '.$module_action).' Failed | User:'.auth()->user()->name.'(ID:'.auth()->user()->id.')');
+ }
+
+ $$module_name_singular = User::withTrashed()->find($id);
+
+ try {
+ $$module_name_singular->status = 1;
+ $$module_name_singular->save();
+
+ event(new UserUpdated($$module_name_singular));
+
+ flash(' '.$$module_name_singular->name.' User Successfully Unblocked!')->success();
+
+ Log::notice(label_case($module_title.' '.$module_action).' Success | User:'.auth()->user()->name.'(ID:'.auth()->user()->id.')');
+
+ return redirect()->back();
+ } catch (\Exception $e) {
+ flash(' There was a problem updating this user. Please try again.!')->error();
+
+ Log::error(label_case($module_title.' '.$module_action).' | User:'.auth()->user()->name.'(ID:'.auth()->user()->id.')');
+ Log::error($e);
+ }
+ }
+
+ /**
+ * Remove the Social Account attached with a User.
+ */
+ public function userProviderDestroy(Request $request): RedirectResponse
+ {
+ $user_provider_id = $request->user_provider_id;
+ $user_id = $request->user_id;
+
+ if (! $user_provider_id > 0 || ! $user_id > 0) {
+ flash('Invalid Request. Please try again.')->error();
+
+ return redirect()->back();
+ } else {
+ $user_provider = UserProvider::findOrFail($user_provider_id);
+
+ if ($user_id == $user_provider->user->id) {
+ $user_provider->delete();
+
+ flash(' Unlinked from User, "'.$user_provider->user->name.'"!')->success();
+
+ return redirect()->back();
+ } else {
+ flash(' Request rejected. Please contact the Administrator!')->warning();
+ }
+ }
+
+ event(new UserUpdated($$module_name_singular));
+
+ throw new GeneralException('There was a problem updating this user. Please try again.');
+ }
+
+ /**
+ * Resend Email Confirmation Code to User.
+ *
+ * @param [type] $hashid [description]
+ * @return [type] [description]
+ */
+ public function emailConfirmationResend($id): RedirectResponse
+ {
+ if ($id != auth()->user()->id) {
+ if (auth()->user()->hasAnyRole(['administrator', 'super admin'])) {
+ Log::info(auth()->user()->name.' ('.auth()->user()->id.') - User Requested for Email Verification.');
+ } else {
+ Log::warning(auth()->user()->name.' ('.auth()->user()->id.') - User trying to confirm another users email.');
+
+ abort('404');
+ }
+ }
+
+ $user = User::where('id', '=', $id)->first();
+
+ if ($user) {
+ if ($user->email_verified_at == null) {
+ Log::info($user->name.' ('.$user->id.') - User Requested for Email Verification.');
+
+ // Send Email To Registered User
+ $user->sendEmailVerificationNotification();
+
+ flash(' Email Sent! Please Check Your Inbox.')->success()->important();
+
+ return redirect()->back();
+ } else {
+ Log::info($user->name.' ('.$user->id.') - User Requested but Email already verified at.'.$user->email_verified_at);
+
+ flash($user->name.', You already confirmed your email address at '.$user->email_verified_at->isoFormat('LL'))->success()->important();
+
+ return redirect()->back();
+ }
+ }
+ }
+}
diff --git a/Modules/Blog/app/Http/Controllers/Controller.php b/Modules/Blog/app/Http/Controllers/Controller.php
new file mode 100644
index 0000000..ce1176d
--- /dev/null
+++ b/Modules/Blog/app/Http/Controllers/Controller.php
@@ -0,0 +1,15 @@
+module_title = 'Users';
+
+ // module name
+ $this->module_name = 'users';
+
+ // directory path of the module
+ $this->module_path = 'users';
+
+ // module icon
+ $this->module_icon = 'fas fa-users';
+
+ // module model name, path
+ $this->module_model = "App\Models\User";
+ }
+
+ /**
+ * Display the specified resource.
+ *
+ * @param int $id
+ */
+ public function show($username): View
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'Show';
+
+ $$module_name_singular = $module_model::where('username', 'LIKE', $username)->first();
+
+ $body_class = 'profile-page';
+
+ $meta_page_type = 'profile';
+
+ return view(
+ "frontend.$module_name.show",
+ compact('module_title', 'module_name', 'module_path', 'module_icon', 'module_action', 'module_name_singular', "$module_name_singular", 'body_class', 'meta_page_type')
+ );
+ }
+
+ /**
+ * Display Profile Details of Logged in user.
+ */
+ public function profile(int $id): View
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+ $module_action = 'Profile';
+
+ $$module_name_singular = $module_model::findOrFail($id);
+
+ if ($$module_name_singular) {
+ $userprofile = Userprofile::where('user_id', $id)->first();
+ } else {
+ Log::error('UserProfile Exception for Username: '.$username);
+ abort(404);
+ }
+
+ $body_class = 'profile-page';
+
+ $meta_page_type = 'profile';
+
+ return view("frontend.$module_name.profile", compact('module_name', 'module_name_singular', "$module_name_singular", 'module_icon', 'module_action', 'module_title', 'body_class', 'userprofile', 'meta_page_type'));
+ }
+
+ /**
+ * Show the form for Profile Paeg Editing the specified resource.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function profileEdit(int $id)
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+
+ $module_action = 'Edit Profile';
+
+ $page_heading = ucfirst($module_title);
+ $title = $page_heading.' '.ucfirst($module_action);
+
+ if (! auth()->user()->can('edit_users')) {
+ $id = auth()->user()->id;
+ }
+
+ if ($id != auth()->user()->id) {
+ return redirect()->route('frontend.users.profile', $id);
+ }
+
+ $$module_name_singular = $module_model::findOrFail($id);
+ $userprofile = Userprofile::where('user_id', $id)->first();
+
+ $body_class = 'profile-page';
+
+ return view(
+ "frontend.$module_name.profileEdit",
+ compact('module_title', 'module_name', 'module_path', 'module_icon', 'module_action', 'module_name_singular', "$module_name_singular", 'userprofile', 'body_class')
+ );
+ }
+
+ /**
+ * Update the specified resource in storage.
+ */
+ public function profileUpdate(Request $request, int $id): RedirectResponse
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+ $module_action = 'Profile Update';
+
+ if ($id != auth()->user()->id) {
+ return redirect()->route('frontend.users.profile', $id);
+ }
+
+ $this->validate($request, [
+ 'first_name' => 'required|string|max:191',
+ 'last_name' => 'required|string|max:191',
+ 'avatar' => 'image|mimes:jpeg,png,jpg,gif,svg|max:2048',
+ ]);
+
+ $module_name = $this->module_name;
+ $module_name_singular = Str::singular($this->module_name);
+
+ if (! auth()->user()->can('edit_users')) {
+ $id = auth()->user()->id;
+ $username = auth()->user()->username;
+ }
+
+ $$module_name_singular = $module_model::findOrFail($id);
+ $filename = $$module_name_singular->avatar;
+
+ // Handle Avatar upload
+ if ($request->hasFile('avatar')) {
+ if ($$module_name_singular->getMedia($module_name)->first()) {
+ $$module_name_singular->getMedia($module_name)->first()->delete();
+ }
+
+ $media = $$module_name_singular->addMedia($request->file('avatar'))->toMediaCollection($module_name);
+
+ $$module_name_singular->avatar = $media->getUrl();
+
+ $$module_name_singular->save();
+ }
+
+ $data_array = $request->except('avatar');
+ $data_array['avatar'] = $$module_name_singular->avatar;
+ $data_array['name'] = $request->first_name.' '.$request->last_name;
+
+ $user_profile = Userprofile::where('user_id', '=', $$module_name_singular->id)->first();
+ $user_profile->update($data_array);
+
+ event(new UserProfileUpdated($user_profile));
+
+ return redirect()->route('frontend.users.profile', $$module_name_singular->id)->with('flash_success', 'Update successful!');
+ }
+
+ /**
+ * Show the form for Profile Paeg Editing the specified resource.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function changePassword(int $id)
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+ $module_action = 'change Password';
+
+ $body_class = 'profile-page';
+
+ if ($id != auth()->user()->id) {
+ return redirect()->route('frontend.users.profile', $id);
+ }
+
+ $id = auth()->user()->id;
+
+ $$module_name_singular = $module_model::findOrFail($id);
+
+ $body_class = 'profile-page';
+
+ return view("frontend.$module_name.changePassword", compact('module_title', 'module_name', 'module_path', 'module_icon', 'module_action', 'module_name_singular', "$module_name_singular", 'body_class'));
+ }
+
+ /**
+ * Update the specified resource in storage.
+ *
+ * @param int $id
+ */
+ public function changePasswordUpdate(Request $request, $username): RedirectResponse
+ {
+ if ($id != auth()->user()->id) {
+ return redirect()->route('frontend.users.profile', $id);
+ }
+
+ $this->validate($request, [
+ 'password' => 'required|confirmed|min:6',
+ ]);
+
+ $module_name = $this->module_name;
+ $module_name_singular = Str::singular($this->module_name);
+
+ $$module_name_singular = auth()->user();
+
+ $request_data = $request->only('password');
+ $request_data['password'] = Hash::make($request_data['password']);
+
+ $$module_name_singular->update($request_data);
+
+ return redirect()->route('frontend.users.profile', auth()->user()->id)->with('flash_success', 'Update successful!');
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function edit(int $id)
+ {
+ $module_title = $this->module_title;
+ $module_name = $this->module_name;
+ $module_path = $this->module_path;
+ $module_icon = $this->module_icon;
+ $module_model = $this->module_model;
+ $module_name_singular = Str::singular($module_name);
+ $module_action = 'Edit';
+
+ if ($id != auth()->user()->id) {
+ return redirect()->route('frontend.users.profile', $id);
+ }
+
+ $roles = Role::get();
+ $permissions = Permission::select('name', 'id')->get();
+
+ $$module_name_singular = User::findOrFail($id);
+
+ $body_class = 'profile-page';
+
+ $userRoles = $$module_name_singular->roles->pluck('name')->all();
+ $userPermissions = $$module_name_singular->permissions->pluck('name')->all();
+
+ return view("frontend.$module_name.edit", compact('userRoles', 'userPermissions', 'module_name', "$module_name_singular", 'module_icon', 'module_action', 'title', 'roles', 'permissions', 'body_class'));
+ }
+
+ /**
+ * Update the specified resource in storage.
+ */
+ public function update(Request $request, int $id): RedirectResponse
+ {
+ $module_name = $this->module_name;
+ $module_name_singular = Str::singular($this->module_name);
+
+ if ($id != auth()->user()->id) {
+ return redirect()->route('frontend.users.profile', $id);
+ }
+
+ $$module_name_singular = User::findOrFail($id);
+
+ $$module_name_singular->update($request->except(['roles', 'permissions']));
+
+ if ($id == 1) {
+ $user->syncRoles(['administrator']);
+
+ return redirect("admin/$module_name")->with('flash_success', 'Update successful!');
+ }
+
+ $roles = $request['roles'];
+ $permissions = $request['permissions'];
+
+ // Sync Roles
+ if (isset($roles)) {
+ $$module_name_singular->syncRoles($roles);
+ } else {
+ $roles = [];
+ $$module_name_singular->syncRoles($roles);
+ }
+
+ // Sync Permissions
+ if (isset($permissions)) {
+ $$module_name_singular->syncPermissions($permissions);
+ } else {
+ $permissions = [];
+ $$module_name_singular->syncPermissions($permissions);
+ }
+
+ return redirect("admin/$module_name")->with('flash_success', 'Update successful!');
+ }
+
+ /**
+ * Remove the Social Account attached with a User.
+ */
+ public function userProviderDestroy(Request $request): RedirectResponse
+ {
+ $user_provider_id = $request->user_provider_id;
+ $user_id = $request->user_id;
+
+ if (! $user_provider_id > 0 || ! $user_id > 0) {
+ flash('Invalid Request. Please try again.')->error();
+
+ return redirect()->back();
+ } else {
+ $user_provider = UserProvider::findOrFail($user_provider_id);
+
+ if ($user_id == $user_provider->user->id) {
+ $user_provider->delete();
+
+ flash(' Unlinked from User, "'.$user_provider->user->name.'"!')->success();
+
+ return redirect()->back();
+ } else {
+ flash(' Request rejected. Please contact the Administrator!')->warning();
+ }
+ }
+
+ throw new GeneralException('There was a problem updating this user. Please try again.');
+ }
+
+ /**
+ * Resend Email Confirmation Code to User.
+ *
+ * @param [type] $hashid [description]
+ * @return [type] [description]
+ */
+ public function emailConfirmationResend($id): RedirectResponse
+ {
+ if ($id != auth()->user()->id) {
+ if (auth()->user()->hasAnyRole(['administrator', 'super admin'])) {
+ Log::info(auth()->user()->name.' ('.auth()->user()->id.') - User Requested for Email Verification.');
+ } else {
+ Log::warning(auth()->user()->name.' ('.auth()->user()->id.') - User trying to confirm another users email.');
+
+ abort('404');
+ }
+ }
+
+ $user = User::where('id', 'LIKE', $id)->first();
+
+ if ($user) {
+ if ($user->email_verified_at == null) {
+ Log::info($user->name.' ('.$user->id.') - User Requested for Email Verification.');
+
+ // Send Email To Registered User
+ $user->sendEmailVerificationNotification();
+
+ flash('Email Sent! Please Check Your Inbox.')->success()->important();
+
+ return redirect()->back();
+ } else {
+ Log::info($user->name.' ('.$user->id.') - User Requested but Email already verified at.'.$user->email_verified_at);
+
+ flash($user->name.', You already confirmed your email address at '.$user->email_verified_at->isoFormat('LL'))->success()->important();
+
+ return redirect()->back();
+ }
+ }
+ }
+}
diff --git a/app/Http/Controllers/MenueController.php b/Modules/Blog/app/Http/Controllers/MenueController.php
similarity index 75%
rename from app/Http/Controllers/MenueController.php
rename to Modules/Blog/app/Http/Controllers/MenueController.php
index 3b592c9..34d7f2a 100644
--- a/app/Http/Controllers/MenueController.php
+++ b/Modules/Blog/app/Http/Controllers/MenueController.php
@@ -2,8 +2,6 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-
class MenueController extends Controller
{
//
diff --git a/app/Http/Controllers/MenueItemsController.php b/Modules/Blog/app/Http/Controllers/MenueItemsController.php
similarity index 76%
rename from app/Http/Controllers/MenueItemsController.php
rename to Modules/Blog/app/Http/Controllers/MenueItemsController.php
index fc77e24..864caf4 100644
--- a/app/Http/Controllers/MenueItemsController.php
+++ b/Modules/Blog/app/Http/Controllers/MenueItemsController.php
@@ -2,8 +2,6 @@
namespace App\Http\Controllers;
-use Illuminate\Http\Request;
-
class MenueItemsController extends Controller
{
//
diff --git a/app/Http/Controllers/PermissionController.php b/Modules/Blog/app/Http/Controllers/PermissionController.php
similarity index 84%
rename from app/Http/Controllers/PermissionController.php
rename to Modules/Blog/app/Http/Controllers/PermissionController.php
index d33faec..148e719 100644
--- a/app/Http/Controllers/PermissionController.php
+++ b/Modules/Blog/app/Http/Controllers/PermissionController.php
@@ -30,7 +30,6 @@ public function create()
/**
* Store a newly created resource in storage.
*
- * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
@@ -42,7 +41,6 @@ public function store(Request $request)
/**
* Display the specified resource.
*
- * @param \App\Permission $permission
*
* @return \Illuminate\Http\Response
*/
@@ -54,7 +52,6 @@ public function show(Permission $permission)
/**
* Show the form for editing the specified resource.
*
- * @param \App\Permission $permission
*
* @return \Illuminate\Http\Response
*/
@@ -66,8 +63,6 @@ public function edit(Permission $permission)
/**
* Update the specified resource in storage.
*
- * @param \Illuminate\Http\Request $request
- * @param \App\Permission $permission
*
* @return \Illuminate\Http\Response
*/
@@ -79,7 +74,6 @@ public function update(Request $request, Permission $permission)
/**
* Remove the specified resource from storage.
*
- * @param \App\Permission $permission
*
* @return \Illuminate\Http\Response
*/
diff --git a/app/Http/Controllers/RoleController.php b/Modules/Blog/app/Http/Controllers/RoleController.php
similarity index 85%
rename from app/Http/Controllers/RoleController.php
rename to Modules/Blog/app/Http/Controllers/RoleController.php
index a15d912..bf237de 100644
--- a/app/Http/Controllers/RoleController.php
+++ b/Modules/Blog/app/Http/Controllers/RoleController.php
@@ -30,7 +30,6 @@ public function create()
/**
* Store a newly created resource in storage.
*
- * @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
@@ -42,7 +41,6 @@ public function store(Request $request)
/**
* Display the specified resource.
*
- * @param \App\Role $role
*
* @return \Illuminate\Http\Response
*/
@@ -54,7 +52,6 @@ public function show(Role $role)
/**
* Show the form for editing the specified resource.
*
- * @param \App\Role $role
*
* @return \Illuminate\Http\Response
*/
@@ -66,8 +63,6 @@ public function edit(Role $role)
/**
* Update the specified resource in storage.
*
- * @param \Illuminate\Http\Request $request
- * @param \App\Role $role
*
* @return \Illuminate\Http\Response
*/
@@ -79,7 +74,6 @@ public function update(Request $request, Role $role)
/**
* Remove the specified resource from storage.
*
- * @param \App\Role $role
*
* @return \Illuminate\Http\Response
*/
diff --git a/Modules/Blog/app/Http/Kernel.php b/Modules/Blog/app/Http/Kernel.php
new file mode 100644
index 0000000..3bc1cab
--- /dev/null
+++ b/Modules/Blog/app/Http/Kernel.php
@@ -0,0 +1,96 @@
+ [
+ \Illuminate\Cookie\Middleware\EncryptCookies::class,
+ \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
+ \Illuminate\Session\Middleware\StartSession::class,
+ // \Illuminate\Session\Middleware\AuthenticateSession::class,
+ \Illuminate\View\Middleware\ShareErrorsFromSession::class,
+ \Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class,
+ \Illuminate\Routing\Middleware\SubstituteBindings::class,
+ \App\Http\Middleware\GenerateMenus::class,
+ ],
+
+ 'api' => [
+ 'throttle:60,1',
+ \Illuminate\Routing\Middleware\SubstituteBindings::class,
+ ],
+ ];
+
+ /**
+ * The application's route middleware.
+ *
+ * These middleware may be assigned to groups or used individually.
+ *
+ * @var array
+ */
+ protected $routeMiddleware = [
+ 'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
+ 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
+ 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
+ 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
+ 'can' => \Illuminate\Auth\Middleware\Authorize::class,
+ 'guest' => \Illuminate\Auth\Middleware\RedirectIfAuthenticated::class,
+ 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
+ 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
+ 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
+ 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
+ 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
+ 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
+ 'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
+
+ // all middlewares fol multilangual package
+ // https://github.com/mcamara/laravel-localization
+ 'localize' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRoutes::class,
+ 'localizationRedirect' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRedirectFilter::class,
+ 'localeSessionRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect::class,
+ 'localeCookieRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleCookieRedirect::class,
+ 'localeViewPath' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationViewPath::class,
+ ];
+
+ /**
+ * The priority-sorted list of middleware.
+ *
+ * This forces non-global middleware to always be in the given order.
+ *
+ * @var array
+ */
+ protected $middlewarePriority = [
+ \Illuminate\Session\Middleware\StartSession::class,
+ \Illuminate\View\Middleware\ShareErrorsFromSession::class,
+ \Illuminate\Auth\Middleware\Authenticate::class,
+ \Illuminate\Routing\Middleware\ThrottleRequests::class,
+ \Illuminate\Session\Middleware\AuthenticateSession::class,
+ \Illuminate\Routing\Middleware\SubstituteBindings::class,
+ \Illuminate\Auth\Middleware\Authorize::class,
+ ];
+}
diff --git a/Modules/Blog/app/Http/Middleware/Authenticate.php b/Modules/Blog/app/Http/Middleware/Authenticate.php
new file mode 100644
index 0000000..bf41e13
--- /dev/null
+++ b/Modules/Blog/app/Http/Middleware/Authenticate.php
@@ -0,0 +1,19 @@
+expectsJson()) {
+ return route('login');
+ }
+ }
+}
diff --git a/app/Http/Middleware/CheckForMaintenanceMode.php b/Modules/Blog/app/Http/Middleware/CheckForMaintenanceMode.php
similarity index 100%
rename from app/Http/Middleware/CheckForMaintenanceMode.php
rename to Modules/Blog/app/Http/Middleware/CheckForMaintenanceMode.php
diff --git a/app/Http/Middleware/EncryptCookies.php b/Modules/Blog/app/Http/Middleware/EncryptCookies.php
similarity index 100%
rename from app/Http/Middleware/EncryptCookies.php
rename to Modules/Blog/app/Http/Middleware/EncryptCookies.php
diff --git a/Modules/Blog/app/Http/Middleware/GenerateMenus.php b/Modules/Blog/app/Http/Middleware/GenerateMenus.php
new file mode 100644
index 0000000..2cbb333
--- /dev/null
+++ b/Modules/Blog/app/Http/Middleware/GenerateMenus.php
@@ -0,0 +1,223 @@
+add(' '.trans('oa_menues.backend.sidebar.dashboard'), [
+ 'route' => 'backend.dashboard',
+ 'class' => 'c-sidebar-nav-item',
+ ])
+ ->data([
+ 'order' => 1,
+ 'activematches' => 'admin/dashboard*',
+ ])
+ ->link->attr([
+ 'class' => 'c-sidebar-nav-link',
+ ]);
+
+ // Notifications
+ $menu->add(''.trans('oa_menues.backend.sidebar.notifications'), [
+ 'route' => 'backend.notifications.index',
+ 'class' => 'c-sidebar-nav-item',
+ ])
+ ->data([
+ 'order' => 99,
+ 'activematches' => 'admin/notifications*',
+ 'permission' => [],
+ ])
+ ->link->attr([
+ 'class' => 'c-sidebar-nav-link',
+ ]);
+
+ // Separator: Access Management
+ $menu->add(trans('oa_menues.backend.sidebar.management'), [
+ 'class' => 'c-sidebar-nav-title',
+ ])
+ ->data([
+ 'order' => 101,
+ 'permission' => ['edit_settings', 'view_backups', 'view_users', 'view_roles', 'view_logs'],
+ ]);
+
+ // Settings
+ $menu->add(' '.trans('oa_menues.backend.sidebar.settings'), [
+ 'route' => 'backend.settings',
+ 'class' => 'c-sidebar-nav-item',
+ ])
+ ->data([
+ 'order' => 102,
+ 'activematches' => 'admin/settings*',
+ 'permission' => ['edit_settings'],
+ ])
+ ->link->attr([
+ 'class' => 'c-sidebar-nav-link',
+ ]);
+
+ // Backup
+ $menu->add(' '.trans('oa_menues.backend.sidebar.backups'), [
+ 'route' => 'backend.backups.index',
+ 'class' => 'nav-item',
+ ])
+ ->data([
+ 'order' => 103,
+ 'activematches' => 'admin/backups*',
+ 'permission' => ['view_backups'],
+ ])
+ ->link->attr([
+ 'class' => 'c-sidebar-nav-link',
+ ]);
+
+ // Access Control Dropdown
+ $accessControl = $menu->add(' '.trans('oa_menues.backend.sidebar.access_control'), [
+ 'class' => 'c-sidebar-nav-dropdown',
+ ])
+ ->data([
+ 'order' => 104,
+ 'activematches' => [
+ 'admin/users*',
+ 'admin/roles*',
+ ],
+ 'permission' => ['view_users', 'view_roles'],
+ ]);
+ $accessControl->link->attr([
+ 'class' => 'c-sidebar-nav-dropdown-toggle',
+ 'href' => '#',
+ ]);
+
+ // Submenu: Users
+ $accessControl->add(' '.trans('oa_menues.backend.sidebar.users'), [
+ 'route' => 'backend.users.index',
+ 'class' => 'nav-item',
+ ])
+ ->data([
+ 'order' => 105,
+ 'activematches' => 'admin/users*',
+ 'permission' => ['view_users'],
+ ])
+ ->link->attr([
+ 'class' => 'c-sidebar-nav-link',
+ ]);
+
+ // Submenu: Roles
+ $accessControl->add(' '.trans('oa_menues.backend.sidebar.roles'), [
+ 'route' => 'backend.roles.index',
+ 'class' => 'nav-item',
+ ])
+ ->data([
+ 'order' => 106,
+ 'activematches' => 'admin/roles*',
+ 'permission' => ['view_roles'],
+ ])
+ ->link->attr([
+ 'class' => 'c-sidebar-nav-link',
+ ]);
+
+ // Log Viewer
+ // Log Viewer Dropdown
+ $accessControl = $menu->add(' '.trans('oa_menues.backend.sidebar.log_viewer'), [
+ 'class' => 'c-sidebar-nav-dropdown',
+ ])
+ ->data([
+ 'order' => 107,
+ 'activematches' => [
+ 'log-viewer*',
+ ],
+ 'permission' => ['view_logs'],
+ ]);
+ $accessControl->link->attr([
+ 'class' => 'c-sidebar-nav-dropdown-toggle',
+ 'href' => '#',
+ ]);
+
+ // Submenu: Log Viewer Dashboard
+ $accessControl->add(' '.trans('oa_menues.backend.sidebar.dashboard'), [
+ 'route' => 'log-viewer::dashboard',
+ 'class' => 'nav-item',
+ ])
+ ->data([
+ 'order' => 108,
+ 'activematches' => 'admin/log-viewer',
+ ])
+ ->link->attr([
+ 'class' => 'c-sidebar-nav-link',
+ ]);
+
+ // Submenu: Log Viewer Logs by Days
+ $accessControl->add(''.trans('oa_menues.backend.sidebar.logs_by_days'), [
+ 'route' => 'log-viewer::logs.list',
+ 'class' => 'nav-item',
+ ])
+ ->data([
+ 'order' => 109,
+ 'activematches' => 'admin/log-viewer/logs*',
+ ])
+ ->link->attr([
+ 'class' => 'c-sidebar-nav-link',
+ ]);
+
+ /* Access Permission Check
+ * Filtering the Items
+ * https://github.com/lavary/laravel-menu#filtering-the-items
+ */
+ $menu->filter(function ($item) {
+ if ($item->data('permission')) {
+ if (auth()->check()) {
+ if (auth()->user()->hasRole('super admin')) {
+ return true;
+ } elseif (auth()->user()->hasAnyPermission($item->data('permission'))) {
+ return true;
+ }
+ }
+
+ return false;
+ } else {
+ return true;
+ }
+ });
+
+ /* Set Active Menu
+ * Filtering the Items
+ * https://github.com/lavary/laravel-menu#filtering-the-items
+ */
+ $menu->filter(function ($item) {
+ if ($item->activematches) {
+ $matches = is_array($item->activematches) ? $item->activematches : [$item->activematches];
+
+ foreach ($matches as $pattern) {
+ if (Str::is($pattern, \Request::path())) {
+ $item->activate();
+ $item->active();
+ if ($item->hasParent()) {
+ $item->parent()->activate();
+ $item->parent()->active();
+ }
+ // dd($pattern);
+ }
+ }
+ }
+
+ return true;
+ });
+ })->sortBy('order');
+
+ return $next($request);
+ }
+}
diff --git a/Modules/Blog/app/Http/Middleware/RedirectIfAuthenticated.php b/Modules/Blog/app/Http/Middleware/RedirectIfAuthenticated.php
new file mode 100644
index 0000000..6fed7f8
--- /dev/null
+++ b/Modules/Blog/app/Http/Middleware/RedirectIfAuthenticated.php
@@ -0,0 +1,24 @@
+check()) {
+ return redirect()->intended('/');
+ }
+
+ return $next($request);
+ }
+}
diff --git a/app/Http/Middleware/TrimStrings.php b/Modules/Blog/app/Http/Middleware/TrimStrings.php
similarity index 100%
rename from app/Http/Middleware/TrimStrings.php
rename to Modules/Blog/app/Http/Middleware/TrimStrings.php
diff --git a/Modules/Blog/app/Http/Middleware/TrustProxies.php b/Modules/Blog/app/Http/Middleware/TrustProxies.php
new file mode 100644
index 0000000..55e5b35
--- /dev/null
+++ b/Modules/Blog/app/Http/Middleware/TrustProxies.php
@@ -0,0 +1,23 @@
+ 'required|string|email',
@@ -37,11 +33,10 @@ public function rules()
/**
* Attempt to authenticate the request's credentials.
*
- * @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
- public function authenticate()
+ public function authenticate(): void
{
$this->ensureIsNotRateLimited();
@@ -62,11 +57,10 @@ public function authenticate()
/**
* Ensure the login request is not rate limited.
*
- * @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
- public function ensureIsNotRateLimited()
+ public function ensureIsNotRateLimited(): void
{
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
return;
@@ -86,10 +80,8 @@ public function ensureIsNotRateLimited()
/**
* Get the rate limiting throttle key for the request.
- *
- * @return string
*/
- public function throttleKey()
+ public function throttleKey(): string
{
return Str::lower($this->input('email')).'|'.$this->ip();
}
diff --git a/app/Http/Requests/Backend/CreateProductRequest.php b/Modules/Blog/app/Http/Requests/Backend/CreateProductRequest.php
similarity index 77%
rename from app/Http/Requests/Backend/CreateProductRequest.php
rename to Modules/Blog/app/Http/Requests/Backend/CreateProductRequest.php
index 4d8a003..1e1b1a3 100644
--- a/app/Http/Requests/Backend/CreateProductRequest.php
+++ b/Modules/Blog/app/Http/Requests/Backend/CreateProductRequest.php
@@ -2,29 +2,23 @@
namespace App\Http\Requests\Backend;
-use Illuminate\Foundation\Http\FormRequest;
use App\Models\Product;
+use Illuminate\Foundation\Http\FormRequest;
class CreateProductRequest extends FormRequest
{
-
/**
* Determine if the user is authorized to make this request.
- *
- * @return bool
*/
-
- public function authorize()
+ public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
- *
- * @return array
*/
- public function rules()
+ public function rules(): array
{
return Product::$rules;
}
diff --git a/app/Http/Requests/Backend/UpdateProductRequest.php b/Modules/Blog/app/Http/Requests/Backend/UpdateProductRequest.php
similarity index 77%
rename from app/Http/Requests/Backend/UpdateProductRequest.php
rename to Modules/Blog/app/Http/Requests/Backend/UpdateProductRequest.php
index 25c2b9a..829a780 100644
--- a/app/Http/Requests/Backend/UpdateProductRequest.php
+++ b/Modules/Blog/app/Http/Requests/Backend/UpdateProductRequest.php
@@ -2,31 +2,26 @@
namespace App\Http\Requests\Backend;
-use Illuminate\Foundation\Http\FormRequest;
use App\Models\Product;
+use Illuminate\Foundation\Http\FormRequest;
class UpdateProductRequest extends FormRequest
{
-
/**
* Determine if the user is authorized to make this request.
- *
- * @return bool
*/
- public function authorize()
+ public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
- *
- * @return array
*/
- public function rules()
+ public function rules(): array
{
$rules = Product::$rules;
-
+
return $rules;
}
}
diff --git a/app/Listeners/Backend/UserCreated/UserCreatedNotifyUser.php b/Modules/Blog/app/Listeners/Backend/UserCreated/UserCreatedNotifyUser.php
similarity index 78%
rename from app/Listeners/Backend/UserCreated/UserCreatedNotifyUser.php
rename to Modules/Blog/app/Listeners/Backend/UserCreated/UserCreatedNotifyUser.php
index 66d859e..8b40673 100644
--- a/app/Listeners/Backend/UserCreated/UserCreatedNotifyUser.php
+++ b/Modules/Blog/app/Listeners/Backend/UserCreated/UserCreatedNotifyUser.php
@@ -19,12 +19,8 @@ public function __construct()
/**
* Handle the event.
- *
- * @param UserCreated $event
- *
- * @return void
*/
- public function handle(UserCreated $event)
+ public function handle(UserCreated $event): void
{
$user = $event->user;
}
diff --git a/app/Listeners/Backend/UserCreated/UserCreatedProfileCreate.php b/Modules/Blog/app/Listeners/Backend/UserCreated/UserCreatedProfileCreate.php
similarity index 91%
rename from app/Listeners/Backend/UserCreated/UserCreatedProfileCreate.php
rename to Modules/Blog/app/Listeners/Backend/UserCreated/UserCreatedProfileCreate.php
index 3dac989..765f147 100644
--- a/app/Listeners/Backend/UserCreated/UserCreatedProfileCreate.php
+++ b/Modules/Blog/app/Listeners/Backend/UserCreated/UserCreatedProfileCreate.php
@@ -21,12 +21,8 @@ public function __construct()
/**
* Handle the event.
- *
- * @param UserCreated $event
- *
- * @return void
*/
- public function handle(UserCreated $event)
+ public function handle(UserCreated $event): void
{
$user = $event->user;
diff --git a/Modules/Blog/app/Listeners/Backend/UserProfileUpdated/UserProfileUpdatedNotifyUser.php b/Modules/Blog/app/Listeners/Backend/UserProfileUpdated/UserProfileUpdatedNotifyUser.php
new file mode 100644
index 0000000..ff97707
--- /dev/null
+++ b/Modules/Blog/app/Listeners/Backend/UserProfileUpdated/UserProfileUpdatedNotifyUser.php
@@ -0,0 +1,27 @@
+user_profile;
+ }
+}
diff --git a/Modules/Blog/app/Listeners/Backend/UserProfileUpdated/UserProfileUpdatedUserUpdate.php b/Modules/Blog/app/Listeners/Backend/UserProfileUpdated/UserProfileUpdatedUserUpdate.php
new file mode 100644
index 0000000..e2487f7
--- /dev/null
+++ b/Modules/Blog/app/Listeners/Backend/UserProfileUpdated/UserProfileUpdatedUserUpdate.php
@@ -0,0 +1,43 @@
+user_profile;
+
+ $user = User::where('id', '=', $user_profile->user_id)->first();
+ $user->name = $user_profile->name;
+ $user->first_name = $user_profile->first_name;
+ $user->last_name = $user_profile->last_name;
+ $user->username = $user_profile->username;
+ $user->email = $user_profile->email;
+ $user->mobile = $user_profile->mobile;
+ $user->gender = $user_profile->gender;
+ $user->date_of_birth = $user_profile->date_of_birth;
+ $user->gender = $user_profile->gender;
+ $user->save();
+
+ // Clear Cache
+ \Artisan::call('cache:clear');
+ }
+}
diff --git a/Modules/Blog/app/Listeners/Backend/UserUpdated/UserUpdatedNotifyUser.php b/Modules/Blog/app/Listeners/Backend/UserUpdated/UserUpdatedNotifyUser.php
new file mode 100644
index 0000000..8b96543
--- /dev/null
+++ b/Modules/Blog/app/Listeners/Backend/UserUpdated/UserUpdatedNotifyUser.php
@@ -0,0 +1,27 @@
+user;
+ }
+}
diff --git a/Modules/Blog/app/Listeners/Backend/UserUpdated/UserUpdatedProfileUpdate.php b/Modules/Blog/app/Listeners/Backend/UserUpdated/UserUpdatedProfileUpdate.php
new file mode 100644
index 0000000..d78c8f5
--- /dev/null
+++ b/Modules/Blog/app/Listeners/Backend/UserUpdated/UserUpdatedProfileUpdate.php
@@ -0,0 +1,48 @@
+user;
+
+ $userprofile = Userprofile::where('user_id', '=', $user->id)->first();
+ $userprofile->name = $user->name;
+ $userprofile->first_name = $user->first_name;
+ $userprofile->last_name = $user->last_name;
+ $userprofile->username = $user->username;
+ $userprofile->email = $user->email;
+ $userprofile->mobile = $user->mobile;
+ $userprofile->gender = $user->gender;
+ $userprofile->date_of_birth = $user->date_of_birth;
+ $userprofile->avatar = $user->avatar;
+ $userprofile->status = $user->status;
+ $userprofile->updated_at = $user->updated_at;
+ $userprofile->updated_by = $user->updated_by;
+ $userprofile->deleted_at = $user->deleted_at;
+ $userprofile->deleted_by = $user->deleted_by;
+ $userprofile->save();
+
+ // Clear Cache
+ \Artisan::call('cache:clear');
+ }
+}
diff --git a/Modules/Blog/app/Listeners/Frontend/UserProfileUpdated/UserProfileUpdatedNotifyUser.php b/Modules/Blog/app/Listeners/Frontend/UserProfileUpdated/UserProfileUpdatedNotifyUser.php
new file mode 100644
index 0000000..ec988f1
--- /dev/null
+++ b/Modules/Blog/app/Listeners/Frontend/UserProfileUpdated/UserProfileUpdatedNotifyUser.php
@@ -0,0 +1,27 @@
+user_profile;
+ }
+}
diff --git a/Modules/Blog/app/Listeners/Frontend/UserProfileUpdated/UserProfileUpdatedUserUpdate.php b/Modules/Blog/app/Listeners/Frontend/UserProfileUpdated/UserProfileUpdatedUserUpdate.php
new file mode 100644
index 0000000..d985c4f
--- /dev/null
+++ b/Modules/Blog/app/Listeners/Frontend/UserProfileUpdated/UserProfileUpdatedUserUpdate.php
@@ -0,0 +1,42 @@
+user_profile;
+
+ $user = User::where('id', '=', $user_profile->user_id)->first();
+
+ $user->name = $user_profile->name;
+ $user->first_name = $user_profile->first_name;
+ $user->last_name = $user_profile->last_name;
+ $user->username = $user_profile->username;
+ $user->email = $user_profile->email;
+ $user->mobile = $user_profile->mobile;
+ $user->gender = $user_profile->gender;
+ $user->date_of_birth = $user_profile->date_of_birth;
+ $user->gender = $user_profile->gender;
+
+ $user->save();
+ }
+}
diff --git a/app/Listeners/Frontend/UserRegistered/UserRegisteredListener.php b/Modules/Blog/app/Listeners/Frontend/UserRegistered/UserRegisteredListener.php
similarity index 80%
rename from app/Listeners/Frontend/UserRegistered/UserRegisteredListener.php
rename to Modules/Blog/app/Listeners/Frontend/UserRegistered/UserRegisteredListener.php
index 86e54ae..72b6304 100644
--- a/app/Listeners/Frontend/UserRegistered/UserRegisteredListener.php
+++ b/Modules/Blog/app/Listeners/Frontend/UserRegistered/UserRegisteredListener.php
@@ -22,12 +22,8 @@ public function __construct()
/**
* Handle the event.
- *
- * @param UserRegistered $event
- *
- * @return void
*/
- public function handle(UserRegistered $event)
+ public function handle(UserRegistered $event): void
{
$user = $event->user;
@@ -40,14 +36,14 @@ public function handle(UserRegistered $event)
try {
$user->notify(new NewRegistrationFromSocial());
} catch (\Exception $e) {
- Log::error("UserRegisteredListener: Email Send Failed.");
+ Log::error('UserRegisteredListener: Email Send Failed.');
Log::error($e);
}
} else {
try {
$user->notify(new NewRegistration());
} catch (\Exception $e) {
- Log::error("UserRegisteredListener: Email Send Failed.");
+ Log::error('UserRegisteredListener: Email Send Failed.');
Log::error($e);
}
}
diff --git a/app/Listeners/Frontend/UserRegistered/UserRegisteredProfileCreate.php b/Modules/Blog/app/Listeners/Frontend/UserRegistered/UserRegisteredProfileCreate.php
similarity index 90%
rename from app/Listeners/Frontend/UserRegistered/UserRegisteredProfileCreate.php
rename to Modules/Blog/app/Listeners/Frontend/UserRegistered/UserRegisteredProfileCreate.php
index 59e991a..8260668 100644
--- a/app/Listeners/Frontend/UserRegistered/UserRegisteredProfileCreate.php
+++ b/Modules/Blog/app/Listeners/Frontend/UserRegistered/UserRegisteredProfileCreate.php
@@ -20,12 +20,8 @@ public function __construct()
/**
* Handle the event.
- *
- * @param UserRegistered $event
- *
- * @return void
*/
- public function handle(UserRegistered $event)
+ public function handle(UserRegistered $event): void
{
$user = $event->user;
diff --git a/Modules/Blog/app/Listeners/Frontend/UserUpdated/UserUpdatedNotifyUser.php b/Modules/Blog/app/Listeners/Frontend/UserUpdated/UserUpdatedNotifyUser.php
new file mode 100644
index 0000000..fcbdbe4
--- /dev/null
+++ b/Modules/Blog/app/Listeners/Frontend/UserUpdated/UserUpdatedNotifyUser.php
@@ -0,0 +1,27 @@
+user;
+ }
+}
diff --git a/Modules/Blog/app/Listeners/Frontend/UserUpdated/UserUpdatedProfileUpdate.php b/Modules/Blog/app/Listeners/Frontend/UserUpdated/UserUpdatedProfileUpdate.php
new file mode 100644
index 0000000..ac74712
--- /dev/null
+++ b/Modules/Blog/app/Listeners/Frontend/UserUpdated/UserUpdatedProfileUpdate.php
@@ -0,0 +1,27 @@
+user;
+ }
+}
diff --git a/app/Listeners/UserEventSubscriber.php b/Modules/Blog/app/Listeners/UserEventSubscriber.php
similarity index 93%
rename from app/Listeners/UserEventSubscriber.php
rename to Modules/Blog/app/Listeners/UserEventSubscriber.php
index 9420b75..5f375d8 100644
--- a/app/Listeners/UserEventSubscriber.php
+++ b/Modules/Blog/app/Listeners/UserEventSubscriber.php
@@ -3,6 +3,7 @@
namespace App\Listeners;
use Carbon\Carbon;
+use Illuminate\Events\Dispatcher;
use Log;
class UserEventSubscriber
@@ -42,10 +43,8 @@ public function handleUserLogout($event)
/**
* Register the listeners for the subscriber.
- *
- * @param \Illuminate\Events\Dispatcher $events
*/
- public function subscribe($events)
+ public function subscribe(Dispatcher $events)
{
$events->listen(
'Illuminate\Auth\Events\Login',
diff --git a/app/Models/BaseModel.php b/Modules/Blog/app/Models/BaseModel.php
similarity index 89%
rename from app/Models/BaseModel.php
rename to Modules/Blog/app/Models/BaseModel.php
index 63b5d13..7d979db 100644
--- a/app/Models/BaseModel.php
+++ b/Modules/Blog/app/Models/BaseModel.php
@@ -13,8 +13,8 @@
class BaseModel extends Model implements HasMedia
{
- use SoftDeletes;
use HasHashedMediaTrait;
+ use SoftDeletes;
protected $guarded = [
'id',
@@ -23,11 +23,6 @@ class BaseModel extends Model implements HasMedia
'_method',
];
- protected $dates = [
- 'deleted_at',
- 'published_at',
- ];
-
protected static function boot()
{
parent::boot();
@@ -55,20 +50,27 @@ protected static function boot()
});
}
+ protected function casts(): array
+ {
+ return [
+ 'published_at' => 'datetime',
+ ];
+ }
+
/**
* Create Converted copies of uploaded images.
*/
- public function registerMediaConversions(Media $media = null): void
+ public function registerMediaConversions(?Media $media = null): void
{
$this->addMediaConversion('thumb')
- ->width(250)
- ->height(250)
- ->quality(70);
+ ->width(250)
+ ->height(250)
+ ->quality(70);
$this->addMediaConversion('thumb300')
- ->width(300)
- ->height(300)
- ->quality(70);
+ ->width(300)
+ ->height(300)
+ ->quality(70);
}
/**
@@ -76,7 +78,7 @@ public function registerMediaConversions(Media $media = null): void
*
* @return array Column names array
*/
- public function getTableColumns()
+ public function getTableColumns(): array
{
$table_info_columns = DB::select(DB::raw('SHOW COLUMNS FROM '.$this->getTable()));
diff --git a/app/Models/Menue.php b/Modules/Blog/app/Models/Menue.php
similarity index 83%
rename from app/Models/Menue.php
rename to Modules/Blog/app/Models/Menue.php
index 9d137a1..153d118 100644
--- a/app/Models/Menue.php
+++ b/Modules/Blog/app/Models/Menue.php
@@ -2,10 +2,9 @@
namespace App\Models;
+use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
-use Spatie\Sluggable\SlugOptions;
-use Cviebrock\EloquentSluggable\Sluggable;
class Menue extends Model
{
@@ -17,8 +16,8 @@ public function sluggable()
{
return [
'slug' => [
- 'source' => 'title'
- ]
+ 'source' => 'title',
+ ],
];
}
@@ -26,6 +25,4 @@ public function getRouteKeyName()
{
return 'slug';
}
-
-
}
diff --git a/Modules/Blog/app/Models/MenueItems.php b/Modules/Blog/app/Models/MenueItems.php
new file mode 100644
index 0000000..5ba9eae
--- /dev/null
+++ b/Modules/Blog/app/Models/MenueItems.php
@@ -0,0 +1,31 @@
+ [
+ 'source' => 'title',
+ ],
+ ];
+ }
+
+ public function getRouteKeyName()
+ {
+ return 'slug';
+ }
+}
diff --git a/Modules/Blog/app/Models/Notification.php b/Modules/Blog/app/Models/Notification.php
new file mode 100644
index 0000000..d23ed8c
--- /dev/null
+++ b/Modules/Blog/app/Models/Notification.php
@@ -0,0 +1,30 @@
+ 'datetime',
+ ];
+ }
+
+ /**
+ * Get the list of all the Columns of the table.
+ *
+ * @return array Column names array
+ */
+ public function getTableColumns(): array
+ {
+ $table_info_columns = DB::select(DB::raw('SHOW COLUMNS FROM '.$this->getTable()));
+
+ return $table_info_columns;
+ }
+}
diff --git a/app/Models/Permission.php b/Modules/Blog/app/Models/Permission.php
similarity index 89%
rename from app/Models/Permission.php
rename to Modules/Blog/app/Models/Permission.php
index 91d0097..ab65e1d 100644
--- a/app/Models/Permission.php
+++ b/Modules/Blog/app/Models/Permission.php
@@ -34,9 +34,9 @@ public static function defaultPermissions()
/**
* Name should be lowercase.
*
- * @param string $value Name value
+ * @param string $value Name value
*/
- public function setNameAttribute($value)
+ public function setNameAttribute(string $value)
{
$this->attributes['name'] = strtolower($value);
}
diff --git a/app/Models/Presenters/UserPresenter.php b/Modules/Blog/app/Models/Presenters/UserPresenter.php
similarity index 87%
rename from app/Models/Presenters/UserPresenter.php
rename to Modules/Blog/app/Models/Presenters/UserPresenter.php
index 0cfbb53..d9b6492 100644
--- a/app/Models/Presenters/UserPresenter.php
+++ b/Modules/Blog/app/Models/Presenters/UserPresenter.php
@@ -9,7 +9,6 @@
/**
* Presenter Class for Book Module.
*/
-
trait UserPresenter
{
/**
@@ -47,32 +46,28 @@ public function getConfirmedLabelAttribute()
}
/**
- *
* Cache Permissions Query
- *
*/
public function getPermissionsAttribute()
{
$permissions = Cache::rememberForever('permissions_cache', function () {
return Permission::select('permissions.*', 'model_has_permissions.*')
- ->join('model_has_permissions', 'permissions.id', '=', 'model_has_permissions.permission_id')
- ->get();
+ ->join('model_has_permissions', 'permissions.id', '=', 'model_has_permissions.permission_id')
+ ->get();
});
return $permissions->where('model_id', $this->id);
}
/**
- *
* Cache Roles Query
- *
*/
public function getRolesAttribute()
{
$roles = Cache::rememberForever('roles_cache', function () {
return Role::select('roles.*', 'model_has_roles.*')
- ->join('model_has_roles', 'roles.id', '=', 'model_has_roles.role_id')
- ->get();
+ ->join('model_has_roles', 'roles.id', '=', 'model_has_roles.role_id')
+ ->get();
});
return $roles->where('model_id', $this->id);
diff --git a/Modules/Blog/app/Models/Role.php b/Modules/Blog/app/Models/Role.php
new file mode 100644
index 0000000..ea3debb
--- /dev/null
+++ b/Modules/Blog/app/Models/Role.php
@@ -0,0 +1,16 @@
+attributes['name'] = strtolower($value);
+ }
+}
diff --git a/app/Models/Setting.php b/Modules/Blog/app/Models/Setting.php
similarity index 77%
rename from app/Models/Setting.php
rename to Modules/Blog/app/Models/Setting.php
index b9d0228..fb0b790 100644
--- a/app/Models/Setting.php
+++ b/Modules/Blog/app/Models/Setting.php
@@ -12,14 +12,8 @@ class Setting extends BaseModel
/**
* Add a settings value.
- *
- * @param $key
- * @param $val
- * @param string $type
- *
- * @return bool
*/
- public static function add($key, $val, $type = 'string')
+ public static function add($key, $val, string $type = 'string'): bool
{
if (self::has($key)) {
return self::set($key, $val, $type);
@@ -31,9 +25,7 @@ public static function add($key, $val, $type = 'string')
/**
* Get a settings value.
*
- * @param $key
- * @param null $default
- *
+ * @param null $default
* @return bool|int|mixed
*/
public static function get($key, $default = null)
@@ -49,19 +41,13 @@ public static function get($key, $default = null)
/**
* Set a value for setting.
- *
- * @param $key
- * @param $val
- * @param string $type
- *
- * @return bool
*/
- public static function set($key, $val, $type = 'string')
+ public static function set($key, $val, string $type = 'string'): bool
{
if ($setting = self::getAllSettings()->where('name', $key)->first()) {
return $setting->update([
'name' => $key,
- 'val' => $val,
+ 'val' => $val,
'type' => $type, ]) ? $val : false;
}
@@ -70,12 +56,8 @@ public static function set($key, $val, $type = 'string')
/**
* Remove a setting.
- *
- * @param $key
- *
- * @return bool
*/
- public static function remove($key)
+ public static function remove($key): bool
{
if (self::has($key)) {
return self::whereName($key)->delete();
@@ -86,22 +68,16 @@ public static function remove($key)
/**
* Check if setting exists.
- *
- * @param $key
- *
- * @return bool
*/
- public static function has($key)
+ public static function has($key): bool
{
return (bool) self::getAllSettings()->whereStrict('name', $key)->count();
}
/**
* Get the validation rules for setting fields.
- *
- * @return array
*/
- public static function getValidationRules()
+ public static function getValidationRules(): array
{
return self::getDefinedSettingFields()->pluck('rules', 'name')
->reject(function ($val) {
@@ -112,15 +88,14 @@ public static function getValidationRules()
/**
* Get the data type of a setting.
*
- * @param $field
*
* @return mixed
*/
public static function getDataType($field)
{
$type = self::getDefinedSettingFields()
- ->pluck('data', 'name')
- ->get($field);
+ ->pluck('data', 'name')
+ ->get($field);
return is_null($type) ? 'string' : $type;
}
@@ -128,22 +103,19 @@ public static function getDataType($field)
/**
* Get default value for a setting.
*
- * @param $field
*
* @return mixed
*/
public static function getDefaultValueForField($field)
{
return self::getDefinedSettingFields()
- ->pluck('value', 'name')
- ->get($field);
+ ->pluck('value', 'name')
+ ->get($field);
}
/**
* Get default value from config if no value passed.
*
- * @param $key
- * @param $default
*
* @return mixed
*/
@@ -154,10 +126,8 @@ private static function getDefaultValue($key, $default)
/**
* Get all the settings fields from config.
- *
- * @return Collection
*/
- private static function getDefinedSettingFields()
+ private static function getDefinedSettingFields(): Collection
{
return collect(config('setting_fields'))->pluck('elements')->flatten(1);
}
@@ -165,8 +135,6 @@ private static function getDefinedSettingFields()
/**
* caste value into respective type.
*
- * @param $val
- * @param $castTo
*
* @return bool|int
*/
@@ -210,10 +178,8 @@ public static function flushCache()
/**
* The "booting" method of the model.
- *
- * @return void
*/
- protected static function boot()
+ protected static function boot(): void
{
parent::boot();
diff --git a/app/Models/Traits/HasHashedMediaTrait.php b/Modules/Blog/app/Models/Traits/HasHashedMediaTrait.php
similarity index 100%
rename from app/Models/Traits/HasHashedMediaTrait.php
rename to Modules/Blog/app/Models/Traits/HasHashedMediaTrait.php
diff --git a/Modules/Blog/app/Models/User.php b/Modules/Blog/app/Models/User.php
new file mode 100644
index 0000000..5eb035d
--- /dev/null
+++ b/Modules/Blog/app/Models/User.php
@@ -0,0 +1,97 @@
+ 'datetime',
+ 'email_verified_at' => 'datetime',
+ ];
+ }
+
+ public function providers(): HasMany
+ {
+ return $this->hasMany('App\Models\UserProvider');
+ }
+
+ public function profile(): HasOne
+ {
+ return $this->hasOne('App\Models\Userprofile');
+ }
+
+ public function userprofile(): HasOne
+ {
+ return $this->hasOne('App\Models\Userprofile');
+ }
+
+ // /**
+ // * Send the password reset notification.
+ // *
+ // * @param string $token
+ // *
+ // * @return void
+ // */
+ // public function sendPasswordResetNotification($token)
+ // {
+ // $this->notify(new ResetPasswordNotification($token));
+ // }
+
+ /**
+ * Get the list of users related to the current User.
+ *
+ * @return [array] roels
+ */
+ public function getRolesListAttribute()
+ {
+ return array_map('intval', $this->roles->pluck('id')->toArray());
+ }
+
+ /**
+ * Route notifications for the Slack channel.
+ */
+ public function routeNotificationForSlack(Notification $notification): string
+ {
+ return env('SLACK_NOTIFICATION_WEBHOOK');
+ }
+}
diff --git a/app/Models/UserProvider.php b/Modules/Blog/app/Models/UserProvider.php
similarity index 84%
rename from app/Models/UserProvider.php
rename to Modules/Blog/app/Models/UserProvider.php
index 0a775c6..d9dcbb7 100644
--- a/app/Models/UserProvider.php
+++ b/Modules/Blog/app/Models/UserProvider.php
@@ -3,6 +3,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* User Provider Model.
@@ -26,7 +27,7 @@ class UserProvider extends Model
/**
* Get the user of a UserProvider.
*/
- public function user()
+ public function user(): BelongsTo
{
return $this->belongsTo('App\Models\User');
}
diff --git a/Modules/Blog/app/Models/Userprofile.php b/Modules/Blog/app/Models/Userprofile.php
new file mode 100644
index 0000000..1b5ab0b
--- /dev/null
+++ b/Modules/Blog/app/Models/Userprofile.php
@@ -0,0 +1,19 @@
+belongsTo('App\Models\User');
+ }
+}
diff --git a/Modules/Blog/app/Notifications/NewRegistration.php b/Modules/Blog/app/Notifications/NewRegistration.php
new file mode 100644
index 0000000..3bf527a
--- /dev/null
+++ b/Modules/Blog/app/Notifications/NewRegistration.php
@@ -0,0 +1,123 @@
+email_verified_at == '') {
+ $verificationUrl = $this->verificationUrl($notifiable);
+
+ if (static::$toMailCallback) {
+ return call_user_func(static::$toMailCallback, $notifiable, $verificationUrl);
+ }
+
+ return (new MailMessage())
+ ->subject('Thank you for registration!')
+ ->line('Please click the button below to verify your email address.')
+ ->action('Verify Email Address', $verificationUrl)
+ ->line('If you did not create an account, no further action is required.');
+ }
+
+ return (new MailMessage)
+ ->subject('Thank you for registration!')
+ ->line('Thank you for registration at '.app_name().'.')
+ ->action('Vist Application', url('/'))
+ ->line('We are really happy that you started to use '.app_name().'!');
+ }
+
+ /**
+ * Get the array representation of the notification.
+ *
+ * @param mixed $notifiable
+ */
+ public function toDatabase($notifiable): array
+ {
+ $user = $notifiable;
+
+ $text = 'Registration Completed! | New registration completed for '.$user->name.'';
+
+ $url_backend = route('backend.users.profile', $user->id);
+ $url_frontend = route('frontend.users.profile', $user->id);
+
+ return [
+ 'title' => 'Registration Completed!',
+ 'module' => 'User',
+ 'type' => 'created', // created, published, viewed,
+ 'icon' => 'fas fa-user',
+ 'text' => $text,
+ 'url_backend' => $url_backend,
+ 'url_frontend' => $url_frontend,
+ ];
+ }
+
+ /**
+ * Get the verification URL for the given notifiable.
+ *
+ * @param mixed $notifiable
+ */
+ protected function verificationUrl($notifiable): string
+ {
+ return URL::temporarySignedRoute(
+ 'verification.verify',
+ Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
+ [
+ 'id' => $notifiable->getKey(),
+ 'hash' => sha1($notifiable->getEmailForVerification()),
+ ]
+ );
+ }
+
+ /**
+ * Set a callback that should be used when building the notification mail message.
+ */
+ public static function toMailUsing(Closure $callback): void
+ {
+ static::$toMailCallback = $callback;
+ }
+}
diff --git a/Modules/Blog/app/Notifications/NewRegistrationFromSocial.php b/Modules/Blog/app/Notifications/NewRegistrationFromSocial.php
new file mode 100644
index 0000000..95082f4
--- /dev/null
+++ b/Modules/Blog/app/Notifications/NewRegistrationFromSocial.php
@@ -0,0 +1,118 @@
+email_verified_at == '') {
+ $verificationUrl = $this->verificationUrl($notifiable);
+
+ return (new MailMessage())
+ ->subject('Thank you for registration!')
+ ->line('Please click the button below to verify your email address.')
+ ->action('Verify Email Address', $verificationUrl)
+ ->line('If you did not create an account, no further action is required.');
+ }
+
+ return (new MailMessage)
+ ->subject('Thank you for registration!')
+ ->line('Thank you for registration at '.app_name().'.')
+ ->action('Vist Application', url('/'))
+ ->line('We are really happy that you started to use '.app_name().'!');
+ }
+
+ /**
+ * Get the array representation of the notification.
+ *
+ * @param mixed $notifiable
+ */
+ public function toDatabase($notifiable): array
+ {
+ $user = $notifiable;
+
+ $text = 'Registration Completed! | New registration completed for '.$user->name.'';
+
+ $url_backend = route('backend.users.profile', $user->id);
+ $url_frontend = route('frontend.users.profile', $user->id);
+
+ return [
+ 'title' => 'Registration Completed!',
+ 'module' => 'User',
+ 'type' => 'created', // created, published, viewed,
+ 'icon' => 'fas fa-user',
+ 'text' => $text,
+ 'url_backend' => $url_backend,
+ 'url_frontend' => $url_frontend,
+ ];
+ }
+
+ /**
+ * Get the verification URL for the given notifiable.
+ *
+ * @param mixed $notifiable
+ */
+ protected function verificationUrl($notifiable): string
+ {
+ return URL::temporarySignedRoute(
+ 'verification.verify',
+ Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
+ [
+ 'id' => $notifiable->getKey(),
+ 'hash' => sha1($notifiable->getEmailForVerification()),
+ ]
+ );
+ }
+
+ /**
+ * Set a callback that should be used when building the notification mail message.
+ */
+ public static function toMailUsing(Closure $callback): void
+ {
+ static::$toMailCallback = $callback;
+ }
+}
diff --git a/app/Notifications/ResetPasswordNotification.php b/Modules/Blog/app/Notifications/ResetPasswordNotification.php
similarity index 81%
rename from app/Notifications/ResetPasswordNotification.php
rename to Modules/Blog/app/Notifications/ResetPasswordNotification.php
index 0180c82..8531fc8 100644
--- a/app/Notifications/ResetPasswordNotification.php
+++ b/Modules/Blog/app/Notifications/ResetPasswordNotification.php
@@ -2,6 +2,7 @@
namespace App\Notifications;
+use Closure;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Lang;
@@ -25,11 +26,9 @@ class ResetPasswordNotification extends Notification
/**
* Create a notification instance.
*
- * @param string $token
- *
* @return void
*/
- public function __construct($token)
+ public function __construct(string $token)
{
$this->token = $token;
}
@@ -37,11 +36,10 @@ public function __construct($token)
/**
* Get the notification's channels.
*
- * @param mixed $notifiable
- *
+ * @param mixed $notifiable
* @return array|string
*/
- public function via($notifiable)
+ public function via($notifiable): array
{
return ['mail'];
}
@@ -49,11 +47,9 @@ public function via($notifiable)
/**
* Build the mail representation of the notification.
*
- * @param mixed $notifiable
- *
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @param mixed $notifiable
*/
- public function toMail($notifiable)
+ public function toMail($notifiable): MailMessage
{
if (static::$toMailCallback) {
return call_user_func(static::$toMailCallback, $notifiable, $this->token);
@@ -69,12 +65,8 @@ public function toMail($notifiable)
/**
* Set a callback that should be used when building the notification mail message.
- *
- * @param \Closure $callback
- *
- * @return void
*/
- public static function toMailUsing($callback)
+ public static function toMailUsing(Closure $callback): void
{
static::$toMailCallback = $callback;
}
diff --git a/app/Notifications/VerifyEmail.php b/Modules/Blog/app/Notifications/VerifyEmail.php
similarity index 78%
rename from app/Notifications/VerifyEmail.php
rename to Modules/Blog/app/Notifications/VerifyEmail.php
index 8dd01c8..58da30b 100644
--- a/app/Notifications/VerifyEmail.php
+++ b/Modules/Blog/app/Notifications/VerifyEmail.php
@@ -2,6 +2,7 @@
namespace App\Notifications;
+use Closure;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Carbon;
@@ -21,11 +22,10 @@ class VerifyEmail extends Notification
/**
* Get the notification's channels.
*
- * @param mixed $notifiable
- *
+ * @param mixed $notifiable
* @return array|string
*/
- public function via($notifiable)
+ public function via($notifiable): array
{
return ['mail'];
}
@@ -33,11 +33,9 @@ public function via($notifiable)
/**
* Build the mail representation of the notification.
*
- * @param mixed $notifiable
- *
- * @return \Illuminate\Notifications\Messages\MailMessage
+ * @param mixed $notifiable
*/
- public function toMail($notifiable)
+ public function toMail($notifiable): MailMessage
{
$verificationUrl = $this->verificationUrl($notifiable);
@@ -55,17 +53,15 @@ public function toMail($notifiable)
/**
* Get the verification URL for the given notifiable.
*
- * @param mixed $notifiable
- *
- * @return string
+ * @param mixed $notifiable
*/
- protected function verificationUrl($notifiable)
+ protected function verificationUrl($notifiable): string
{
return URL::temporarySignedRoute(
'verification.verify',
Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
[
- 'id' => $notifiable->getKey(),
+ 'id' => $notifiable->getKey(),
'hash' => sha1($notifiable->getEmailForVerification()),
]
);
@@ -73,12 +69,8 @@ protected function verificationUrl($notifiable)
/**
* Set a callback that should be used when building the notification mail message.
- *
- * @param \Closure $callback
- *
- * @return void
*/
- public static function toMailUsing($callback)
+ public static function toMailUsing(Closure $callback): void
{
static::$toMailCallback = $callback;
}
diff --git a/Modules/Blog/app/Providers/AppServiceProvider.php b/Modules/Blog/app/Providers/AppServiceProvider.php
new file mode 100644
index 0000000..dcb5655
--- /dev/null
+++ b/Modules/Blog/app/Providers/AppServiceProvider.php
@@ -0,0 +1,30 @@
+ 'App\Policies\ModelPolicy',
+ ];
+
+ /**
+ * Register any authentication / authorization services.
+ */
+ public function boot(): void
+ {
+ $this->registerPolicies();
+
+ // Implicitly grant "Super Admin" role all permissions
+ // This works in the app by using gate-related functions like auth()->user->can() and @can()
+ Gate::before(function ($user, $ability) {
+ return $user->hasRole('super admin') ? true : null;
+ });
+
+ // for blog system
+ /*
+ Gate::define(GateTypes::MANAGE_BLOG_ADMIN, static function (?Model $user) {
+ // Implement your logic here, for example:
+ return $user && $user->email === 'your-admin-user@your-site.com';
+ // Or something like `$user->is_admin === true`
+ }); */
+
+ }
+}
diff --git a/app/Providers/BroadcastServiceProvider.php b/Modules/Blog/app/Providers/BroadcastServiceProvider.php
similarity index 85%
rename from app/Providers/BroadcastServiceProvider.php
rename to Modules/Blog/app/Providers/BroadcastServiceProvider.php
index 395c518..2be04f5 100644
--- a/app/Providers/BroadcastServiceProvider.php
+++ b/Modules/Blog/app/Providers/BroadcastServiceProvider.php
@@ -9,10 +9,8 @@ class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
- *
- * @return void
*/
- public function boot()
+ public function boot(): void
{
Broadcast::routes();
diff --git a/Modules/Blog/app/Providers/EventServiceProvider.php b/Modules/Blog/app/Providers/EventServiceProvider.php
new file mode 100644
index 0000000..ef47c86
--- /dev/null
+++ b/Modules/Blog/app/Providers/EventServiceProvider.php
@@ -0,0 +1,68 @@
+ [
+ SendEmailVerificationNotification::class,
+ ],
+ 'App\Events\Backend\UserCreated' => [
+ 'App\Listeners\Backend\UserCreated\UserCreatedProfileCreate',
+ 'App\Listeners\Backend\UserCreated\UserCreatedNotifyUser',
+ ],
+ 'App\Events\Backend\UserUpdated' => [
+ 'App\Listeners\Backend\UserUpdated\UserUpdatedNotifyUser',
+ 'App\Listeners\Backend\UserUpdated\UserUpdatedProfileUpdate',
+ ],
+ 'App\Events\Backend\UserProfileUpdated' => [
+ 'App\Listeners\Backend\UserProfileUpdated\UserProfileUpdatedNotifyUser',
+ 'App\Listeners\Backend\UserProfileUpdated\UserProfileUpdatedUserUpdate',
+ ],
+ 'App\Events\Frontend\UserRegistered' => [
+ 'App\Listeners\Frontend\UserRegistered\UserRegisteredListener',
+ 'App\Listeners\Frontend\UserRegistered\UserRegisteredProfileCreate',
+ ],
+ 'App\Events\Frontend\UserUpdated' => [
+ 'App\Listeners\Frontend\UserUpdated\UserUpdatedNotifyUser',
+ 'App\Listeners\Frontend\UserUpdated\UserUpdatedProfileUpdate',
+ ],
+ 'App\Events\Frontend\UserProfileUpdated' => [
+ 'App\Listeners\Frontend\UserProfileUpdated\UserProfileUpdatedNotifyUser',
+ 'App\Listeners\Frontend\UserProfileUpdated\UserProfileUpdatedUserUpdate',
+ ],
+ 'App\Events\Event' => [
+ 'App\Listeners\EventListener',
+ ],
+ ];
+
+ /**
+ * The subscriber classes to register.
+ *
+ * @var array
+ */
+ protected $subscribe = [
+ 'App\Listeners\UserEventSubscriber',
+ ];
+
+ /**
+ * Register any events for your application.
+ */
+ public function boot(): void
+ {
+ parent::boot();
+
+ //
+ }
+}
diff --git a/Modules/Blog/app/Providers/RouteServiceProvider.php b/Modules/Blog/app/Providers/RouteServiceProvider.php
new file mode 100644
index 0000000..751f803
--- /dev/null
+++ b/Modules/Blog/app/Providers/RouteServiceProvider.php
@@ -0,0 +1,76 @@
+middleware('api')
+ ->as('api.')
+ ->namespace($this->app->getNamespace().'Http\Controllers\API')
+ ->group(base_path('routes/api.php'));
+
+ } // close boot function
+
+ /**
+ * Define the routes for the application.
+ */
+ public function map(): void
+ {
+ $this->mapApiRoutes();
+
+ $this->mapWebRoutes();
+
+ //
+ }
+
+ /**
+ * Define the "web" routes for the application.
+ *
+ * These routes all receive session state, CSRF protection, etc.
+ */
+ protected function mapWebRoutes(): void
+ {
+ Route::middleware('web')
+ ->group(base_path('routes/web.php'));
+ }
+
+ /**
+ * Define the "api" routes for the application.
+ *
+ * These routes are typically stateless.
+ */
+ protected function mapApiRoutes(): void
+ {
+ Route::prefix('api')
+ ->middleware('api')
+ ->group(base_path('routes/api.php'));
+ }
+}
diff --git a/Modules/Blog/app/Repositories/Backend/ProductRepository.php b/Modules/Blog/app/Repositories/Backend/ProductRepository.php
new file mode 100644
index 0000000..c11118f
--- /dev/null
+++ b/Modules/Blog/app/Repositories/Backend/ProductRepository.php
@@ -0,0 +1,45 @@
+fieldSearchable;
+ }
+
+ /*
+ public function getCategoriesItems()
+ {
+ $categoryItems = category::pluck('name','id');
+ return $categoryItems;
+ }
+ */
+
+ /**
+ * Configure the Model
+ **/
+ public function model()
+ {
+ return Product::class;
+ }
+}
diff --git a/app/Repositories/BaseRepository.php b/Modules/Blog/app/Repositories/BaseRepository.php
similarity index 84%
rename from app/Repositories/BaseRepository.php
rename to Modules/Blog/app/Repositories/BaseRepository.php
index 35230cc..f649ca3 100644
--- a/app/Repositories/BaseRepository.php
+++ b/Modules/Blog/app/Repositories/BaseRepository.php
@@ -5,7 +5,6 @@
use Illuminate\Container\Container as Application;
use Illuminate\Database\Eloquent\Model;
-
abstract class BaseRepository
{
/**
@@ -19,8 +18,6 @@ abstract class BaseRepository
protected $app;
/**
- * @param Application $app
- *
* @throws \Exception
*/
public function __construct(Application $app)
@@ -46,15 +43,15 @@ abstract public function model();
/**
* Make Model instance
*
- * @throws \Exception
- *
* @return Model
+ *
+ * @throws \Exception
*/
public function makeModel()
{
$model = $this->app->make($this->model());
- if (!$model instanceof Model) {
+ if (! $model instanceof Model) {
throw new \Exception("Class {$this->model()} must be an instance of Illuminate\\Database\\Eloquent\\Model");
}
@@ -64,8 +61,8 @@ public function makeModel()
/**
* Paginate records for scaffold.
*
- * @param int $perPage
- * @param array $columns
+ * @param int $perPage
+ * @param array $columns
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
public function paginate($perPage, $columns = ['*'])
@@ -78,29 +75,28 @@ public function paginate($perPage, $columns = ['*'])
/**
* Build a query for retrieving all records.
*
- * @param array $search
- * @param int|null $skip
- * @param int|null $limit
+ * @param array $search
+ * @param int|null $skip
+ * @param int|null $limit
* @return \Illuminate\Database\Eloquent\Builder
*/
-
public function allQuery($search = [], $skip = null, $limit = null)
{
$query = $this->model->newQuery();
if (count($search)) {
- foreach($search as $key => $value) {
+ foreach ($search as $key => $value) {
if (in_array($key, $this->getFieldsSearchable())) {
$query->where($key, $value);
}
}
}
- if (!is_null($skip)) {
+ if (! is_null($skip)) {
$query->skip($skip);
}
- if (!is_null($limit)) {
+ if (! is_null($limit)) {
$query->limit($limit);
}
@@ -110,11 +106,10 @@ public function allQuery($search = [], $skip = null, $limit = null)
/**
* Retrieve all records with given filter criteria
*
- * @param array $search
- * @param int|null $skip
- * @param int|null $limit
- * @param array $columns
- *
+ * @param array $search
+ * @param int|null $skip
+ * @param int|null $limit
+ * @param array $columns
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
*/
public function all($search = [], $skip = null, $limit = null, $columns = ['*'])
@@ -127,8 +122,7 @@ public function all($search = [], $skip = null, $limit = null, $columns = ['*'])
/**
* Create model record
*
- * @param array $input
- *
+ * @param array $input
* @return Model
*/
public function create($input)
@@ -143,9 +137,8 @@ public function create($input)
/**
* Find model record for given id
*
- * @param int $id
- * @param array $columns
- *
+ * @param int $id
+ * @param array $columns
* @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|Model|null
*/
public function find($id, $columns = ['*'])
@@ -158,9 +151,8 @@ public function find($id, $columns = ['*'])
/**
* Update model record for given id
*
- * @param array $input
- * @param int $id
- *
+ * @param array $input
+ * @param int $id
* @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|Model
*/
public function update($input, $id)
@@ -177,11 +169,10 @@ public function update($input, $id)
}
/**
- * @param int $id
+ * @param int $id
+ * @return bool|mixed|null
*
* @throws \Exception
- *
- * @return bool|mixed|null
*/
public function delete($id)
{
diff --git a/Modules/Blog/app/Repositories/UserRepository.php b/Modules/Blog/app/Repositories/UserRepository.php
new file mode 100644
index 0000000..c63915f
--- /dev/null
+++ b/Modules/Blog/app/Repositories/UserRepository.php
@@ -0,0 +1,36 @@
+fieldSearchable;
+ }
+
+ /**
+ * Configure the Model
+ **/
+ public function model()
+ {
+ return User::class;
+ }
+}
diff --git a/app/helpers.php b/Modules/Blog/app/helpers.php
similarity index 92%
rename from app/helpers.php
rename to Modules/Blog/app/helpers.php
index c491470..12caa02 100644
--- a/app/helpers.php
+++ b/Modules/Blog/app/helpers.php
@@ -6,7 +6,7 @@
/*
* Global helpers file with misc functions.
*/
-if (!function_exists('app_name')) {
+if (! function_exists('app_name')) {
/**
* Helper to grab the application name.
*
@@ -21,7 +21,7 @@ function app_name()
/*
* Global helpers file with misc functions.
*/
-if (!function_exists('user_registration')) {
+if (! function_exists('user_registration')) {
/**
* Helper to grab the application name.
*
@@ -45,7 +45,7 @@ function user_registration()
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('label_case')) {
+if (! function_exists('label_case')) {
/**
* Prepare the Column Name for Lables.
@@ -69,14 +69,13 @@ function label_case($text)
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('show_column_value')) {
+if (! function_exists('show_column_value')) {
/**
* Return Column values as Raw and formatted.
*
- * @param string $valueObject Model Object
- * @param string $column Column Name
- * @param string $return_format Return Type
- *
+ * @param string $valueObject Model Object
+ * @param string $column Column Name
+ * @param string $return_format Return Type
* @return string Raw/Formatted Column Value
*/
function show_column_value($valueObject, $column, $return_format = '')
@@ -124,7 +123,7 @@ function show_column_value($valueObject, $column, $return_format = '')
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('fielf_required')) {
+if (! function_exists('fielf_required')) {
/**
* Prepare the Column Name for Lables.
@@ -146,7 +145,7 @@ function fielf_required($required)
*
* @var [type]
*/
-if (!function_exists('setting')) {
+if (! function_exists('setting')) {
function setting($key, $default = null)
{
if (is_null($key)) {
@@ -168,7 +167,7 @@ function setting($key, $default = null)
*
* @var [type]
*/
-if (!function_exists('humanFilesize')) {
+if (! function_exists('humanFilesize')) {
function humanFilesize($size, $precision = 2)
{
$units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
@@ -190,7 +189,7 @@ function humanFilesize($size, $precision = 2)
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('encode_id')) {
+if (! function_exists('encode_id')) {
/**
* Prepare the Column Name for Lables.
@@ -210,7 +209,7 @@ function encode_id($id)
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('decode_id')) {
+if (! function_exists('decode_id')) {
/**
* Prepare the Column Name for Lables.
@@ -235,7 +234,7 @@ function decode_id($hashid)
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('slug_format')) {
+if (! function_exists('slug_format')) {
/**
* Format a string to Slug.
@@ -263,7 +262,7 @@ function slug_format($string)
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('icon')) {
+if (! function_exists('icon')) {
/**
* Format a string to Slug.
@@ -284,17 +283,17 @@ function icon($string = 'fas fa-check')
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('logUserAccess')) {
+if (! function_exists('logUserAccess')) {
/**
* Format a string to Slug.
*/
- function logUserAccess($text = "")
+ function logUserAccess($text = '')
{
- $auth_text = "";
+ $auth_text = '';
if (\Auth::check()) {
- $auth_text = "User:".\Auth::user()->name." (ID:".\Auth::user()->id.")";
+ $auth_text = 'User:'.\Auth::user()->name.' (ID:'.\Auth::user()->id.')';
}
\Log::debug(label_case($text)." | $auth_text");
@@ -308,7 +307,7 @@ function logUserAccess($text = "")
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('bn2enNumber')) {
+if (! function_exists('bn2enNumber')) {
/**
* Prepare the Column Name for Lables.
@@ -331,7 +330,7 @@ function bn2enNumber($number)
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('en2bnNumber')) {
+if (! function_exists('en2bnNumber')) {
/**
* Prepare the Column Name for Lables.
@@ -354,7 +353,7 @@ function en2bnNumber($number)
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('en2bnDate')) {
+if (! function_exists('en2bnDate')) {
/**
* Convert a English number to Bengali.
@@ -398,7 +397,7 @@ function en2bnDate($date)
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('banglaDate')) {
+if (! function_exists('banglaDate')) {
function banglaDate($date_input = '')
{
if ($date_input == '') {
@@ -448,7 +447,7 @@ function banglaDate($date_input = '')
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('generate_rgb_code')) {
+if (! function_exists('generate_rgb_code')) {
/**
* Prepare the Column Name for Lables.
@@ -473,7 +472,7 @@ function generate_rgb_code($opacity = '0.9')
*
* ------------------------------------------------------------------------
*/
-if (!function_exists('date_today')) {
+if (! function_exists('date_today')) {
/**
* Return Date with weekday
diff --git a/Modules/Blog/artisan b/Modules/Blog/artisan
new file mode 100644
index 0000000..5c23e2e
--- /dev/null
+++ b/Modules/Blog/artisan
@@ -0,0 +1,53 @@
+#!/usr/bin/env php
+make(Illuminate\Contracts\Console\Kernel::class);
+
+$status = $kernel->handle(
+ $input = new Symfony\Component\Console\Input\ArgvInput,
+ new Symfony\Component\Console\Output\ConsoleOutput
+);
+
+/*
+|--------------------------------------------------------------------------
+| Shutdown The Application
+|--------------------------------------------------------------------------
+|
+| Once Artisan has finished running, we will fire off the shutdown events
+| so that any final work may be done by the application before we shut
+| down the process. This is the last thing to happen to the request.
+|
+*/
+
+$kernel->terminate($input, $status);
+
+exit($status);
diff --git a/Modules/Blog/bootstrap/app.php b/Modules/Blog/bootstrap/app.php
new file mode 100644
index 0000000..037e17d
--- /dev/null
+++ b/Modules/Blog/bootstrap/app.php
@@ -0,0 +1,55 @@
+singleton(
+ Illuminate\Contracts\Http\Kernel::class,
+ App\Http\Kernel::class
+);
+
+$app->singleton(
+ Illuminate\Contracts\Console\Kernel::class,
+ App\Console\Kernel::class
+);
+
+$app->singleton(
+ Illuminate\Contracts\Debug\ExceptionHandler::class,
+ App\Exceptions\Handler::class
+);
+
+/*
+|--------------------------------------------------------------------------
+| Return The Application
+|--------------------------------------------------------------------------
+|
+| This script returns the application instance. The instance is given to
+| the calling script so we can separate the building of the instances
+| from the actual running of the application and sending responses.
+|
+*/
+
+return $app;
diff --git a/storage/debugbar/.gitignore b/Modules/Blog/bootstrap/cache/.gitignore
similarity index 100%
rename from storage/debugbar/.gitignore
rename to Modules/Blog/bootstrap/cache/.gitignore
diff --git a/Modules/Blog/composer.json b/Modules/Blog/composer.json
new file mode 100644
index 0000000..285cf9e
--- /dev/null
+++ b/Modules/Blog/composer.json
@@ -0,0 +1,112 @@
+{
+ "name": "omaralalwi/laravel-starter-template",
+ "description": "A CMS like modular Laravel starter project.",
+ "keywords": ["framework", "laravel","admin panel", "cms", "starter", "admin", "admin dashboard","laravel-translatable","laravel-starter-template","laravel cms","laravel template"],
+ "license": "GPL-3.0-or-later",
+ "type": "project",
+ "version": "v8.2.1",
+ "require": {
+ "php": "^7.3.0",
+ "alexusmai/laravel-file-manager": "^2.5",
+ "arcanedev/log-viewer": "^8.0",
+ "cviebrock/eloquent-sluggable": "^8.0",
+ "doctrine/dbal": "~2.3",
+ "fakerphp/faker": "^1.12",
+ "fideloper/proxy": "^4.4",
+ "fruitcake/laravel-cors": "^2.0",
+ "guzzlehttp/guzzle": "^7.0.1",
+ "hashids/hashids": "^4.0",
+ "illuminatech/balance": "^1.1",
+ "infyomlabs/coreui-templates": "8.0.x-dev",
+ "infyomlabs/generator-builder": "dev-master",
+ "infyomlabs/laravel-generator": "8.0.x-dev",
+ "kreait/laravel-firebase": "^3.0",
+ "laracasts/flash": "^3.2",
+ "laravel/framework": "^8.0",
+ "laravel/slack-notification-channel": "^2.2",
+ "laravel/socialite": "^5.0",
+ "laravel/tinker": "^2.4",
+ "laravel/ui": "3.0",
+ "laravelcollective/html": "^6.2",
+ "laraveldaily/laravel-invoices": "^2.0",
+ "lavary/laravel-menu": "^1.7",
+ "mcamara/laravel-localization": "^1.6",
+ "mews/purifier": "^3.3",
+ "nwidart/laravel-modules": "^8.0",
+ "predis/predis": "^1.1",
+ "spatie/laravel-activitylog": "^3.16",
+ "spatie/laravel-backup": "^6.11",
+ "spatie/laravel-feed": "^2.7",
+ "spatie/laravel-fractal": "^5.8",
+ "spatie/laravel-html": "^2.28",
+ "spatie/laravel-medialibrary": "^9.0.0",
+ "spatie/laravel-permission": "^3.17",
+ "spatie/laravel-translatable": "^4.6",
+ "yajra/laravel-datatables": "^1.5"
+ },
+ "require-dev": {
+ "barryvdh/laravel-debugbar": "^3.2",
+ "facade/ignition": "^2.3.6",
+ "friendsofphp/php-cs-fixer": "^2.16",
+ "laravel/breeze": "^0.0.5",
+ "mockery/mockery": "^1.4",
+ "nunomaduro/collision": "^5.0",
+ "phpunit/phpunit": "^9.0"
+ },
+ "config": {
+ "optimize-autoloader": true,
+ "preferred-install": "auto",
+ "sort-packages": true
+ },
+ "extra": {
+ "laravel": {
+ "dont-discover": []
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "app/",
+ "Database\\Factories\\": "database/factories/",
+ "Database\\Seeders\\": "database/seeders/",
+ "Modules\\": "Modules/"
+ },
+ "classmap": [
+ "app/Models"
+ ],
+ "files": [
+ "app/helpers.php"
+ ]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Tests\\": "tests/"
+ }
+ },
+ "minimum-stability": "dev",
+ "prefer-stable": true,
+
+ "scripts": {
+ "post-autoload-dump": [
+ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
+ "@php artisan package:discover --ansi"
+ ],
+ "post-root-package-install": [
+ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
+ ],
+ "post-create-project-cmd": [
+ "@php artisan key:generate --ansi"
+ ],
+ "clear-all": [
+ "composer dumpautoload -o",
+ "@php artisan clear-compiled",
+ "@php artisan cache:clear",
+ "@php artisan route:clear",
+ "@php artisan view:clear",
+ "@php artisan config:clear",
+ "@php artisan cache:forget spatie.permission.cache"
+ ],
+ "fix-cs": [
+ "vendor/bin/php-cs-fixer fix"
+ ]
+ }
+}
diff --git a/config/activitylog.php b/Modules/Blog/config/activitylog.php
similarity index 100%
rename from config/activitylog.php
rename to Modules/Blog/config/activitylog.php
diff --git a/Modules/Blog/config/app.php b/Modules/Blog/config/app.php
new file mode 100644
index 0000000..baa2611
--- /dev/null
+++ b/Modules/Blog/config/app.php
@@ -0,0 +1,257 @@
+ env('APP_NAME', 'Laravel Starter Template'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application Environment
+ |--------------------------------------------------------------------------
+ |
+ | This value determines the "environment" your application is currently
+ | running in. This may determine how you prefer to configure various
+ | services the application utilizes. Set this in your ".env" file.
+ |
+ */
+
+ 'env' => env('APP_ENV', 'production'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application Debug Mode
+ |--------------------------------------------------------------------------
+ |
+ | When your application is in debug mode, detailed error messages with
+ | stack traces will be shown on every error that occurs within your
+ | application. If disabled, a simple generic error page is shown.
+ |
+ */
+
+ 'debug' => env('APP_DEBUG', false),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application URL
+ |--------------------------------------------------------------------------
+ |
+ | This URL is used by the console to properly generate URLs when using
+ | the Artisan command line tool. You should set this to the root of
+ | your application so that it is used when running Artisan tasks.
+ |
+ */
+
+ 'url' => env('APP_URL', 'http://localhost:8000'),
+
+ 'asset_url' => env('ASSET_URL', null),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application Timezone
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify the default timezone for your application, which
+ | will be used by the PHP date and date-time functions. We have gone
+ | ahead and set this to a sensible default for you out of the box.
+ |
+ */
+
+ 'timezone' => 'Asia/Riyadh',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application Locale Configuration
+ |--------------------------------------------------------------------------
+ |
+ | The application locale determines the default locale that will be used
+ | by the translation service provider. You are free to set this value
+ | to any of the locales which will be supported by the application.
+ |
+ */
+
+ 'locale' => 'en',
+
+ 'locales' => [
+ 'en' => 'English',
+ 'ar' => 'Arabic',
+ // Add as many languages you want
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application Fallback Locale
+ |--------------------------------------------------------------------------
+ |
+ | The fallback locale determines the locale to use when the current one
+ | is not available. You may change the value to correspond to any of
+ | the language folders that are provided through your application.
+ |
+ */
+
+ 'fallback_locale' => 'en',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Initial Username
+ |--------------------------------------------------------------------------
+ |
+ | Usernames is an unique number, generated automatically,
+ | and assigned to the user.
+ | It is needed to have an initial number and will be increased as
+ | a new user registered.
+ |
+ */
+
+ 'initial_username' => env('INITIAL_USERNAME', 100000),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Faker Locale
+ |--------------------------------------------------------------------------
+ |
+ | This locale will be used by the Faker PHP library when generating fake
+ | data for your database seeds. For example, this will be used to get
+ | localized telephone numbers, street address information and more.
+ |
+ */
+
+ 'faker_locale' => 'en_US',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Encryption Key
+ |--------------------------------------------------------------------------
+ |
+ | This key is used by the Illuminate encrypter service and should be set
+ | to a random, 32 character string, otherwise these encrypted strings
+ | will not be safe. Please do this before deploying an application!
+ |
+ */
+
+ 'key' => env('APP_KEY'),
+
+ 'cipher' => 'AES-256-CBC',
+
+ 'salt' => 'nGqhzPOVRpysbY5jlqe609e',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Autoloaded Service Providers
+ |--------------------------------------------------------------------------
+ |
+ | The service providers listed here will be automatically loaded on the
+ | request to your application. Feel free to add your own services to
+ | this array to grant expanded functionality to your applications.
+ |
+ */
+
+ 'providers' => [
+
+ /*
+ * Laravel Framework Service Providers...
+ */
+ Illuminate\Auth\AuthServiceProvider::class,
+ Illuminate\Broadcasting\BroadcastServiceProvider::class,
+ Illuminate\Bus\BusServiceProvider::class,
+ Illuminate\Cache\CacheServiceProvider::class,
+ Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
+ Illuminate\Cookie\CookieServiceProvider::class,
+ Illuminate\Database\DatabaseServiceProvider::class,
+ Illuminate\Encryption\EncryptionServiceProvider::class,
+ Illuminate\Filesystem\FilesystemServiceProvider::class,
+ Illuminate\Foundation\Providers\FoundationServiceProvider::class,
+ Illuminate\Hashing\HashServiceProvider::class,
+ Illuminate\Mail\MailServiceProvider::class,
+ Illuminate\Notifications\NotificationServiceProvider::class,
+ Illuminate\Pagination\PaginationServiceProvider::class,
+ Illuminate\Pipeline\PipelineServiceProvider::class,
+ Illuminate\Queue\QueueServiceProvider::class,
+ Illuminate\Redis\RedisServiceProvider::class,
+ Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
+ Illuminate\Session\SessionServiceProvider::class,
+ Illuminate\Translation\TranslationServiceProvider::class,
+ Illuminate\Validation\ValidationServiceProvider::class,
+ Illuminate\View\ViewServiceProvider::class,
+ InfyOm\GeneratorBuilder\GeneratorBuilderServiceProvider::class,
+
+ /*
+ * Package Service Providers...
+ */
+
+ /*
+ * Application Service Providers...
+ */
+ App\Providers\AppServiceProvider::class,
+ App\Providers\AuthServiceProvider::class,
+ // App\Providers\BroadcastServiceProvider::class,
+ App\Providers\EventServiceProvider::class,
+ App\Providers\RouteServiceProvider::class,
+
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Class Aliases
+ |--------------------------------------------------------------------------
+ |
+ | This array of class aliases will be registered when this application
+ | is started. However, feel free to register as many as you wish as
+ | the aliases are "lazy" loaded so they don't hinder performance.
+ |
+ */
+
+ 'aliases' => [
+
+ 'App' => Illuminate\Support\Facades\App::class,
+ 'Arr' => Illuminate\Support\Arr::class,
+ 'Artisan' => Illuminate\Support\Facades\Artisan::class,
+ 'Auth' => Illuminate\Support\Facades\Auth::class,
+ 'Blade' => Illuminate\Support\Facades\Blade::class,
+ 'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
+ 'Bus' => Illuminate\Support\Facades\Bus::class,
+ 'Cache' => Illuminate\Support\Facades\Cache::class,
+ 'Config' => Illuminate\Support\Facades\Config::class,
+ 'Cookie' => Illuminate\Support\Facades\Cookie::class,
+ 'Crypt' => Illuminate\Support\Facades\Crypt::class,
+ 'DB' => Illuminate\Support\Facades\DB::class,
+ 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
+ 'Event' => Illuminate\Support\Facades\Event::class,
+ 'File' => Illuminate\Support\Facades\File::class,
+ 'Gate' => Illuminate\Support\Facades\Gate::class,
+ 'Hash' => Illuminate\Support\Facades\Hash::class,
+ 'Lang' => Illuminate\Support\Facades\Lang::class,
+ 'Log' => Illuminate\Support\Facades\Log::class,
+ 'Mail' => Illuminate\Support\Facades\Mail::class,
+ 'Notification' => Illuminate\Support\Facades\Notification::class,
+ 'Password' => Illuminate\Support\Facades\Password::class,
+ 'Queue' => Illuminate\Support\Facades\Queue::class,
+ 'Redirect' => Illuminate\Support\Facades\Redirect::class,
+ 'Redis' => Illuminate\Support\Facades\Redis::class,
+ 'Request' => Illuminate\Support\Facades\Request::class,
+ 'Response' => Illuminate\Support\Facades\Response::class,
+ 'Route' => Illuminate\Support\Facades\Route::class,
+ 'Schema' => Illuminate\Support\Facades\Schema::class,
+ 'Session' => Illuminate\Support\Facades\Session::class,
+ 'Storage' => Illuminate\Support\Facades\Storage::class,
+ 'Str' => Illuminate\Support\Str::class,
+ 'URL' => Illuminate\Support\Facades\URL::class,
+ 'Validator' => Illuminate\Support\Facades\Validator::class,
+ 'View' => Illuminate\Support\Facades\View::class,
+ 'Form' => Collective\Html\FormFacade::class,
+ 'Html' => Collective\Html\HtmlFacade::class,
+ 'Flash' => Laracasts\Flash\Flash::class,
+
+ ],
+
+];
diff --git a/config/article.php b/Modules/Blog/config/article.php
similarity index 100%
rename from config/article.php
rename to Modules/Blog/config/article.php
diff --git a/Modules/Blog/config/auth.php b/Modules/Blog/config/auth.php
new file mode 100644
index 0000000..ba1a4d8
--- /dev/null
+++ b/Modules/Blog/config/auth.php
@@ -0,0 +1,117 @@
+ [
+ 'guard' => 'web',
+ 'passwords' => 'users',
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Authentication Guards
+ |--------------------------------------------------------------------------
+ |
+ | Next, you may define every authentication guard for your application.
+ | Of course, a great default configuration has been defined for you
+ | here which uses session storage and the Eloquent user provider.
+ |
+ | All authentication drivers have a user provider. This defines how the
+ | users are actually retrieved out of your database or other storage
+ | mechanisms used by this application to persist your user's data.
+ |
+ | Supported: "session", "token"
+ |
+ */
+
+ 'guards' => [
+ 'web' => [
+ 'driver' => 'session',
+ 'provider' => 'users',
+ ],
+
+ 'api' => [
+ 'driver' => 'token',
+ 'provider' => 'users',
+ 'hash' => false,
+ ],
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | User Providers
+ |--------------------------------------------------------------------------
+ |
+ | All authentication drivers have a user provider. This defines how the
+ | users are actually retrieved out of your database or other storage
+ | mechanisms used by this application to persist your user's data.
+ |
+ | If you have multiple user tables or models you may configure multiple
+ | sources which represent each model / table. These sources may then
+ | be assigned to any extra authentication guards you have defined.
+ |
+ | Supported: "database", "eloquent"
+ |
+ */
+
+ 'providers' => [
+ 'users' => [
+ 'driver' => 'eloquent',
+ 'model' => App\Models\User::class,
+ ],
+
+ // 'users' => [
+ // 'driver' => 'database',
+ // 'table' => 'users',
+ // ],
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Resetting Passwords
+ |--------------------------------------------------------------------------
+ |
+ | You may specify multiple password reset configurations if you have more
+ | than one user table or model in the application and you want to have
+ | separate password reset settings based on the specific user types.
+ |
+ | The expire time is the number of minutes that the reset token should be
+ | considered valid. This security feature keeps tokens short-lived so
+ | they have less time to be guessed. You may change this as needed.
+ |
+ */
+
+ 'passwords' => [
+ 'users' => [
+ 'provider' => 'users',
+ 'table' => 'password_resets',
+ 'expire' => 60,
+ 'throttle' => 60,
+ ],
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Password Confirmation Timeout
+ |--------------------------------------------------------------------------
+ |
+ | Here you may define the amount of seconds before a password confirmation
+ | times out and the user is prompted to re-enter their password via the
+ | confirmation screen. By default, the timeout lasts for three hours.
+ |
+ */
+
+ 'password_timeout' => 10800,
+
+];
diff --git a/config/backup.php b/Modules/Blog/config/backup.php
similarity index 95%
rename from config/backup.php
rename to Modules/Blog/config/backup.php
index 5e29889..20f90a7 100644
--- a/config/backup.php
+++ b/Modules/Blog/config/backup.php
@@ -116,12 +116,12 @@
'notifications' => [
'notifications' => [
- \Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => ['mail'],
+ \Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => ['mail'],
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'],
- \Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => ['mail'],
- \Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => ['mail'],
- \Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => ['mail'],
- \Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => ['mail'],
+ \Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => ['mail'],
+ \Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => ['mail'],
+ \Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => ['mail'],
+ \Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => ['mail'],
],
/*
@@ -135,7 +135,7 @@
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
- 'name' => env('MAIL_FROM_NAME', 'Example'),
+ 'name' => env('MAIL_FROM_NAME', 'Example'),
],
],
@@ -161,10 +161,10 @@
*/
'monitor_backups' => [
[
- 'name' => env('APP_NAME', 'laravel-backup'),
- 'disks' => ['local'],
+ 'name' => env('APP_NAME', 'laravel-backup'),
+ 'disks' => ['local'],
'health_checks' => [
- \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
+ \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
],
],
diff --git a/config/balance.php b/Modules/Blog/config/balance.php
similarity index 100%
rename from config/balance.php
rename to Modules/Blog/config/balance.php
diff --git a/config/broadcasting.php b/Modules/Blog/config/broadcasting.php
similarity index 81%
rename from config/broadcasting.php
rename to Modules/Blog/config/broadcasting.php
index ec2d8a3..17718d2 100644
--- a/config/broadcasting.php
+++ b/Modules/Blog/config/broadcasting.php
@@ -15,7 +15,7 @@
|
*/
- 'default' => env('BROADCAST_DRIVER', 'null'),
+ 'default' => env('BROADCAST_CONNECTION', 'null'),
/*
|--------------------------------------------------------------------------
@@ -31,18 +31,18 @@
'connections' => [
'pusher' => [
- 'driver' => 'pusher',
- 'key' => env('PUSHER_APP_KEY'),
- 'secret' => env('PUSHER_APP_SECRET'),
- 'app_id' => env('PUSHER_APP_ID'),
+ 'driver' => 'pusher',
+ 'key' => env('PUSHER_APP_KEY'),
+ 'secret' => env('PUSHER_APP_SECRET'),
+ 'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
- 'useTLS' => true,
+ 'useTLS' => true,
],
],
'redis' => [
- 'driver' => 'redis',
+ 'driver' => 'redis',
'connection' => 'default',
],
diff --git a/Modules/Blog/config/cache.php b/Modules/Blog/config/cache.php
new file mode 100644
index 0000000..c6a65fa
--- /dev/null
+++ b/Modules/Blog/config/cache.php
@@ -0,0 +1,103 @@
+ env('CACHE_STORE', 'file'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Cache Stores
+ |--------------------------------------------------------------------------
+ |
+ | Here you may define all of the cache "stores" for your application as
+ | well as their drivers. You may even define multiple stores for the
+ | same cache driver to group types of items stored in your caches.
+ |
+ */
+
+ 'stores' => [
+
+ 'apc' => [
+ 'driver' => 'apc',
+ ],
+
+ 'array' => [
+ 'driver' => 'array',
+ ],
+
+ 'database' => [
+ 'driver' => 'database',
+ 'table' => 'cache',
+ 'connection' => null,
+ ],
+
+ 'file' => [
+ 'driver' => 'file',
+ 'path' => storage_path('framework/cache/data'),
+ ],
+
+ 'memcached' => [
+ 'driver' => 'memcached',
+ 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
+ 'sasl' => [
+ env('MEMCACHED_USERNAME'),
+ env('MEMCACHED_PASSWORD'),
+ ],
+ 'options' => [
+ // Memcached::OPT_CONNECT_TIMEOUT => 2000,
+ ],
+ 'servers' => [
+ [
+ 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
+ 'port' => env('MEMCACHED_PORT', 11211),
+ 'weight' => 100,
+ ],
+ ],
+ ],
+
+ 'redis' => [
+ 'driver' => 'redis',
+ 'connection' => 'cache',
+ ],
+
+ 'dynamodb' => [
+ 'driver' => 'dynamodb',
+ 'key' => env('AWS_ACCESS_KEY_ID'),
+ 'secret' => env('AWS_SECRET_ACCESS_KEY'),
+ 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
+ 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
+ 'endpoint' => env('DYNAMODB_ENDPOINT'),
+ ],
+
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Cache Key Prefix
+ |--------------------------------------------------------------------------
+ |
+ | When utilizing a RAM based store such as APC or Memcached, there might
+ | be other applications utilizing the same cache. So, we'll specify a
+ | value to get prefixed to all our keys so we can avoid collisions.
+ |
+ */
+
+ 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
+
+];
diff --git a/Modules/Blog/config/comment.php b/Modules/Blog/config/comment.php
new file mode 100644
index 0000000..b70b963
--- /dev/null
+++ b/Modules/Blog/config/comment.php
@@ -0,0 +1,5 @@
+ 'Comment',
+];
diff --git a/config/cors.php b/Modules/Blog/config/cors.php
similarity index 100%
rename from config/cors.php
rename to Modules/Blog/config/cors.php
diff --git a/Modules/Blog/config/database.php b/Modules/Blog/config/database.php
new file mode 100644
index 0000000..9c97969
--- /dev/null
+++ b/Modules/Blog/config/database.php
@@ -0,0 +1,149 @@
+ env('DB_CONNECTION', 'mysql'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Database Connections
+ |--------------------------------------------------------------------------
+ |
+ | Here are each of the database connections setup for your application.
+ | Of course, examples of configuring each database platform that is
+ | supported by Laravel is shown below to make development simple.
+ |
+ |
+ | All database work in Laravel is done through the PHP PDO facilities
+ | so make sure you have the driver for your particular database of
+ | choice installed on your machine before you begin development.
+ |
+ */
+
+ 'connections' => [
+
+ 'sqlite' => [
+ 'driver' => 'sqlite',
+ 'url' => env('DB_URL'),
+ 'database' => env('DB_DATABASE', database_path('database.sqlite')),
+ 'prefix' => '',
+ 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
+ ],
+
+ 'mysql' => [
+ 'driver' => 'mysql',
+ 'url' => env('DB_URL'),
+ 'host' => env('DB_HOST', '127.0.0.1'),
+ 'port' => env('DB_PORT', '3306'),
+ 'database' => env('DB_DATABASE', 'forge'),
+ 'username' => env('DB_USERNAME', 'forge'),
+ 'password' => env('DB_PASSWORD', ''),
+ 'unix_socket' => env('DB_SOCKET', ''),
+ 'charset' => 'utf8',
+ 'collation' => 'utf8_unicode_ci',
+ 'prefix' => '',
+ 'prefix_indexes' => true,
+ 'strict' => true,
+ 'engine' => null,
+ 'options' => extension_loaded('pdo_mysql') ? array_filter([
+ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
+ ]) : [],
+ ],
+
+ 'pgsql' => [
+ 'driver' => 'pgsql',
+ 'url' => env('DB_URL'),
+ 'host' => env('DB_HOST', '127.0.0.1'),
+ 'port' => env('DB_PORT', '5432'),
+ 'database' => env('DB_DATABASE', 'forge'),
+ 'username' => env('DB_USERNAME', 'forge'),
+ 'password' => env('DB_PASSWORD', ''),
+ 'charset' => 'utf8',
+ 'collation' => 'utf8_unicode_ci',
+ 'prefix' => '',
+ 'prefix_indexes' => true,
+ 'schema' => 'public',
+ 'sslmode' => 'prefer',
+ ],
+
+ 'sqlsrv' => [
+ 'driver' => 'sqlsrv',
+ 'url' => env('DB_URL'),
+ 'host' => env('DB_HOST', 'localhost'),
+ 'port' => env('DB_PORT', '1433'),
+ 'database' => env('DB_DATABASE', 'forge'),
+ 'username' => env('DB_USERNAME', 'forge'),
+ 'password' => env('DB_PASSWORD', ''),
+ 'charset' => 'utf8',
+ 'collation' => 'utf8_unicode_ci',
+ 'prefix' => '',
+ 'prefix_indexes' => true,
+ ],
+
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Migration Repository Table
+ |--------------------------------------------------------------------------
+ |
+ | This table keeps track of all the migrations that have already run for
+ | your application. Using this information, we can determine which of
+ | the migrations on disk haven't actually been run in the database.
+ |
+ */
+
+ 'migrations' => 'migrations',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Redis Databases
+ |--------------------------------------------------------------------------
+ |
+ | Redis is an open source, fast, and advanced key-value store that also
+ | provides a richer body of commands than a typical key-value system
+ | such as APC or Memcached. Laravel makes it easy to dig right in.
+ |
+ */
+
+ 'redis' => [
+
+ 'client' => env('REDIS_CLIENT', 'phpredis'),
+
+ 'options' => [
+ 'cluster' => env('REDIS_CLUSTER', 'redis'),
+ 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
+ ],
+
+ 'default' => [
+ 'url' => env('REDIS_URL'),
+ 'host' => env('REDIS_HOST', '127.0.0.1'),
+ 'password' => env('REDIS_PASSWORD', null),
+ 'port' => env('REDIS_PORT', '6379'),
+ 'database' => env('REDIS_DB', '0'),
+ ],
+
+ 'cache' => [
+ 'url' => env('REDIS_URL'),
+ 'host' => env('REDIS_HOST', '127.0.0.1'),
+ 'password' => env('REDIS_PASSWORD', null),
+ 'port' => env('REDIS_PORT', '6379'),
+ 'database' => env('REDIS_CACHE_DB', '1'),
+ ],
+
+ ],
+
+];
diff --git a/config/datatables-buttons.php b/Modules/Blog/config/datatables-buttons.php
similarity index 83%
rename from config/datatables-buttons.php
rename to Modules/Blog/config/datatables-buttons.php
index 54bd787..31ed446 100644
--- a/config/datatables-buttons.php
+++ b/Modules/Blog/config/datatables-buttons.php
@@ -4,7 +4,7 @@
/*
* Namespaces used by the generator.
*/
- 'namespace' => [
+ 'namespace' => [
/*
* Base namespace/directory to create the new file.
* This is appended on default Laravel namespace.
@@ -13,7 +13,7 @@
* With Model: App\User (default model)
* Export filename: users_timestamp
*/
- 'base' => 'DataTables',
+ 'base' => 'DataTables',
/*
* Base namespace/directory where your model's are located.
@@ -42,12 +42,12 @@
/*
* Snappy PDF options.
*/
- 'snappy' => [
- 'options' => [
- 'no-outline' => true,
- 'margin-left' => '0',
- 'margin-right' => '0',
- 'margin-top' => '10mm',
+ 'snappy' => [
+ 'options' => [
+ 'no-outline' => true,
+ 'margin-left' => '0',
+ 'margin-right' => '0',
+ 'margin-top' => '10mm',
'margin-bottom' => '10mm',
],
'orientation' => 'landscape',
@@ -56,9 +56,9 @@
/*
* Default html builder parameters.
*/
- 'parameters' => [
- 'dom' => 'Bfrtip',
- 'order' => [[0, 'desc']],
+ 'parameters' => [
+ 'dom' => 'Bfrtip',
+ 'order' => [[0, 'desc']],
'buttons' => [
'create',
'export',
@@ -71,7 +71,7 @@
/*
* Generator command default options value.
*/
- 'generator' => [
+ 'generator' => [
/*
* Default columns to generate when not set.
*/
diff --git a/config/datatables-fractal.php b/Modules/Blog/config/datatables-fractal.php
similarity index 87%
rename from config/datatables-fractal.php
rename to Modules/Blog/config/datatables-fractal.php
index 25f547a..39250f1 100644
--- a/config/datatables-fractal.php
+++ b/Modules/Blog/config/datatables-fractal.php
@@ -4,7 +4,7 @@
/*
* Request key name to parse includes on fractal.
*/
- 'includes' => 'include',
+ 'includes' => 'include',
/*
* Default fractal serializer.
diff --git a/config/datatables-html.php b/Modules/Blog/config/datatables-html.php
similarity index 94%
rename from config/datatables-html.php
rename to Modules/Blog/config/datatables-html.php
index 516d313..3ea1cc1 100644
--- a/config/datatables-html.php
+++ b/Modules/Blog/config/datatables-html.php
@@ -12,7 +12,7 @@
*/
'table' => [
'class' => 'table',
- 'id' => 'dataTableBuilder',
+ 'id' => 'dataTableBuilder',
],
/*
diff --git a/config/datatables.php b/Modules/Blog/config/datatables.php
similarity index 82%
rename from config/datatables.php
rename to Modules/Blog/config/datatables.php
index ed2e36f..77cc9e2 100644
--- a/config/datatables.php
+++ b/Modules/Blog/config/datatables.php
@@ -4,17 +4,17 @@
/*
* DataTables search options.
*/
- 'search' => [
+ 'search' => [
/*
* Smart search will enclose search keyword with wildcard string "%keyword%".
* SQL: column LIKE "%keyword%"
*/
- 'smart' => true,
+ 'smart' => true,
/*
* Multi-term search will explode search keyword using spaces resulting into multiple term search.
*/
- 'multi_term' => true,
+ 'multi_term' => true,
/*
* Case insensitive will search the keyword in lower case format.
@@ -26,29 +26,29 @@
* Wild card will add "%" in between every characters of the keyword.
* SQL: column LIKE "%k%e%y%w%o%r%d%"
*/
- 'use_wildcards' => false,
+ 'use_wildcards' => false,
/*
* Perform a search which starts with the given keyword.
* SQL: column LIKE "keyword%"
*/
- 'starts_with' => false,
+ 'starts_with' => false,
],
/*
* DataTables internal index id response column name.
*/
- 'index_column' => 'DT_RowIndex',
+ 'index_column' => 'DT_RowIndex',
/*
* List of available builders for DataTables.
* This is where you can register your custom dataTables builder.
*/
- 'engines' => [
- 'eloquent' => Yajra\DataTables\EloquentDataTable::class,
- 'query' => Yajra\DataTables\QueryDataTable::class,
+ 'engines' => [
+ 'eloquent' => Yajra\DataTables\EloquentDataTable::class,
+ 'query' => Yajra\DataTables\QueryDataTable::class,
'collection' => Yajra\DataTables\CollectionDataTable::class,
- 'resource' => Yajra\DataTables\ApiResourceDataTable::class,
+ 'resource' => Yajra\DataTables\ApiResourceDataTable::class,
],
/*
@@ -56,7 +56,7 @@
* This is where you can override which engine a builder should use
* Note, only change this if you know what you are doing!
*/
- 'builders' => [
+ 'builders' => [
//Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent',
//Illuminate\Database\Eloquent\Builder::class => 'eloquent',
//Illuminate\Database\Query\Builder::class => 'query',
@@ -76,28 +76,28 @@
* 'throw' - Throws a \Yajra\DataTables\Exceptions\Exception. Use your custom error handler if needed.
* 'custom message' - Any friendly message to be displayed to the user. You can also use translation key.
*/
- 'error' => env('DATATABLES_ERROR', null),
+ 'error' => env('DATATABLES_ERROR', null),
/*
* Default columns definition of dataTable utility functions.
*/
- 'columns' => [
+ 'columns' => [
/*
* List of columns hidden/removed on json response.
*/
- 'excess' => ['rn', 'row_num'],
+ 'excess' => ['rn', 'row_num'],
/*
* List of columns to be escaped. If set to *, all columns are escape.
* Note: You can set the value to empty array to disable XSS protection.
*/
- 'escape' => '*',
+ 'escape' => '*',
/*
* List of columns that are allowed to display html content.
* Note: Adding columns to list will make us available to XSS attacks.
*/
- 'raw' => ['action'],
+ 'raw' => ['action'],
/*
* List of columns are are forbidden from being searched/sorted.
@@ -114,8 +114,8 @@
/*
* JsonResponse header and options config.
*/
- 'json' => [
- 'header' => [],
+ 'json' => [
+ 'header' => [],
'options' => 0,
],
diff --git a/Modules/Blog/config/debugbar.php b/Modules/Blog/config/debugbar.php
new file mode 100644
index 0000000..894ee21
--- /dev/null
+++ b/Modules/Blog/config/debugbar.php
@@ -0,0 +1,202 @@
+ env('DEBUGBAR_ENABLED', null),
+ 'except' => [
+ 'telescope*',
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Storage settings
+ |--------------------------------------------------------------------------
+ |
+ | DebugBar stores data for session/ajax requests.
+ | You can disable this, so the debugbar stores data in headers/session,
+ | but this can cause problems with large data collectors.
+ | By default, file storage (in the storage folder) is used. Redis and PDO
+ | can also be used. For PDO, run the package migrations first.
+ |
+ */
+ 'storage' => [
+ 'enabled' => true,
+ 'driver' => 'file', // redis, file, pdo, custom
+ 'path' => storage_path('debugbar'), // For file driver
+ 'connection' => null, // Leave null for default connection (Redis/PDO)
+ 'provider' => '', // Instance of StorageInterface for custom driver
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Vendors
+ |--------------------------------------------------------------------------
+ |
+ | Vendor files are included by default, but can be set to false.
+ | This can also be set to 'js' or 'css', to only include javascript or css vendor files.
+ | Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
+ | and for js: jquery and and highlight.js
+ | So if you want syntax highlighting, set it to true.
+ | jQuery is set to not conflict with existing jQuery scripts.
+ |
+ */
+
+ 'include_vendors' => true,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Capture Ajax Requests
+ |--------------------------------------------------------------------------
+ |
+ | The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
+ | you can use this option to disable sending the data through the headers.
+ |
+ | Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
+ */
+
+ 'capture_ajax' => true,
+ 'add_ajax_timing' => false,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Custom Error Handler for Deprecated warnings
+ |--------------------------------------------------------------------------
+ |
+ | When enabled, the Debugbar shows deprecated warnings for Symfony components
+ | in the Messages tab.
+ |
+ */
+ 'error_handler' => false,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Clockwork integration
+ |--------------------------------------------------------------------------
+ |
+ | The Debugbar can emulate the Clockwork headers, so you can use the Chrome
+ | Extension, without the server-side code. It uses Debugbar collectors instead.
+ |
+ */
+ 'clockwork' => false,
+
+ /*
+ |--------------------------------------------------------------------------
+ | DataCollectors
+ |--------------------------------------------------------------------------
+ |
+ | Enable/disable DataCollectors
+ |
+ */
+
+ 'collectors' => [
+ 'phpinfo' => true, // Php version
+ 'messages' => true, // Messages
+ 'time' => true, // Time Datalogger
+ 'memory' => true, // Memory usage
+ 'exceptions' => true, // Exception displayer
+ 'log' => true, // Logs from Monolog (merged in messages if enabled)
+ 'db' => true, // Show database (PDO) queries and bindings
+ 'views' => true, // Views with their data
+ 'route' => true, // Current route information
+ 'auth' => false, // Display Laravel authentication status
+ 'gate' => true, // Display Laravel Gate checks
+ 'session' => true, // Display session data
+ 'symfony_request' => true, // Only one can be enabled..
+ 'mail' => true, // Catch mail messages
+ 'laravel' => false, // Laravel version and environment
+ 'events' => false, // All events fired
+ 'default_request' => false, // Regular or special Symfony request logger
+ 'logs' => false, // Add the latest log messages
+ 'files' => false, // Show the included files
+ 'config' => false, // Display config settings
+ 'cache' => false, // Display cache events
+ 'models' => false, // Display models
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Extra options
+ |--------------------------------------------------------------------------
+ |
+ | Configure some DataCollectors
+ |
+ */
+
+ 'options' => [
+ 'auth' => [
+ 'show_name' => true, // Also show the users name/email in the debugbar
+ ],
+ 'db' => [
+ 'with_params' => true, // Render SQL with the parameters substituted
+ 'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
+ 'timeline' => false, // Add the queries to the timeline
+ 'explain' => [ // Show EXPLAIN output on queries
+ 'enabled' => false,
+ 'types' => ['SELECT'], // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
+ ],
+ 'hints' => true, // Show hints for common mistakes
+ ],
+ 'mail' => [
+ 'full_log' => false,
+ ],
+ 'views' => [
+ 'data' => false, //Note: Can slow down the application, because the data can be quite large..
+ ],
+ 'route' => [
+ 'label' => true, // show complete route on bar
+ ],
+ 'logs' => [
+ 'file' => null,
+ ],
+ 'cache' => [
+ 'values' => true, // collect cache values
+ ],
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Inject Debugbar in Response
+ |--------------------------------------------------------------------------
+ |
+ | Usually, the debugbar is added just before