Skip to content

Commit 56585d4

Browse files
committed
Init
0 parents  commit 56585d4

File tree

159 files changed

+21488
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+21488
-0
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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

.env.example

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://laravel-api.test
6+
7+
LOG_CHANNEL=stack
8+
LOG_LEVEL=debug
9+
10+
DB_CONNECTION=mysql
11+
DB_HOST=localhost
12+
DB_PORT=3306
13+
DB_DATABASE=homestead
14+
DB_USERNAME=vagrant
15+
DB_PASSWORD=secret
16+
17+
BROADCAST_DRIVER=log
18+
CACHE_DRIVER=file
19+
QUEUE_CONNECTION=sync
20+
SESSION_DRIVER=file
21+
SESSION_LIFETIME=120
22+
23+
MEMCACHED_HOST=memcached
24+
25+
REDIS_HOST=redis
26+
REDIS_PASSWORD=null
27+
REDIS_PORT=6379
28+
29+
MAIL_MAILER=smtp
30+
MAIL_HOST=localhost
31+
MAIL_PORT=1025
32+
MAIL_USERNAME=null
33+
MAIL_PASSWORD=null
34+
MAIL_ENCRYPTION=null
35+
MAIL_FROM_ADDRESS=[email protected]
36+
MAIL_FROM_NAME="${APP_NAME}"
37+
38+
AWS_ACCESS_KEY_ID=
39+
AWS_SECRET_ACCESS_KEY=
40+
AWS_DEFAULT_REGION=us-east-1
41+
AWS_BUCKET=
42+
43+
PUSHER_APP_ID=
44+
PUSHER_APP_KEY=
45+
PUSHER_APP_SECRET=
46+
PUSHER_APP_CLUSTER=mt1
47+
48+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
49+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
50+
51+
SANCTUM_STATEFUL_DOMAINS=localhost:8080
52+
SESSION_DOMAIN=localhost
53+
SPA_URL=http://localhost:8080

.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
*.js linguist-vendored
5+
CHANGELOG.md export-ignore

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.idea/
2+
node_modules/
3+
public/css/
4+
public/js/
5+
public/hot/
6+
public/storage/
7+
storage/*.key
8+
vendor/
9+
.env
10+
.env.backup
11+
.phpunit.result.cache
12+
docker-compose.override.yml
13+
Homestead.json
14+
Homestead.yaml
15+
npm-debug.log
16+
yarn-error.log

.styleci.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
php:
2+
preset: laravel
3+
disabled:
4+
- no_unused_imports
5+
finder:
6+
not-name:
7+
- index.php
8+
- server.php
9+
js:
10+
finder:
11+
not-name:
12+
- webpack.mix.js
13+
css: true

README.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Laravel Vue Starter
2+
3+
The project was created to save myself time for redoing the same things all over again when starting a new Laravel/Vue project.
4+
5+
The main goal of this project is to reduce code and make everything simpler for bootstrapping new projects.
6+
7+
The project is built with the following components:
8+
9+
- Vue 3 / Vuex / VueRouter
10+
- Vue 3 Composition API
11+
- Laravel Framework
12+
- Laravel Sanctum
13+
- Laravel Fortify
14+
- Tailwind
15+
16+
## How to install
17+
18+
Installation is simple. Just like your ordinary Laravel app.
19+
20+
1. `git clone`
21+
2. `cd laravel-vue-starter`
22+
3. `composer install`
23+
4. `cp .env.example .env`
24+
5. `php artisan key:generate`
25+
6. `npm install`
26+
7. `npm run dev`
27+
28+
## How it works
29+
30+
### Authentication
31+
32+
The project ships with complete authentication boilerplate and includes the following pages:
33+
- Login
34+
- Register
35+
- Forget Password
36+
- Reset Password
37+
38+
### Structure
39+
40+
All the front-end code is located in `resources/js`. The code is well organized in different directories to make things more readable.
41+
42+
- `components` - This is the reusable components home
43+
- `pages` - Here you will add the pages
44+
- `plugins` - The plugins configurations
45+
- `router` - The router configuration including the middleware and the routes
46+
- `services` - The API services reside here
47+
- `store` - The store configuration
48+
- `utils` - Misc reusable functions and utils
49+
50+
### Examples
51+
52+
The project ships with the `Messages` component that is just an example of the CRUD operations in a Laravel and Vue project.
53+
54+
You will probably remove the examples once you start developing your app on top of this project.
55+
56+
## Contributions
57+
58+
Pull requests are welcome, feel free to contribute to this project.
59+
60+
## LICENSE
61+
62+
```
63+
Copyright (C) 2021 Darko Gjorgjijoski (https://darkog.com)
64+
65+
This file is part of Laravel Vue Starter
66+
67+
Laravel Vue Starter is free software: you can redistribute it and/or modify
68+
it under the terms of the GNU General Public License as published by
69+
the Free Software Foundation, either version 2 of the License, or
70+
(at your option) any later version.
71+
72+
Laravel Vue Starter is distributed in the hope that it will be useful,
73+
but WITHOUT ANY WARRANTY; without even the implied warranty of
74+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
75+
GNU General Public License for more details.
76+
77+
You should have received a copy of the GNU General Public License
78+
along with Laravel Vue Starter. If not, see <https://www.gnu.org/licenses/>.
79+
```

app/Actions/Fortify/CreateNewUser.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Actions\Fortify;
4+
5+
use App\Models\User;
6+
use Illuminate\Support\Facades\Hash;
7+
use Illuminate\Support\Facades\Validator;
8+
use Illuminate\Validation\Rule;
9+
use Laravel\Fortify\Contracts\CreatesNewUsers;
10+
11+
class CreateNewUser implements CreatesNewUsers
12+
{
13+
use PasswordValidationRules;
14+
15+
/**
16+
* Validate and create a newly registered user.
17+
*
18+
* @param array $input
19+
* @return \App\Models\User
20+
*/
21+
public function create(array $input)
22+
{
23+
Validator::make($input, [
24+
'name' => ['required', 'string', 'max:255'],
25+
'email' => [
26+
'required',
27+
'string',
28+
'email',
29+
'max:255',
30+
Rule::unique(User::class),
31+
],
32+
'password' => $this->passwordRules(),
33+
])->validate();
34+
35+
return User::create([
36+
'name' => $input['name'],
37+
'email' => $input['email'],
38+
'password' => Hash::make($input['password']),
39+
]);
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace App\Actions\Fortify;
4+
5+
use Laravel\Fortify\Rules\Password;
6+
7+
trait PasswordValidationRules
8+
{
9+
/**
10+
* Get the validation rules used to validate passwords.
11+
*
12+
* @return array
13+
*/
14+
protected function passwordRules()
15+
{
16+
return ['required', 'string', new Password, 'confirmed'];
17+
}
18+
}
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace App\Actions\Fortify;
4+
5+
use Illuminate\Support\Facades\Hash;
6+
use Illuminate\Support\Facades\Validator;
7+
use Laravel\Fortify\Contracts\ResetsUserPasswords;
8+
9+
class ResetUserPassword implements ResetsUserPasswords
10+
{
11+
use PasswordValidationRules;
12+
13+
/**
14+
* Validate and reset the user's forgotten password.
15+
*
16+
* @param mixed $user
17+
* @param array $input
18+
* @return void
19+
*/
20+
public function reset($user, array $input)
21+
{
22+
Validator::make($input, [
23+
'password' => $this->passwordRules(),
24+
])->validate();
25+
26+
$user->forceFill([
27+
'password' => Hash::make($input['password']),
28+
])->save();
29+
}
30+
}
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace App\Actions\Fortify;
4+
5+
use Illuminate\Support\Facades\Hash;
6+
use Illuminate\Support\Facades\Validator;
7+
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
8+
9+
class UpdateUserPassword implements UpdatesUserPasswords
10+
{
11+
use PasswordValidationRules;
12+
13+
/**
14+
* Validate and update the user's password.
15+
*
16+
* @param mixed $user
17+
* @param array $input
18+
* @return void
19+
*/
20+
public function update($user, array $input)
21+
{
22+
Validator::make($input, [
23+
'current_password' => ['required', 'string'],
24+
'password' => $this->passwordRules(),
25+
])->after(function ($validator) use ($user, $input) {
26+
if (! Hash::check($input['current_password'], $user->password)) {
27+
$validator->errors()->add('current_password', __('The provided password does not match your current password.'));
28+
}
29+
})->validateWithBag('updatePassword');
30+
31+
$user->forceFill([
32+
'password' => Hash::make($input['password']),
33+
])->save();
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
namespace App\Actions\Fortify;
4+
5+
use Illuminate\Contracts\Auth\MustVerifyEmail;
6+
use Illuminate\Support\Facades\Validator;
7+
use Illuminate\Validation\Rule;
8+
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
9+
10+
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
11+
{
12+
/**
13+
* Validate and update the given user's profile information.
14+
*
15+
* @param mixed $user
16+
* @param array $input
17+
* @return void
18+
*/
19+
public function update($user, array $input)
20+
{
21+
Validator::make($input, [
22+
'name' => ['required', 'string', 'max:255'],
23+
24+
'email' => [
25+
'required',
26+
'string',
27+
'email',
28+
'max:255',
29+
Rule::unique('users')->ignore($user->id),
30+
],
31+
])->validateWithBag('updateProfileInformation');
32+
33+
if ($input['email'] !== $user->email &&
34+
$user instanceof MustVerifyEmail) {
35+
$this->updateVerifiedUser($user, $input);
36+
} else {
37+
$user->forceFill([
38+
'name' => $input['name'],
39+
'email' => $input['email'],
40+
])->save();
41+
}
42+
}
43+
44+
/**
45+
* Update the given verified user's profile information.
46+
*
47+
* @param mixed $user
48+
* @param array $input
49+
* @return void
50+
*/
51+
protected function updateVerifiedUser($user, array $input)
52+
{
53+
$user->forceFill([
54+
'name' => $input['name'],
55+
'email' => $input['email'],
56+
'email_verified_at' => null,
57+
])->save();
58+
59+
$user->sendEmailVerificationNotification();
60+
}
61+
}

0 commit comments

Comments
 (0)