├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── app ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── Api │ │ │ ├── CategoryController.php │ │ │ ├── PermissionController.php │ │ │ ├── PostController.php │ │ │ ├── ProfileController.php │ │ │ ├── RoleController.php │ │ │ └── UserController.php │ │ ├── Auth │ │ │ ├── AuthenticatedSessionController.php │ │ │ ├── ConfirmPasswordController.php │ │ │ ├── ForgotPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── RegisterController.php │ │ │ ├── ResetPasswordController.php │ │ │ └── VerificationController.php │ │ ├── Controller.php │ │ └── HomeController.php │ ├── Kernel.php │ ├── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ ├── ValidateSignature.php │ │ └── VerifyCsrfToken.php │ ├── Requests │ │ ├── Auth │ │ │ ├── LoginRequest.php │ │ │ └── RegisterRequest.php │ │ ├── StoreCategoryRequest.php │ │ ├── StorePermissionRequest.php │ │ ├── StorePostRequest.php │ │ ├── StoreRoleRequest.php │ │ └── UpdateProfileRequest.php │ └── Resources │ │ ├── CategoryResource.php │ │ ├── PermissionResource.php │ │ ├── PostResource.php │ │ ├── RoleResource.php │ │ └── UserResource.php ├── Models │ ├── Category.php │ ├── Permission.php │ ├── Post.php │ ├── Role.php │ └── User.php └── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── database.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── permission.php ├── queue.php ├── sanctum.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2019_12_14_000001_create_personal_access_tokens_table.php │ ├── 2022_09_30_172105_create_permission_tables.php │ ├── 2022_09_30_181156_create_posts_table.php │ └── 2022_09_30_181227_create_categories_table.php └── seeders │ ├── CreateAdminUserSeeder.php │ ├── DatabaseSeeder.php │ └── PermissionTableSeeder.php ├── lang └── en │ ├── auth.php │ ├── pagination.php │ ├── passwords.php │ └── validation.php ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── favicon.ico ├── index.php └── robots.txt ├── resources ├── css │ └── app.css ├── js │ ├── app.js │ ├── bootstrap.js │ ├── components │ │ ├── Admin │ │ │ ├── Create.vue │ │ │ ├── Edit.vue │ │ │ └── Index.vue │ │ ├── ExampleComponent.vue │ │ ├── Footer.vue │ │ ├── LocaleSwitcher.vue │ │ ├── Nav.vue │ │ └── includes │ │ │ ├── AdminNavbar.vue │ │ │ ├── AdminSidebar.vue │ │ │ └── Breadcrumb.vue │ ├── composables │ │ ├── auth.js │ │ ├── categories.js │ │ ├── permissions.js │ │ ├── posts.js │ │ ├── profile.js │ │ ├── roles.js │ │ └── users.js │ ├── lang │ │ ├── bn.json │ │ ├── en.json │ │ ├── es.json │ │ ├── fr.json │ │ ├── pt-BR.json │ │ └── zh-CN.json │ ├── layouts │ │ ├── Admin.vue │ │ ├── Authenticated.vue │ │ ├── Error.vue │ │ └── Guest.vue │ ├── plugins │ │ └── i18n.js │ ├── routes │ │ ├── index.js │ │ └── routes.js │ ├── services │ │ └── ability.js │ ├── store │ │ ├── auth.js │ │ ├── index.js │ │ ├── lang.js │ │ └── oldindex.js │ ├── validation │ │ └── rules.js │ └── views │ │ ├── admin │ │ ├── categories │ │ │ ├── Create.vue │ │ │ ├── Edit.vue │ │ │ └── Index.vue │ │ ├── index.vue │ │ ├── permissions │ │ │ ├── Create.vue │ │ │ ├── Edit.vue │ │ │ └── index.vue │ │ ├── posts │ │ │ ├── Create.vue │ │ │ ├── Edit.vue │ │ │ └── Index.vue │ │ ├── profile │ │ │ └── index.vue │ │ ├── roles │ │ │ ├── Create.vue │ │ │ ├── Edit.vue │ │ │ └── index.vue │ │ └── users │ │ │ └── index.vue │ │ ├── auth │ │ ├── Verify.vue │ │ └── passwords │ │ │ ├── Confirm.vue │ │ │ ├── Email.vue │ │ │ └── Reset.vue │ │ ├── category │ │ └── posts.vue │ │ ├── errors │ │ └── 404.vue │ │ ├── home │ │ └── index.vue │ │ ├── login │ │ └── Login.vue │ │ ├── posts │ │ ├── details.vue │ │ └── index.vue │ │ └── register │ │ └── index.vue ├── sass │ ├── _variables.scss │ └── app.scss └── views │ ├── auth │ ├── login.blade.php │ ├── passwords │ │ ├── confirm.blade.php │ │ ├── email.blade.php │ │ └── reset.blade.php │ ├── register.blade.php │ └── verify.blade.php │ ├── home.blade.php │ ├── layouts │ ├── app.blade.php │ └── master.blade.php │ ├── main-view.blade.php │ └── welcome.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tests ├── CreatesApplication.php ├── Feature │ └── ExampleTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php ├── vite.config.js ├── vue.config.js └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=laravel 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=cookie 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailhog 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS="hello@example.com" 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 55 | VITE_PUSHER_HOST="${PUSHER_HOST}" 56 | VITE_PUSHER_PORT="${PUSHER_PORT}" 57 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 58 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 59 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/build 3 | /public/hot 4 | /public/storage 5 | /storage/*.key 6 | /vendor 7 | .env 8 | .env.backup 9 | .phpunit.result.cache 10 | Homestead.json 11 | Homestead.yaml 12 | auth.json 13 | npm-debug.log 14 | yarn-error.log 15 | /.idea 16 | /.vscode 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Fazle Rabbi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Laravel Vue.js 3 SPA Starter Boilerplate 2 | 3 | A simple and clean boilerplate to start a new SPA project with authentication, user, roles, permissions management and more features. This boilerplate uses the following tools: 4 | 5 | - [Laravel 10.x](https://github.com/laravel/laravel) 6 | - [Laravel Sanctum](https://laravel.com/docs/10.x/sanctum) 7 | - [Vue 3](https://github.com/vuejs/vue) 8 | - [Vue Router](https://router.vuejs.org/) 9 | - [Vuex](https://vuex.vuejs.org/) 10 | - [Bootstrap](https://getbootstrap.com/) 11 | - [Vue I18n](https://vue-i18n.intlify.dev) 12 | 13 | Laravel is accessible, powerful, and provides tools required for large, robust applications. 14 | 15 | ## Features 16 | 17 | The following Sanctum features are implemented in this Vue SPA: 18 | 19 | - ✅ Laravel 10 20 | - ✅ Vue 3 21 | - ✅ VueRouter + Vuex 22 | - ✅ Vue I18n Multi Language 23 | - ✅ Login 24 | - ✅ Password Reset 25 | - ✅ Registration 26 | - ✅ Admin Panel 27 | - ✅ Profile Management 28 | - ✅ User Management 29 | - ✅ Roles Management 30 | - ✅ Permissions Management 31 | - ✅ Password Change 32 | - ✅ E-Mail Verification 33 | - ✅ Posts Management 34 | - ✅ Frontend Blog 35 | - ✅ Bootstrap 5 36 | 37 | ## How To Use 38 | #### Clone the repository 39 | 40 | ```bash 41 | git clone https://github.com/irabbi360/laravel-vue3-spa-starter.git 42 | ``` 43 | 44 | #### Copy .env.example file to .env and edit credentials also set app url 45 | 46 | #### Install Via Composer 47 | 48 | ```bash 49 | composer install 50 | ``` 51 | 52 | #### Generate Application Key 53 | 54 | ```bash 55 | php artisan key:generate 56 | ``` 57 | 58 | #### Migrate Database 59 | 60 | ```bash 61 | php artisan migrate 62 | ``` 63 | 64 | #### Run Seeder 65 | 66 | ```bash 67 | php artisan db:seed 68 | ``` 69 | 70 | #### Install Node Dependencies 71 | 72 | ```bash 73 | npm install or yarn install 74 | 75 | npm run dev or yarn dev 76 | ``` 77 | #### Production 78 | 79 | ```bash 80 | npm run build or yarn build 81 | ``` 82 | 83 | ## Email Verification 84 | 85 | To enable email verification make sure that your `App\User` model implements the `Illuminate\Contracts\Auth\MustVerifyEmail` contract. 86 | 87 | ## Contributing 88 | 89 | Thank you for considering contributing to the project! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). 90 | 91 | ## Code of Conduct 92 | 93 | In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). 94 | 95 | ## Security Vulnerabilities 96 | 97 | If you discover a security vulnerability within Laravel, please send an e-mail via [fazrabbi010@gmail.com](mailto:fazrabbi010@gmail.com). All security vulnerabilities will be promptly addressed. 98 | 99 | ## License 100 | 101 | The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). 102 | The Vue framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). 103 | This repository is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). 104 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 19 | } 20 | 21 | /** 22 | * Register the commands for the application. 23 | * 24 | * @return void 25 | */ 26 | protected function commands() 27 | { 28 | $this->load(__DIR__.'/Commands'); 29 | 30 | require base_path('routes/console.php'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | , \Psr\Log\LogLevel::*> 14 | */ 15 | protected $levels = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the exception types that are not reported. 21 | * 22 | * @var array> 23 | */ 24 | protected $dontReport = [ 25 | // 26 | ]; 27 | 28 | /** 29 | * A list of the inputs that are never flashed to the session on validation exceptions. 30 | * 31 | * @var array 32 | */ 33 | protected $dontFlash = [ 34 | 'current_password', 35 | 'password', 36 | 'password_confirmation', 37 | ]; 38 | 39 | /** 40 | * Register the exception handling callbacks for the application. 41 | * 42 | * @return void 43 | */ 44 | public function register() 45 | { 46 | $this->reportable(function (Throwable $e) { 47 | // 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/CategoryController.php: -------------------------------------------------------------------------------- 1 | where('id', request('search_id')); 26 | }) 27 | ->when(request('search_title'), function ($query) { 28 | $query->where('name', 'like', '%'.request('search_title').'%'); 29 | }) 30 | ->when(request('search_global'), function ($query) { 31 | $query->where(function($q) { 32 | $q->where('id', request('search_global')) 33 | ->orWhere('name', 'like', '%'.request('search_global').'%'); 34 | 35 | }); 36 | }) 37 | ->orderBy($orderColumn, $orderDirection) 38 | ->paginate(50); 39 | return CategoryResource::collection($categories); 40 | } 41 | 42 | public function store(StoreCategoryRequest $request) 43 | { 44 | $this->authorize('category-create'); 45 | $category = Category::create($request->validated()); 46 | 47 | return new CategoryResource($category); 48 | } 49 | 50 | public function show(Category $category) 51 | { 52 | $this->authorize('category-edit'); 53 | return new CategoryResource($category); 54 | } 55 | 56 | public function update(Category $category, StoreCategoryRequest $request) 57 | { 58 | $this->authorize('category-edit'); 59 | $category->update($request->validated()); 60 | 61 | return new CategoryResource($category); 62 | } 63 | 64 | public function destroy(Category $category) { 65 | $this->authorize('category-delete'); 66 | $category->delete(); 67 | 68 | return response()->noContent(); 69 | } 70 | 71 | public function getList() 72 | { 73 | return CategoryResource::collection(Category::all()); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/PostController.php: -------------------------------------------------------------------------------- 1 | when(request('search_category'), function ($query) { 25 | $query->where('category_id', request('search_category')); 26 | }) 27 | ->when(request('search_id'), function ($query) { 28 | $query->where('id', request('search_id')); 29 | }) 30 | ->when(request('search_title'), function ($query) { 31 | $query->where('title', 'like', '%'.request('search_title').'%'); 32 | }) 33 | ->when(request('search_content'), function ($query) { 34 | $query->where('content', 'like', '%'.request('search_content').'%'); 35 | }) 36 | ->when(request('search_global'), function ($query) { 37 | $query->where(function($q) { 38 | $q->where('id', request('search_global')) 39 | ->orWhere('title', 'like', '%'.request('search_global').'%') 40 | ->orWhere('content', 'like', '%'.request('search_global').'%'); 41 | 42 | }); 43 | }) 44 | ->orderBy($orderColumn, $orderDirection) 45 | ->paginate(50); 46 | return PostResource::collection($posts); 47 | } 48 | 49 | public function store(StorePostRequest $request) 50 | { 51 | $this->authorize('post-create'); 52 | if ($request->hasFile('thumbnail')) { 53 | $filename = $request->file('thumbnail')->getClientOriginalName(); 54 | info($filename); 55 | } 56 | 57 | $validatedData = $request->validated(); 58 | $validatedData['user_id'] = auth()->id(); 59 | 60 | $post = Post::create($validatedData); 61 | 62 | return new PostResource($post); 63 | } 64 | 65 | public function show(Post $post) 66 | { 67 | $this->authorize('post-edit'); 68 | return new PostResource($post); 69 | } 70 | 71 | public function update(Post $post, StorePostRequest $request) 72 | { 73 | $this->authorize('post-edit'); 74 | $post->update($request->validated()); 75 | 76 | return new PostResource($post); 77 | } 78 | 79 | public function destroy(Post $post) { 80 | $this->authorize('post-delete'); 81 | $post->delete(); 82 | 83 | return response()->noContent(); 84 | } 85 | 86 | public function getPosts() 87 | { 88 | $posts = Post::latest()->paginate(); 89 | 90 | return $posts; 91 | } 92 | 93 | public function getCategoryByPosts($id) 94 | { 95 | $posts = Post::latest()->where('category_id', $id)->paginate(); 96 | 97 | return $posts; 98 | } 99 | 100 | public function getPost($id) 101 | { 102 | $post = Post::with('category', 'user')->findOrFail($id); 103 | 104 | return $post; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/ProfileController.php: -------------------------------------------------------------------------------- 1 | name = $request->name; 20 | $profile->email = $request->email; 21 | 22 | if ($profile->save()) { 23 | return $this->successResponse($profile, 'User updated');; 24 | } 25 | return response()->json(['status' => 403, 'success' => false]); 26 | } 27 | 28 | public function user(Request $request) 29 | { 30 | $user = $request->user(); 31 | 32 | return $this->successResponse($user, 'User found'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/RoleController.php: -------------------------------------------------------------------------------- 1 | where('id', request('search_id')); 33 | }) 34 | ->when(request('search_title'), function ($query) { 35 | $query->where('name', 'like', '%'.request('search_title').'%'); 36 | }) 37 | ->when(request('search_global'), function ($query) { 38 | $query->where(function($q) { 39 | $q->where('id', request('search_global')) 40 | ->orWhere('name', 'like', '%'.request('search_global').'%'); 41 | 42 | }); 43 | }) 44 | ->orderBy($orderColumn, $orderDirection) 45 | ->paginate(50); 46 | 47 | return RoleResource::collection($roles); 48 | } 49 | 50 | /** 51 | * Store a newly created resource in storage. 52 | * 53 | * @param \Illuminate\Http\Request $request 54 | * @return RoleResource 55 | */ 56 | public function store(StoreRoleRequest $request) 57 | { 58 | $this->authorize('role-create'); 59 | 60 | $role = new Role(); 61 | $role->name = $request->name; 62 | $role->guard_name = 'web'; 63 | 64 | if ($role->save()) { 65 | return new RoleResource($role); 66 | } 67 | 68 | return response()->json(['status' => 405, 'success' => false]); 69 | 70 | } 71 | 72 | /** 73 | * Display the specified resource. 74 | * 75 | * @param int $id 76 | * @return RoleResource 77 | */ 78 | public function show(Role $role) 79 | { 80 | $this->authorize('role-edit'); 81 | 82 | return new RoleResource($role); 83 | } 84 | 85 | /** 86 | * Update the specified resource in storage. 87 | * 88 | * @param Role $role 89 | * @param StoreRoleRequest $request 90 | * @return RoleResource 91 | * @throws AuthorizationException 92 | */ 93 | public function update(Role $role, StoreRoleRequest $request) 94 | { 95 | $this->authorize('role-edit'); 96 | 97 | $role->name = $request->name; 98 | 99 | if ($role->save()) { 100 | return new RoleResource($role); 101 | } 102 | 103 | return response()->json(['status' => 405, 'success' => false]); 104 | } 105 | 106 | /** 107 | * Remove the specified resource from storage. 108 | * 109 | * @param int $id 110 | * @return \Illuminate\Http\Response 111 | */ 112 | public function destroy(Role $role) { 113 | $this->authorize('role-delete'); 114 | $role->delete(); 115 | 116 | return response()->noContent(); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/UserController.php: -------------------------------------------------------------------------------- 1 | where('id', request('search_id')); 31 | }) 32 | ->when(request('search_title'), function ($query) { 33 | $query->where('name', 'like', '%'.request('search_title').'%'); 34 | }) 35 | ->when(request('search_global'), function ($query) { 36 | $query->where(function($q) { 37 | $q->where('id', request('search_global')) 38 | ->orWhere('name', 'like', '%'.request('search_global').'%'); 39 | 40 | }); 41 | }) 42 | ->orderBy($orderColumn, $orderDirection) 43 | ->paginate(50); 44 | 45 | return UserResource::collection($users); 46 | } 47 | 48 | /** 49 | * Show the form for creating a new resource. 50 | * 51 | * @return \Illuminate\Http\Response 52 | */ 53 | public function create() 54 | { 55 | // 56 | } 57 | 58 | /** 59 | * Store a newly created resource in storage. 60 | * 61 | * @param \Illuminate\Http\Request $request 62 | * @return \Illuminate\Http\Response 63 | */ 64 | public function store(Request $request) 65 | { 66 | // 67 | } 68 | 69 | /** 70 | * Display the specified resource. 71 | * 72 | * @param int $id 73 | * @return \Illuminate\Http\Response 74 | */ 75 | public function show($id) 76 | { 77 | // 78 | } 79 | 80 | /** 81 | * Show the form for editing the specified resource. 82 | * 83 | * @param int $id 84 | * @return \Illuminate\Http\Response 85 | */ 86 | public function edit($id) 87 | { 88 | // 89 | } 90 | 91 | /** 92 | * Update the specified resource in storage. 93 | * 94 | * @param \Illuminate\Http\Request $request 95 | * @param int $id 96 | * @return \Illuminate\Http\Response 97 | */ 98 | public function update(Request $request, $id) 99 | { 100 | // 101 | } 102 | 103 | /** 104 | * Remove the specified resource from storage. 105 | * 106 | * @param int $id 107 | * @return \Illuminate\Http\Response 108 | */ 109 | public function destroy($id) 110 | { 111 | // 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/AuthenticatedSessionController.php: -------------------------------------------------------------------------------- 1 | authenticate(); 39 | 40 | // $token = $request->session()->regenerate(); 41 | $token = $request->user()->createToken($request->userAgent())->plainTextToken; 42 | 43 | if ($request->wantsJson()) { 44 | return response()->json(['user' => $request->user(), 'token' => $token]); 45 | } 46 | 47 | return redirect()->intended(RouteServiceProvider::HOME); 48 | } 49 | 50 | /** 51 | * Destroy an authenticated session. 52 | * 53 | * @param \Illuminate\Http\Request $request 54 | * @return \Illuminate\Http\RedirectResponse 55 | */ 56 | public function logout(Request $request) 57 | { 58 | Auth::guard('web')->logout(); 59 | 60 | $request->session()->invalidate(); 61 | 62 | $request->session()->regenerateToken(); 63 | 64 | if ($request->wantsJson()) { 65 | return response()->noContent(); 66 | } 67 | 68 | return redirect('/'); 69 | } 70 | 71 | /** 72 | * Create User 73 | * @param RegisterRequest $request 74 | * @return JsonResponse 75 | */ 76 | public function register(RegisterRequest $request) 77 | { 78 | $user = User::where('email', $request['email'])->first(); 79 | if ($user) { 80 | return response(['error' => 1, 'message' => 'user already exists'], 409); 81 | } 82 | 83 | $user = User::create([ 84 | 'email' => $request['email'], 85 | 'password' => Hash::make($request['password']), 86 | 'name' => $request['name'], 87 | ]); 88 | 89 | return $this->successResponse($user, 'Registration Successfully'); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ConfirmPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest')->except('logout'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 42 | } 43 | 44 | /** 45 | * Get a validator for an incoming registration request. 46 | * 47 | * @param array $data 48 | * @return \Illuminate\Contracts\Validation\Validator 49 | */ 50 | protected function validator(array $data) 51 | { 52 | return Validator::make($data, [ 53 | 'name' => ['required', 'string', 'max:255'], 54 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 55 | 'password' => ['required', 'string', 'min:8', 'confirmed'], 56 | ]); 57 | } 58 | 59 | /** 60 | * Create a new user instance after a valid registration. 61 | * 62 | * @param array $data 63 | * @return \App\Models\User 64 | */ 65 | protected function create(array $data) 66 | { 67 | return User::create([ 68 | 'name' => $data['name'], 69 | 'email' => $data['email'], 70 | 'password' => Hash::make($data['password']), 71 | ]); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 39 | $this->middleware('signed')->only('verify'); 40 | $this->middleware('throttle:6,1')->only('verify', 'resend'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | json([ 17 | 'success'=> true, 18 | 'message' => $message, 19 | 'data' => $data 20 | ], $code); 21 | } 22 | 23 | protected function errorResponse($message = null, $code) 24 | { 25 | return response()->json([ 26 | 'success'=> false, 27 | 'message' => $message, 28 | 'data' => null 29 | ], $code); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Http/Controllers/HomeController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 17 | } 18 | 19 | /** 20 | * Show the application dashboard. 21 | * 22 | * @return \Illuminate\Contracts\Support\Renderable 23 | */ 24 | public function index() 25 | { 26 | return view('home'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 43 | 'throttle:api', 44 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 45 | ], 46 | ]; 47 | 48 | /** 49 | * The application's route middleware. 50 | * 51 | * These middleware may be assigned to groups or used individually. 52 | * 53 | * @var array 54 | */ 55 | protected $middlewareAliases = [ 56 | 'auth' => \App\Http\Middleware\Authenticate::class, 57 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 58 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 59 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 60 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 61 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 62 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 63 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 64 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 65 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 66 | 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class, 67 | 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class, 68 | 'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class, 69 | ]; 70 | } 71 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return redirect(RouteServiceProvider::HOME); 27 | } 28 | } 29 | 30 | return $next($request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Middleware/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Requests/Auth/LoginRequest.php: -------------------------------------------------------------------------------- 1 | ['required', 'string', 'email'], 33 | 'password' => ['required', 'string'], 34 | ]; 35 | } 36 | 37 | /** 38 | * Attempt to authenticate the request's credentials. 39 | * 40 | * @return void 41 | * 42 | * @throws \Illuminate\Validation\ValidationException 43 | */ 44 | public function authenticate() 45 | { 46 | $this->ensureIsNotRateLimited(); 47 | 48 | if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { 49 | RateLimiter::hit($this->throttleKey()); 50 | 51 | throw ValidationException::withMessages([ 52 | 'email' => trans('auth.failed'), 53 | ]); 54 | } 55 | 56 | RateLimiter::clear($this->throttleKey()); 57 | } 58 | 59 | /** 60 | * Ensure the login request is not rate limited. 61 | * 62 | * @return void 63 | * 64 | * @throws \Illuminate\Validation\ValidationException 65 | */ 66 | public function ensureIsNotRateLimited() 67 | { 68 | if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { 69 | return; 70 | } 71 | 72 | event(new Lockout($this)); 73 | 74 | $seconds = RateLimiter::availableIn($this->throttleKey()); 75 | 76 | throw ValidationException::withMessages([ 77 | 'email' => trans('auth.throttle', [ 78 | 'seconds' => $seconds, 79 | 'minutes' => ceil($seconds / 60), 80 | ]), 81 | ]); 82 | } 83 | 84 | /** 85 | * Get the rate limiting throttle key for the request. 86 | * 87 | * @return string 88 | */ 89 | public function throttleKey() 90 | { 91 | return Str::lower($this->input('email')).'|'.$this->ip(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/Http/Requests/Auth/RegisterRequest.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function rules() 25 | { 26 | return [ 27 | 'name' => ['required', 'string', 'max:255'], 28 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 29 | 'password' => ['required', 'string', 'min:8', 'confirmed'], 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreCategoryRequest.php: -------------------------------------------------------------------------------- 1 | 'required' 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Requests/StorePermissionRequest.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function rules() 25 | { 26 | return [ 27 | 'name' => 'required' 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Requests/StorePostRequest.php: -------------------------------------------------------------------------------- 1 | 'required', 28 | 'content' => 'required', 29 | 'category_id' => ['required', 'exists:categories,id'] 30 | ]; 31 | } 32 | 33 | public function attributes() 34 | { 35 | return ['category_id' => 'category']; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreRoleRequest.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function rules() 25 | { 26 | return [ 27 | 'name' => 'required' 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateProfileRequest.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function rules() 25 | { 26 | return [ 27 | 'name' => 'required|min:5', 28 | 'email' => 'required|email|unique:users,email,'.$this->user()->id 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Http/Resources/CategoryResource.php: -------------------------------------------------------------------------------- 1 | $this->id, 20 | 'name' => $this->name, 21 | 'created_at' => $this->created_at->toDateString() 22 | ]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Http/Resources/PermissionResource.php: -------------------------------------------------------------------------------- 1 | $this->id, 19 | 'name' => $this->name, 20 | 'guard_name' => $this->guard_name, 21 | 'created_at' => $this->created_at->toDateString() 22 | ]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Http/Resources/PostResource.php: -------------------------------------------------------------------------------- 1 | $this->id, 19 | 'title' => $this->title, 20 | 'category_id' => $this->category_id, 21 | 'category' => $this->category->name, 22 | 'content' => substr($this->content, 0, 50) . '...', 23 | 'created_at' => $this->created_at->toDateString() 24 | ]; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Resources/RoleResource.php: -------------------------------------------------------------------------------- 1 | $this->id, 19 | 'name' => $this->name, 20 | 'guard_name' => $this->guard_name, 21 | 'created_at' => $this->created_at->toDateString() 22 | ]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Http/Resources/UserResource.php: -------------------------------------------------------------------------------- 1 | $this->id, 19 | 'name' => $this->name, 20 | 'email' => $this->email, 21 | 'created_at' => $this->created_at->toDateString() 22 | ]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Models/Category.php: -------------------------------------------------------------------------------- 1 | belongsTo(Category::class); 17 | } 18 | 19 | public function user() 20 | { 21 | return $this->belongsTo(User::class); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Models/Role.php: -------------------------------------------------------------------------------- 1 | belongsToMany(Permission::class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | protected $fillable = [ 22 | 'name', 23 | 'email', 24 | 'password', 25 | ]; 26 | 27 | /** 28 | * The attributes that should be hidden for serialization. 29 | * 30 | * @var array 31 | */ 32 | protected $hidden = [ 33 | 'password', 34 | 'remember_token', 35 | ]; 36 | 37 | /** 38 | * The attributes that should be cast. 39 | * 40 | * @var array 41 | */ 42 | protected $casts = [ 43 | 'email_verified_at' => 'datetime', 44 | ]; 45 | } 46 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $policies = [ 17 | // 'App\Models\Model' => 'App\Policies\ModelPolicy', 18 | ]; 19 | 20 | /** 21 | * Register any authentication / authorization services. 22 | * 23 | * @return void 24 | */ 25 | public function boot() 26 | { 27 | $this->registerPolicies(); 28 | $this->registerUserAccessToGates(); 29 | 30 | // 31 | } 32 | 33 | protected function registerUserAccessToGates() 34 | { 35 | try { 36 | foreach (Permission::pluck('name') as $permission) { 37 | Gate::define($permission, function ($user) use ($permission) { 38 | return $user->roles()->whereHas('permissions', function ($q) use ($permission) { 39 | $q->where('name', $permission); 40 | })->count() > 0; 41 | }); 42 | } 43 | } catch (\Exception $e) { 44 | info('registerUserAccessToGates: Database not found or not yet migrated. Ignoring user permissions while booting app.'); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | // 31 | } 32 | 33 | /** 34 | * Determine if events and listeners should be automatically discovered. 35 | * 36 | * @return bool 37 | */ 38 | public function shouldDiscoverEvents() 39 | { 40 | return false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "A Laravel Vue SPA starter project", 5 | "keywords": ["spa", "laravel", "vue"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.1", 9 | "guzzlehttp/guzzle": "^7.2", 10 | "laravel/framework": "^10.0", 11 | "laravel/sanctum": "^3.2", 12 | "laravel/tinker": "^2.8", 13 | "laravel/ui": "^4.2", 14 | "spatie/laravel-permission": "^5.10" 15 | }, 16 | "require-dev": { 17 | "fakerphp/faker": "^1.9.1", 18 | "laravel/pint": "^1.0", 19 | "laravel/sail": "^1.18", 20 | "mockery/mockery": "^1.4.4", 21 | "nunomaduro/collision": "^7.0", 22 | "phpunit/phpunit": "^10.0", 23 | "spatie/laravel-ignition": "^2.0" 24 | }, 25 | "autoload": { 26 | "psr-4": { 27 | "App\\": "app/", 28 | "Database\\Factories\\": "database/factories/", 29 | "Database\\Seeders\\": "database/seeders/" 30 | } 31 | }, 32 | "autoload-dev": { 33 | "psr-4": { 34 | "Tests\\": "tests/" 35 | } 36 | }, 37 | "scripts": { 38 | "post-autoload-dump": [ 39 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 40 | "@php artisan package:discover --ansi" 41 | ], 42 | "post-update-cmd": [ 43 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 44 | ], 45 | "post-root-package-install": [ 46 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 47 | ], 48 | "post-create-project-cmd": [ 49 | "@php artisan key:generate --ansi" 50 | ] 51 | }, 52 | "extra": { 53 | "laravel": { 54 | "dont-discover": [] 55 | } 56 | }, 57 | "config": { 58 | "optimize-autoloader": true, 59 | "preferred-install": "dist", 60 | "sort-packages": true, 61 | "allow-plugins": { 62 | "pestphp/pest-plugin": true 63 | } 64 | }, 65 | "minimum-stability": "stable", 66 | "prefer-stable": true 67 | } 68 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 40 | 'port' => env('PUSHER_PORT', 443), 41 | 'scheme' => env('PUSHER_SCHEME', 'https'), 42 | 'encrypted' => true, 43 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 44 | ], 45 | 'client_options' => [ 46 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 47 | ], 48 | ], 49 | 50 | 'ably' => [ 51 | 'driver' => 'ably', 52 | 'key' => env('ABLY_KEY'), 53 | ], 54 | 55 | 'redis' => [ 56 | 'driver' => 'redis', 57 | 'connection' => 'default', 58 | ], 59 | 60 | 'log' => [ 61 | 'driver' => 'log', 62 | ], 63 | 64 | 'null' => [ 65 | 'driver' => 'null', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | ], 56 | 57 | 'memcached' => [ 58 | 'driver' => 'memcached', 59 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 60 | 'sasl' => [ 61 | env('MEMCACHED_USERNAME'), 62 | env('MEMCACHED_PASSWORD'), 63 | ], 64 | 'options' => [ 65 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 66 | ], 67 | 'servers' => [ 68 | [ 69 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 70 | 'port' => env('MEMCACHED_PORT', 11211), 71 | 'weight' => 100, 72 | ], 73 | ], 74 | ], 75 | 76 | 'redis' => [ 77 | 'driver' => 'redis', 78 | 'connection' => 'cache', 79 | 'lock_connection' => 'default', 80 | ], 81 | 82 | 'dynamodb' => [ 83 | 'driver' => 'dynamodb', 84 | 'key' => env('AWS_ACCESS_KEY_ID'), 85 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 86 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 87 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 88 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 89 | ], 90 | 91 | 'octane' => [ 92 | 'driver' => 'octane', 93 | ], 94 | 95 | ], 96 | 97 | /* 98 | |-------------------------------------------------------------------------- 99 | | Cache Key Prefix 100 | |-------------------------------------------------------------------------- 101 | | 102 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache 103 | | stores there might be other applications using the same cache. For 104 | | that reason, you may prefix every cache key to avoid collisions. 105 | | 106 | */ 107 | 108 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 109 | 110 | ]; 111 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Failed Queue Jobs 79 | |-------------------------------------------------------------------------- 80 | | 81 | | These options configure the behavior of failed queue job logging so you 82 | | can control which database and table are used to store the jobs that 83 | | have failed. You may change them to any database / table you wish. 84 | | 85 | */ 86 | 87 | 'failed' => [ 88 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 89 | 'database' => env('DB_CONNECTION', 'mysql'), 90 | 'table' => 'failed_jobs', 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. If this value is null, personal access tokens do 45 | | not expire. This won't tweak the lifetime of first-party sessions. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Sanctum Middleware 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When authenticating your first-party SPA with Sanctum you may need to 57 | | customize some of the middleware Sanctum uses while processing the 58 | | request. You may change the middleware listed below as required. 59 | | 60 | */ 61 | 62 | 'middleware' => [ 63 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 64 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class UserFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | return [ 21 | 'name' => fake()->name(), 22 | 'email' => fake()->unique()->safeEmail(), 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | } 28 | 29 | /** 30 | * Indicate that the model's email address should be unverified. 31 | * 32 | * @return static 33 | */ 34 | public function unverified() 35 | { 36 | return $this->state(fn (array $attributes) => [ 37 | 'email_verified_at' => null, 38 | ]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('uuid')->unique(); 19 | $table->text('connection'); 20 | $table->text('queue'); 21 | $table->longText('payload'); 22 | $table->longText('exception'); 23 | $table->timestamp('failed_at')->useCurrent(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('failed_jobs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->morphs('tokenable'); 19 | $table->string('name'); 20 | $table->string('token', 64)->unique(); 21 | $table->text('abilities')->nullable(); 22 | $table->timestamp('last_used_at')->nullable(); 23 | $table->timestamp('expires_at')->nullable(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('personal_access_tokens'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /database/migrations/2022_09_30_181156_create_posts_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('title'); 19 | $table->unsignedBigInteger('category_id'); 20 | $table->unsignedBigInteger('user_id'); 21 | $table->longText('content'); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('posts'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2022_09_30_181227_create_categories_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('categories'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/seeders/CreateAdminUserSeeder.php: -------------------------------------------------------------------------------- 1 | 'Fazle', 23 | 'email' => 'admin@demo.com', 24 | 'password' => bcrypt('12345678') 25 | ]); 26 | 27 | $role = Role::create(['name' => 'Admin']); 28 | Category::create(['name' => 'Vue.js']); 29 | 30 | $permissions = Permission::pluck('id','id')->all(); 31 | 32 | $role->syncPermissions($permissions); 33 | 34 | $user->assignRole([$role->id]); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(PermissionTableSeeder::class); 18 | $this->call(CreateAdminUserSeeder::class); 19 | 20 | // $this->call(RoleSeeder::class); 21 | // \App\Models\User::factory(10)->create(); 22 | 23 | // \App\Models\User::factory()->create([ 24 | // 'name' => 'Test User', 25 | // 'email' => 'test@example.com', 26 | // ]); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /database/seeders/PermissionTableSeeder.php: -------------------------------------------------------------------------------- 1 | $permission]); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'password' => 'The provided password is incorrect.', 18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Your password has been reset!', 17 | 'sent' => 'We have emailed your password reset link!', 18 | 'throttled' => 'Please wait before retrying.', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that email address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build" 6 | }, 7 | "devDependencies": { 8 | "@popperjs/core": "^2.11.6", 9 | "@vitejs/plugin-vue": "^4.0.0", 10 | "axios": "^1.2.1", 11 | "bootstrap": "^5.3.0", 12 | "laravel-vite-plugin": "^0.7.5", 13 | "lodash": "^4.17.21", 14 | "postcss": "^8.1.14", 15 | "sass": "^1.56.1", 16 | "vite": "^4.0.0", 17 | "vue": "^3.2.37" 18 | }, 19 | "dependencies": { 20 | "@casl/ability": "^5.4.3", 21 | "@casl/vue": "^2.1.2", 22 | "js-cookie": "^3.0.5", 23 | "laravel-vue-pagination": "^3.0.0", 24 | "vee-validate": "^4.6.10", 25 | "vue-i18n": "^9.2.2", 26 | "vue-router": "^4.2.4", 27 | "vue-select": "^4.0.0-beta.5", 28 | "vue-sweetalert2": "^5.0.5", 29 | "vuex": "^4.1.0", 30 | "vuex-persistedstate": "^4.1.0" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | ./tests/Unit 10 | 11 | 12 | ./tests/Feature 13 | 14 | 15 | 16 | 17 | ./app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Phoenix-Genius/laravel-vue3-spa-starter/898bd08a8a2a12e8825ce382054ba5d188935897/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- 1 | a { 2 | text-decoration: none !important; 3 | } 4 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | 3 | import { createApp } from 'vue'; 4 | import LaravelVuePagination from 'laravel-vue-pagination'; 5 | import store from './store' 6 | import router from './routes/index' 7 | import VueSweetalert2 from "vue-sweetalert2"; 8 | import { abilitiesPlugin } from '@casl/vue'; 9 | import ability from './services/ability'; 10 | import vSelect from "vue-select"; 11 | import useAuth from './composables/auth'; 12 | import i18n from "./plugins/i18n"; 13 | 14 | import 'sweetalert2/dist/sweetalert2.min.css'; 15 | import 'vue-select/dist/vue-select.css'; 16 | 17 | const app = createApp({ 18 | created() { 19 | useAuth().getUser() 20 | } 21 | }); 22 | 23 | import ExampleComponent from './components/ExampleComponent.vue'; 24 | 25 | app.component('example-component', ExampleComponent); 26 | 27 | 28 | app.use(router) 29 | app.use(store) 30 | app.use(VueSweetalert2) 31 | app.use(i18n) 32 | app.use(abilitiesPlugin, ability) 33 | app.component('Pagination', LaravelVuePagination) 34 | app.component("v-select", vSelect); 35 | app.mount('#app') 36 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | window._ = _; 3 | 4 | import 'bootstrap'; 5 | 6 | /** 7 | * We'll load the axios HTTP library which allows us to easily issue requests 8 | * to our Laravel back-end. This library automatically handles sending the 9 | * CSRF token as a header based on the value of the "XSRF" token cookie. 10 | */ 11 | 12 | import axios from 'axios'; 13 | window.axios = axios; 14 | 15 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 16 | 17 | window.axios.defaults.withCredentials = true 18 | window.axios.interceptors.response.use( 19 | response => response, 20 | error => { 21 | if (error.response?.status === 401 || error.response?.status === 403 || error.response?.status === 419) { 22 | if (location.pathname !== '/login'){ 23 | location.assign('/login') 24 | } 25 | } 26 | 27 | return Promise.reject(error) 28 | } 29 | ) 30 | 31 | /** 32 | * Echo exposes an expressive API for subscribing to channels and listening 33 | * for events that are broadcast by Laravel. Echo and event broadcasting 34 | * allows your team to easily build robust real-time web applications. 35 | */ 36 | 37 | // import Echo from 'laravel-echo'; 38 | 39 | // import Pusher from 'pusher-js'; 40 | // window.Pusher = Pusher; 41 | 42 | // window.Echo = new Echo({ 43 | // broadcaster: 'pusher', 44 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 45 | // wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 46 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 47 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 48 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 49 | // enabledTransports: ['ws', 'wss'], 50 | // }); 51 | -------------------------------------------------------------------------------- /resources/js/components/Admin/Edit.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | -------------------------------------------------------------------------------- /resources/js/components/Admin/Index.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 19 | -------------------------------------------------------------------------------- /resources/js/components/ExampleComponent.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /resources/js/components/Footer.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 16 | -------------------------------------------------------------------------------- /resources/js/components/LocaleSwitcher.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 38 | 39 | 42 | -------------------------------------------------------------------------------- /resources/js/components/Nav.vue: -------------------------------------------------------------------------------- 1 | 45 | 46 | 56 | -------------------------------------------------------------------------------- /resources/js/components/includes/AdminNavbar.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 51 | 52 | 55 | -------------------------------------------------------------------------------- /resources/js/components/includes/Breadcrumb.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 35 | 36 | -------------------------------------------------------------------------------- /resources/js/composables/profile.js: -------------------------------------------------------------------------------- 1 | import { ref, inject } from 'vue' 2 | import { useRouter } from 'vue-router' 3 | import store from "../store"; 4 | 5 | export default function useProfile() { 6 | const profile = ref({ 7 | name: '', 8 | email: '', 9 | }) 10 | 11 | const router = useRouter() 12 | const validationErrors = ref({}) 13 | const isLoading = ref(false) 14 | const swal = inject('$swal') 15 | 16 | const getProfile = async () => { 17 | profile.value = store.getters["auth/user"] 18 | // axios.get('/api/user') 19 | // .then(({data}) => { 20 | // profile.value = data.data; 21 | // }) 22 | } 23 | 24 | const updateProfile = async (profile) => { 25 | if (isLoading.value) return; 26 | 27 | isLoading.value = true 28 | validationErrors.value = {} 29 | 30 | axios.put('/api/user', profile) 31 | .then(({data}) => { 32 | if (data.success) { 33 | store.commit('auth/SET_USER', data.data) 34 | // router.push({name: 'profile.index'}) 35 | swal({ 36 | icon: 'success', 37 | title: 'Profile updated successfully' 38 | }) 39 | } 40 | }) 41 | .catch(error => { 42 | if (error.response?.data) { 43 | validationErrors.value = error.response.data.errors 44 | } 45 | }) 46 | .finally(() => isLoading.value = false) 47 | } 48 | 49 | return { 50 | profile, 51 | getProfile, 52 | updateProfile, 53 | validationErrors, 54 | isLoading 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /resources/js/lang/bn.json: -------------------------------------------------------------------------------- 1 | { 2 | "welcome_starter_title": "Laravel Vue 3 Starter-এ স্বাগতম", 3 | "ok": "Ok", 4 | "cancel": "Cancel" 5 | } 6 | -------------------------------------------------------------------------------- /resources/js/lang/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "welcome_starter_title": "Welcome to Laravel Vue 3 Boilerplate", 3 | "ok": "Ok", 4 | "cancel": "Cancel", 5 | "error_alert_title": "Oops...", 6 | "error_alert_text": "Something went wrong! Please try again.", 7 | "token_expired_alert_title": "Session Expired!", 8 | "token_expired_alert_text": "Please log in again to continue.", 9 | "login": "Log In", 10 | "register": "Register", 11 | "page_not_found": "Page Not Found", 12 | "go_home": "Go Home", 13 | "logout": "Logout", 14 | "email": "Email", 15 | "remember_me": "Remember Me", 16 | "password": "Password", 17 | "forgot_password": "Forgot Your Password?", 18 | "confirm_password": "Confirm Password", 19 | "name": "Name", 20 | "toggle_navigation": "Toggle navigation", 21 | "home": "Home", 22 | "you_are_logged_in": "You are logged in!", 23 | "reset_password": "Reset Password", 24 | "send_password_reset_link": "Send Password Reset Link", 25 | "settings": "Settings", 26 | "profile": "Profile", 27 | "your_info": "Your Info", 28 | "info_updated": "Your info has been updated!", 29 | "update": "Update", 30 | "your_password": "Your Password", 31 | "password_updated": "Your password has been updated!", 32 | "new_password": "New Password", 33 | "login_with": "Login with", 34 | "register_with": "Register with", 35 | "verify_email": "Verify Email", 36 | "send_verification_link": "Send Verification Link", 37 | "resend_verification_link": "Resend Verification Link ?", 38 | "failed_to_verify_email": "Failed to verify email.", 39 | "verify_email_address": "We sent you an email with an the verification link." 40 | } 41 | -------------------------------------------------------------------------------- /resources/js/lang/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "welcome_starter_title": "Bienvenido a Laravel Vue 3 Starter", 3 | "ok": "De Acuerdo", 4 | "cancel": "Cancelar", 5 | "error_alert_title": "Ha ocurrido un problema", 6 | "error_alert_text": "¡Algo salió mal! Inténtalo de nuevo.", 7 | "token_expired_alert_title": "!Sesión Expirada!", 8 | "token_expired_alert_text": "Por favor inicie sesión de nuevo para continuar.", 9 | "login": "Iniciar Sesión", 10 | "register": "Registro", 11 | "page_not_found": "Página No Encontrada", 12 | "go_home": "Ir a Inicio", 13 | "logout": "Cerrar Sesión", 14 | "email": "Correo Electrónico", 15 | "remember_me": "Recuérdame", 16 | "password": "Contraseña", 17 | "forgot_password": "¿Olvidaste tu contraseña?", 18 | "confirm_password": "Confirmar Contraseña", 19 | "name": "Nombre", 20 | "toggle_navigation": "Cambiar Navegación", 21 | "home": "Inicio", 22 | "you_are_logged_in": "¡Has iniciado sesión!", 23 | "reset_password": "Restablecer la contraseña", 24 | "send_password_reset_link": "Enviar Enlace de Restablecimiento de Contraseña", 25 | "settings": "Configuraciones", 26 | "profile": "Perfil", 27 | "your_info": "Tu Información", 28 | "info_updated": "¡Tu información ha sido actualizada!", 29 | "update": "Actualizar", 30 | "your_password": "Tu Contraseña", 31 | "password_updated": "¡Tu contraseña ha sido actualizada!", 32 | "new_password": "Nueva Contraseña", 33 | "login_with": "Iniciar Sesión con", 34 | "register_with": "Registro con" 35 | } 36 | -------------------------------------------------------------------------------- /resources/js/lang/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "welcome_starter_title": "Bienvenue dans Laravel Vue 3 Starter", 3 | "ok": "Ok", 4 | "cancel": "Annuler", 5 | "error_alert_title": "Oups...", 6 | "error_alert_text": "Quelque chose a mal tourné ! Veuillez réessayer.", 7 | "token_expired_alert_title": "Session expirée !", 8 | "token_expired_alert_text": "Veuillez vous reconnecter pour continuer.", 9 | "login": "Connexion", 10 | "register": "Inscription", 11 | "page_not_found": "Page non trouvée", 12 | "go_home": "Retour à l'accueil", 13 | "logout": "Déconnexion", 14 | "email": "Email", 15 | "remember_me": "Se souvenir de moi", 16 | "password": "Mot de passe", 17 | "forgot_password": "Vous avez oublié votre mot de passe ?", 18 | "confirm_password": "Confirmer le mot de passe", 19 | "name": "Nom", 20 | "toggle_navigation": "Basculer la navigation", 21 | "home": "Accueil", 22 | "you_are_logged_in": "Vous êtes connecté !", 23 | "reset_password": "Réinitialisation du mot de passe", 24 | "send_password_reset_link": "Envoyer le lien de réinitialisation du mot de passe", 25 | "settings": "Paramètres", 26 | "profile": "Profil", 27 | "your_info": "Vos informations", 28 | "info_updated": "Vos informations ont été mises à jour !", 29 | "update": "Mettre à jour", 30 | "your_password": "Votre mot de passe", 31 | "password_updated": "Votre mot de passe a été mis à jour !", 32 | "new_password": "Nouveau mot de passe", 33 | "login_with": "Connectez-vous avec", 34 | "register_with": "S'inscrire avec", 35 | "verify_email": "Vérifier l'e-mail", 36 | "send_verification_link": "Envoyer le lien de vérification", 37 | "resend_verification_link": "Renvoyer le lien de vérification ?", 38 | "failed_to_verify_email": "Nous n'avons pas réussi à vérifier votre email.", 39 | "verify_email_address": "Nous vous avons envoyé un e-mail avec un lien de vérification." 40 | } 41 | -------------------------------------------------------------------------------- /resources/js/lang/pt-BR.json: -------------------------------------------------------------------------------- 1 | { 2 | "welcome_starter_title": "Bem-vindo ao Laravel Vue 3 Starter", 3 | "ok": "Ok", 4 | "cancel": "Cancelar", 5 | "error_alert_title": "Oops...", 6 | "error_alert_text": "Algo deu errado! Por favor, tente novamente.", 7 | "token_expired_alert_title": "Sessão expirada!", 8 | "token_expired_alert_text": "Faça login novamente para continuar.", 9 | "login": "Entrar", 10 | "register": "Cadastrar", 11 | "page_not_found": "Página não encontrada", 12 | "go_home": "Inicio", 13 | "logout": "Sair", 14 | "email": "Email", 15 | "remember_me": "Lembre-me", 16 | "password": "Senha", 17 | "forgot_password": "Esqueceu sua senha?", 18 | "confirm_password": "Confirmar Senha", 19 | "name": "Nome", 20 | "toggle_navigation": "Alternar de navegação", 21 | "home": "Inicio", 22 | "you_are_logged_in": "Você está logado!", 23 | "reset_password": "Trocar Senha", 24 | "send_password_reset_link": "Enviar link de redefinição de senha", 25 | "settings": "Configurações", 26 | "profile": "Perfil", 27 | "your_info": "Suas informações", 28 | "info_updated": "Suas informações foram atualizadas!", 29 | "update": "Atualizar", 30 | "your_password": "Sua senha", 31 | "password_updated": "Sua senha foi atualizada!", 32 | "new_password": "Nova Senha", 33 | "login_with": "Entrar", 34 | "register_with": "Registre-se", 35 | "verify_email": "verificar email", 36 | "send_verification_link": "Enviar link de verificação", 37 | "resend_verification_link": "Reenviar link de verificação?", 38 | "failed_to_verify_email": "Falha ao verificar o email.", 39 | "verify_email_address": "Enviamos um e-mail com o link de verificação." 40 | } 41 | -------------------------------------------------------------------------------- /resources/js/lang/zh-CN.json: -------------------------------------------------------------------------------- 1 | { 2 | "welcome_starter_title": "欢迎来到Laravel Vue 3入门版", 3 | "ok": "确定", 4 | "cancel": "取消", 5 | "error_alert_title": "错误...", 6 | "error_alert_text": "遇到一些错误,请稍后重试~", 7 | "token_expired_alert_title": "验证过期!", 8 | "token_expired_alert_text": "请稍后重新登录系统", 9 | "login": "登录", 10 | "register": "注册", 11 | "page_not_found": "页面不存在", 12 | "go_home": "返回首页", 13 | "logout": "退出", 14 | "email": "邮箱", 15 | "remember_me": "记住我", 16 | "password": "密码", 17 | "forgot_password": "忘记密码?", 18 | "confirm_password": "重复密码", 19 | "name": "用户名", 20 | "toggle_navigation": "切换导航", 21 | "home": "首页", 22 | "you_are_logged_in": "您已经登录!", 23 | "reset_password": "重置密码", 24 | "send_password_reset_link": "发送重置链接", 25 | "settings": "设置", 26 | "profile": "个人设置", 27 | "your_info": "您的个人信息", 28 | "info_updated": "您的个人信息已经更改!", 29 | "update": "更新", 30 | "your_password": "您的密码", 31 | "password_updated": "您的密码已经更新!", 32 | "new_password": "新密码", 33 | "login_with": "登录", 34 | "register_with": "注册" 35 | } 36 | -------------------------------------------------------------------------------- /resources/js/layouts/Admin.vue: -------------------------------------------------------------------------------- 1 | 52 | 53 | 61 | -------------------------------------------------------------------------------- /resources/js/layouts/Authenticated.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 58 | 59 | 117 | -------------------------------------------------------------------------------- /resources/js/layouts/Error.vue: -------------------------------------------------------------------------------- 1 | 26 | -------------------------------------------------------------------------------- /resources/js/layouts/Guest.vue: -------------------------------------------------------------------------------- 1 | 5 | 9 | -------------------------------------------------------------------------------- /resources/js/plugins/i18n.js: -------------------------------------------------------------------------------- 1 | import { createI18n } from 'vue-i18n' 2 | import store from '../store' 3 | 4 | const i18n = createI18n({ 5 | legacy: false, // you must set `false`, to use Composition API 6 | globalInjection: true, 7 | runtimeOnly: false, 8 | locale: 'en', // set locale 9 | fallbackLocale: 'en', // set fallback locale 10 | messages: {} // set locale messages 11 | }) 12 | 13 | /** 14 | * @param {String} locale 15 | */ 16 | export async function loadMessages (locale) { 17 | if (Object.keys(i18n.global.getLocaleMessage(locale)).length === 0) { 18 | const messages = await import(/* webpackChunkName: '' */ `../lang/${locale}.json`); 19 | i18n.global.setLocaleMessage(locale, messages); 20 | } 21 | if (i18n.locale !== locale) { 22 | i18n.locale = locale 23 | i18n.global.locale.value = locale; 24 | } 25 | } 26 | 27 | ;(async function () { 28 | await loadMessages(store.getters['lang/locale']) 29 | })() 30 | 31 | export default i18n; 32 | -------------------------------------------------------------------------------- /resources/js/routes/index.js: -------------------------------------------------------------------------------- 1 | import { createRouter, createWebHistory } from "vue-router"; 2 | import routes from './routes.js' 3 | 4 | const router = createRouter({ 5 | history: createWebHistory(), 6 | routes 7 | }) 8 | 9 | /*router.beforeEach((to, from, next) => { 10 | 11 | if (store.getters.user) { 12 | if (to.matched.some(route => route.meta.guard === 'guest')) next({ name: 'home' }) 13 | else next(); 14 | 15 | } else { 16 | if (to.matched.some(route => route.meta.guard === 'auth')) next({ name: 'login' }) 17 | else next(); 18 | } 19 | })*/ 20 | 21 | export default router; 22 | -------------------------------------------------------------------------------- /resources/js/services/ability.js: -------------------------------------------------------------------------------- 1 | import { AbilityBuilder, Ability } from '@casl/ability' 2 | 3 | const { can, cannot, build } = new AbilityBuilder(Ability); 4 | 5 | export default build(); 6 | -------------------------------------------------------------------------------- /resources/js/store/auth.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | export default { 4 | namespaced: true, 5 | state: { 6 | authenticated: false, 7 | user: {} 8 | }, 9 | getters: { 10 | authenticated(state) { 11 | return state.authenticated 12 | }, 13 | user(state) { 14 | return state.user 15 | } 16 | }, 17 | mutations: { 18 | SET_AUTHENTICATED(state, value) { 19 | state.authenticated = value 20 | }, 21 | SET_USER(state, value) { 22 | state.user = value 23 | } 24 | }, 25 | actions: { 26 | login({commit}) { 27 | return axios.get('/api/user').then(({data}) => { 28 | commit('SET_USER', data) 29 | commit('SET_AUTHENTICATED', true) 30 | }).catch(({res}) => { 31 | commit('SET_USER', {}) 32 | commit('SET_AUTHENTICATED', false) 33 | }) 34 | }, 35 | getUser({commit}) { 36 | return axios.get('/api/user').then(({data}) => { 37 | if (data.success) { 38 | commit('SET_USER', data.data) 39 | commit('SET_AUTHENTICATED', true) 40 | // router.push({name: 'dashboard'}) 41 | } 42 | // else { 43 | // commit('SET_USER', {}) 44 | // commit('SET_AUTHENTICATED', false) 45 | // } 46 | }).catch(({res}) => { 47 | commit('SET_USER', {}) 48 | commit('SET_AUTHENTICATED', false) 49 | }) 50 | }, 51 | logout({commit}) { 52 | commit('SET_USER', {}) 53 | commit('SET_AUTHENTICATED', false) 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /resources/js/store/index.js: -------------------------------------------------------------------------------- 1 | import { createStore } from 'vuex' 2 | import createPersistedState from 'vuex-persistedstate' 3 | import auth from '../store/auth' 4 | import lang from '../store/lang' 5 | 6 | const store = createStore({ 7 | plugins:[ 8 | createPersistedState() 9 | ], 10 | modules:{ 11 | auth, 12 | lang 13 | } 14 | }) 15 | 16 | export default store 17 | -------------------------------------------------------------------------------- /resources/js/store/lang.js: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie' 2 | 3 | const { locale, locales } = window.config 4 | 5 | export default { 6 | namespaced: true, 7 | state: { 8 | locale: getLocale(locales, locale), 9 | locales: locales 10 | }, 11 | getters: { 12 | locale: state => state.locale, 13 | locales: state => state.locales 14 | }, 15 | mutations: { 16 | SET_LOCALE(state, { locale }) { 17 | state.locale = locale 18 | } 19 | }, 20 | actions: { 21 | setLocale ({ commit }, { locale }) { 22 | commit('SET_LOCALE', { locale }) 23 | 24 | Cookies.set('locale', locale, { expires: 365 }) 25 | } 26 | } 27 | } 28 | 29 | /** 30 | * @param {String[]} locales 31 | * @param {String} fallback 32 | * @return {String} 33 | */ 34 | function getLocale (locales, fallback) { 35 | const locale = Cookies.get('locale') 36 | 37 | if (Object.prototype.hasOwnProperty.call(locales, locale)) { 38 | return locale 39 | } else if (locale) { 40 | Cookies.remove('locale') 41 | } 42 | 43 | return fallback 44 | } 45 | -------------------------------------------------------------------------------- /resources/js/store/oldindex.js: -------------------------------------------------------------------------------- 1 | import { createStore } from 'vuex' 2 | // import axios from 'axios'; 3 | import Cookies from 'js-cookie' 4 | 5 | const store = createStore({ 6 | state: { 7 | user: null, 8 | token: Cookies.get('token') 9 | }, 10 | 11 | getters: { 12 | user: state => state.user, 13 | token: state => state.token, 14 | check: state => state.user !== null 15 | }, 16 | 17 | mutations: { 18 | SAVE_TOKEN (state, { token, remember }) { 19 | state.token = token 20 | Cookies.set('token', token, { expires: remember ? 365 : null }) 21 | }, 22 | 23 | FETCH_USER_SUCCESS (state, { user }) { 24 | state.user = user 25 | }, 26 | 27 | FETCH_USER_FAILURE (state) { 28 | state.token = null 29 | Cookies.remove('token') 30 | }, 31 | 32 | LOGOUT (state) { 33 | state.user = null 34 | state.token = null 35 | 36 | Cookies.remove('token') 37 | }, 38 | 39 | UPDATE_USER (state, user) { 40 | state.user = user 41 | } 42 | }, 43 | 44 | actions: { 45 | saveToken ({ commit, dispatch }, payload) { 46 | commit('SAVE_TOKEN', payload) 47 | }, 48 | 49 | async fetchUser ({ commit }) { 50 | try { 51 | const { data } = await axios.get('/api/user') 52 | commit('FETCH_USER_SUCCESS', { user: data }) 53 | } catch (e) { 54 | commit('FETCH_USER_FAILURE') 55 | } 56 | }, 57 | 58 | updateUser ({ commit }, payload) { 59 | commit('UPDATE_USER', payload) 60 | }, 61 | 62 | async logout ({ commit }) { 63 | try { 64 | await axios.post('/api/logout') 65 | } catch (e) { } 66 | 67 | commit('LOGOUT') 68 | }, 69 | 70 | async fetchOauthUrl (ctx, { provider }) { 71 | const { data } = await axios.post(`/api/oauth/${provider}`) 72 | 73 | return data.url 74 | } 75 | } 76 | }); 77 | 78 | export default store; 79 | -------------------------------------------------------------------------------- /resources/js/validation/rules.js: -------------------------------------------------------------------------------- 1 | const required = (value, args, { field }) => { 2 | if (!value) { 3 | return `The ${field} field is required.` 4 | } 5 | 6 | return true 7 | } 8 | 9 | const email = (value, args, { field }) => { 10 | if (!value) { 11 | return `The ${field} field is required.` 12 | } 13 | 14 | return true 15 | } 16 | 17 | const min = (value, [limit], { field }) => { 18 | if (!value || !value.length) { 19 | return true 20 | } 21 | 22 | if (value.length < limit) { 23 | return `The ${field} must be at least ${limit} characters.` 24 | } 25 | 26 | return true 27 | } 28 | 29 | export { required, min, email } 30 | -------------------------------------------------------------------------------- /resources/js/views/admin/categories/Create.vue: -------------------------------------------------------------------------------- 1 | 36 | 60 | -------------------------------------------------------------------------------- /resources/js/views/admin/categories/Edit.vue: -------------------------------------------------------------------------------- 1 | 36 | 70 | -------------------------------------------------------------------------------- /resources/js/views/admin/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 8 | 11 | -------------------------------------------------------------------------------- /resources/js/views/admin/permissions/Create.vue: -------------------------------------------------------------------------------- 1 | 36 | 60 | -------------------------------------------------------------------------------- /resources/js/views/admin/permissions/Edit.vue: -------------------------------------------------------------------------------- 1 | 36 | 70 | -------------------------------------------------------------------------------- /resources/js/views/admin/profile/index.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 79 | -------------------------------------------------------------------------------- /resources/js/views/admin/roles/Create.vue: -------------------------------------------------------------------------------- 1 | 36 | 60 | -------------------------------------------------------------------------------- /resources/js/views/admin/roles/Edit.vue: -------------------------------------------------------------------------------- 1 | 36 | 70 | -------------------------------------------------------------------------------- /resources/js/views/auth/Verify.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /resources/js/views/auth/passwords/Confirm.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /resources/js/views/auth/passwords/Email.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /resources/js/views/auth/passwords/Reset.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /resources/js/views/category/posts.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 38 | -------------------------------------------------------------------------------- /resources/js/views/errors/404.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /resources/js/views/login/Login.vue: -------------------------------------------------------------------------------- 1 | 55 | 56 | 63 | -------------------------------------------------------------------------------- /resources/js/views/posts/details.vue: -------------------------------------------------------------------------------- 1 | 60 | 61 | 80 | -------------------------------------------------------------------------------- /resources/js/views/posts/index.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 36 | -------------------------------------------------------------------------------- /resources/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | // Body 2 | $body-bg: #f8fafc; 3 | 4 | // Typography 5 | $font-family-sans-serif: 'Nunito', sans-serif; 6 | $font-size-base: 0.9rem; 7 | $line-height-base: 1.6; 8 | -------------------------------------------------------------------------------- /resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | // Fonts 2 | @import url('https://fonts.bunny.net/css?family=Nunito'); 3 | 4 | // Variables 5 | @import 'variables'; 6 | 7 | // Bootstrap 8 | @import 'bootstrap/scss/bootstrap'; 9 | 10 | a { 11 | text-decoration: none !important; 12 | } 13 | -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Login') }}
9 | 10 |
11 |
12 | @csrf 13 | 14 |
15 | 16 | 17 |
18 | 19 | 20 | @error('email') 21 | 22 | {{ $message }} 23 | 24 | @enderror 25 |
26 |
27 | 28 |
29 | 30 | 31 |
32 | 33 | 34 | @error('password') 35 | 36 | {{ $message }} 37 | 38 | @enderror 39 |
40 |
41 | 42 |
43 |
44 |
45 | 46 | 47 | 50 |
51 |
52 |
53 | 54 |
55 |
56 | 59 | 60 | @if (Route::has('password.request')) 61 | 62 | {{ __('Forgot Your Password?') }} 63 | 64 | @endif 65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | @endsection 74 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/confirm.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Confirm Password') }}
9 | 10 |
11 | {{ __('Please confirm your password before continuing.') }} 12 | 13 |
14 | @csrf 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | @error('password') 23 | 24 | {{ $message }} 25 | 26 | @enderror 27 |
28 |
29 | 30 |
31 |
32 | 35 | 36 | @if (Route::has('password.request')) 37 | 38 | {{ __('Forgot Your Password?') }} 39 | 40 | @endif 41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | @endsection 50 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/email.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Reset Password') }}
9 | 10 |
11 | @if (session('status')) 12 | 15 | @endif 16 | 17 |
18 | @csrf 19 | 20 |
21 | 22 | 23 |
24 | 25 | 26 | @error('email') 27 | 28 | {{ $message }} 29 | 30 | @enderror 31 |
32 |
33 | 34 |
35 |
36 | 39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection 48 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/reset.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Reset Password') }}
9 | 10 |
11 |
12 | @csrf 13 | 14 | 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | @error('email') 23 | 24 | {{ $message }} 25 | 26 | @enderror 27 |
28 |
29 | 30 |
31 | 32 | 33 |
34 | 35 | 36 | @error('password') 37 | 38 | {{ $message }} 39 | 40 | @enderror 41 |
42 |
43 | 44 |
45 | 46 | 47 |
48 | 49 |
50 |
51 | 52 |
53 |
54 | 57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | @endsection 66 | -------------------------------------------------------------------------------- /resources/views/auth/register.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Register') }}
9 | 10 |
11 |
12 | @csrf 13 | 14 |
15 | 16 | 17 |
18 | 19 | 20 | @error('name') 21 | 22 | {{ $message }} 23 | 24 | @enderror 25 |
26 |
27 | 28 |
29 | 30 | 31 |
32 | 33 | 34 | @error('email') 35 | 36 | {{ $message }} 37 | 38 | @enderror 39 |
40 |
41 | 42 |
43 | 44 | 45 |
46 | 47 | 48 | @error('password') 49 | 50 | {{ $message }} 51 | 52 | @enderror 53 |
54 |
55 | 56 |
57 | 58 | 59 |
60 | 61 |
62 |
63 | 64 |
65 |
66 | 69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | @endsection 78 | -------------------------------------------------------------------------------- /resources/views/auth/verify.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Verify Your Email Address') }}
9 | 10 |
11 | @if (session('resent')) 12 | 15 | @endif 16 | 17 | {{ __('Before proceeding, please check your email for a verification link.') }} 18 | {{ __('If you did not receive the email') }}, 19 |
20 | @csrf 21 | . 22 |
23 |
24 |
25 |
26 |
27 |
28 | @endsection 29 | -------------------------------------------------------------------------------- /resources/views/home.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Dashboard') }}
9 | 10 |
11 | @if (session('status')) 12 | 15 | @endif 16 | 17 | {{ __('You are logged in!') }} 18 |
19 |
20 |
21 |
22 |
23 | @endsection 24 | -------------------------------------------------------------------------------- /resources/views/layouts/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{ config('app.name', 'Laravel') }} 11 | 12 | 13 | 14 | 15 | 16 | 17 | @vite(['resources/sass/app.scss', 'resources/js/app.js']) 18 | 19 | 20 |
21 | 74 | 75 |
76 | @yield('content') 77 |
78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /resources/views/layouts/master.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{ config('app.name', 'Laravel') }} 11 | 12 | 13 | 14 | 15 | 16 | 17 | @vite(['resources/sass/app.scss', 'resources/js/app.js']) 18 | 19 | 20 |
21 | 74 | 75 |
76 | @yield('content') 77 |
78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /resources/views/main-view.blade.php: -------------------------------------------------------------------------------- 1 | @php 2 | $config = [ 3 | 'appName' => config('app.name'), 4 | 'locale' => $locale = app()->getLocale(), 5 | 'locales' => config('app.locales'), 6 | ]; 7 | @endphp 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Laravel Vue 3 Stater 18 | 19 | 20 | 21 | 22 | 25 | 26 | @vite(['resources/sass/app.scss', 'resources/js/app.js']) 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | 'auth:sanctum'], function() { 13 | Route::apiResource('users', UserController::class); 14 | Route::apiResource('posts', PostController::class); 15 | Route::apiResource('categories', CategoryController::class); 16 | Route::apiResource('roles', RoleController::class); 17 | Route::apiResource('permissions', PermissionController::class); 18 | Route::get('category-list', [CategoryController::class, 'getList']); 19 | Route::get('/user', [ProfileController::class, 'user']); 20 | Route::put('/user', [ProfileController::class, 'update']); 21 | 22 | Route::get('abilities', function(Request $request) { 23 | return $request->user()->roles()->with('permissions') 24 | ->get() 25 | ->pluck('permissions') 26 | ->flatten() 27 | ->pluck('name') 28 | ->unique() 29 | ->values() 30 | ->toArray(); 31 | }); 32 | }); 33 | 34 | Route::get('category-list', [CategoryController::class, 'getList']); 35 | Route::get('get-posts', [PostController::class, 'getPosts']); 36 | Route::get('get-category-posts/{id}', [PostController::class, 'getCategoryByPosts']); 37 | Route::get('get-post/{id}', [PostController::class, 'getPost']); 38 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | name('home'); 22 | 23 | 24 | Route::view('/{any?}', 'main-view') 25 | ->name('dashboard') 26 | ->where('any', '.*'); 27 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | import vue from '@vitejs/plugin-vue'; 4 | import path from 'path'; 5 | 6 | export default defineConfig({ 7 | plugins: [ 8 | laravel({ 9 | input: [ 10 | 'resources/sass/app.scss', 11 | 'resources/js/app.js', 12 | ], 13 | // reactivityTransform: true, 14 | refresh: true, 15 | }), 16 | vue({ 17 | template: { 18 | transformAssetUrls: { 19 | base: null, 20 | includeAbsolute: false, 21 | }, 22 | }, 23 | }), 24 | ], 25 | // build: { 26 | // chunkSizeWarningLimit: 1600, 27 | // }, 28 | resolve: { 29 | alias: { 30 | vue: 'vue/dist/vue.esm-bundler.js', 31 | '@': path.resolve(__dirname, './resources/js'), 32 | }, 33 | } 34 | }); 35 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // Delete the prefetch plugin 3 | chainWebpack: config => { 4 | config.plugins.delete('prefetch') 5 | } 6 | } 7 | --------------------------------------------------------------------------------