Skip to content

Commit 7f384dd

Browse files
Remove User management
1 parent 6ab4bae commit 7f384dd

File tree

6 files changed

+426
-338
lines changed

6 files changed

+426
-338
lines changed

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.background": "#490D65",
4+
"titleBar.activeBackground": "#67128E",
5+
"titleBar.activeForeground": "#FCF8FE"
6+
}
7+
}

readme.md

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ After initializing a fresh instance of Laravel (and making all the necessary con
5252

5353
Register a user or login using **admin@argon.com** and **secret** and start testing the preset (make sure to run the migrations and seeders for these credentials to be available).
5454

55-
Besides the dashboard and the auth pages this preset also has a user management example and an edit profile page. All the necessary files (controllers, requests, views) are installed out of the box and all the needed routes are added to `routes/web.php`. Keep in mind that all of the features can be viewed once you login using the credentials provided above or by registering your own user.
55+
Besides the dashboard and the auth pages this preset also has an edit profile page. All the necessary files (controllers, requests, views) are installed out of the box and all the needed routes are added to `routes/web.php`. Keep in mind that all of the features can be viewed once you login using the credentials provided above or by registering your own user.
5656

5757
### Dashboard
5858

@@ -86,56 +86,6 @@ public function rules()
8686
}
8787
```
8888

89-
### User management
90-
91-
The preset comes with a user management option out of the box. To access this click the "**User Management**" link in the left sidebar or add **/user** to the url.
92-
The first thing you will see is the listing of the existing users. You can add new ones by clicking the "**Add user**" button (above the table on the right). On the Add user page you will see the form that allows you to do this. All pages are generate using blade templates:
93-
94-
```
95-
<div class="form-group{{ $errors->has('name') ? ' has-danger' : '' }}">
96-
<label class="form-control-label" for="input-name">{{ __('Name') }}</label>
97-
<input type="text" name="name" id="input-name" class="form-control form-control-alternative{{ $errors->has('name') ? ' is-invalid' : '' }}" placeholder="{{ __('Name') }}" value="{{ old('name') }}" required autofocus>
98-
99-
@if ($errors->has('name'))
100-
<span class="invalid-feedback" role="alert">
101-
<strong>{{ $errors->first('name') }}</strong>
102-
</span>
103-
@endif
104-
</div>
105-
```
106-
107-
Also validation rules were added so you will know exactely what to enter in the form fields (see `App\Http\Requests\UserRequest`). Note that these validation rules also apply for the user edit option.
108-
109-
```
110-
public function rules()
111-
{
112-
return [
113-
'name' => [
114-
'required', 'min:3'
115-
],
116-
'email' => [
117-
'required', 'email', Rule::unique((new User)->getTable())->ignore($this->route()->user->id ?? null)
118-
],
119-
'password' => [
120-
$this->route()->user ? 'nullable' : 'required', 'confirmed', 'min:6'
121-
]
122-
];
123-
}
124-
```
125-
126-
Once you add more users, the list will get bigger and for every user you will have edit and delete options (access these options by clicking the three dotted menu that appears at the end of every line).
127-
128-
All the sample code for the user management can be found in `App\Http\Controllers\UserController`. See store method example bellow:
129-
130-
```
131-
public function store(UserRequest $request, User $model)
132-
{
133-
$model->create($request->merge(['password' => Hash::make($request->get('password'))])->all());
134-
135-
return redirect()->route('user.index')->withStatus(__('User successfully created.'));
136-
}
137-
```
138-
13989
## Change log
14090

14191
Please see the [changelog](changelog.md) for more information on what has changed recently.

src/argon-stubs/app/Http/Controllers/UserController.php

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -16,72 +16,6 @@ class UserController extends Controller
1616
*/
1717
public function index(User $model)
1818
{
19-
return view('users.index', ['users' => $model->paginate(15)]);
20-
}
21-
22-
/**
23-
* Show the form for creating a new user
24-
*
25-
* @return \Illuminate\View\View
26-
*/
27-
public function create()
28-
{
29-
return view('users.create');
30-
}
31-
32-
/**
33-
* Store a newly created user in storage
34-
*
35-
* @param \App\Http\Requests\UserRequest $request
36-
* @param \App\User $model
37-
* @return \Illuminate\Http\RedirectResponse
38-
*/
39-
public function store(UserRequest $request, User $model)
40-
{
41-
$model->create($request->merge(['password' => Hash::make($request->get('password'))])->all());
42-
43-
return redirect()->route('user.index')->withStatus(__('User successfully created.'));
44-
}
45-
46-
/**
47-
* Show the form for editing the specified user
48-
*
49-
* @param \App\User $user
50-
* @return \Illuminate\View\View
51-
*/
52-
public function edit(User $user)
53-
{
54-
return view('users.edit', compact('user'));
55-
}
56-
57-
/**
58-
* Update the specified user in storage
59-
*
60-
* @param \App\Http\Requests\UserRequest $request
61-
* @param \App\User $user
62-
* @return \Illuminate\Http\RedirectResponse
63-
*/
64-
public function update(UserRequest $request, User $user)
65-
{
66-
$hasPassword = $request->get("password");
67-
$user->update(
68-
$request->merge(['password' => Hash::make($request->get('password'))])
69-
->except([$hasPassword ? '' : 'password']
70-
));
71-
72-
return redirect()->route('user.index')->withStatus(__('User successfully updated.'));
73-
}
74-
75-
/**
76-
* Remove the specified user from storage
77-
*
78-
* @param \App\User $user
79-
* @return \Illuminate\Http\RedirectResponse
80-
*/
81-
public function destroy(User $user)
82-
{
83-
$user->delete();
84-
85-
return redirect()->route('user.index')->withStatus(__('User successfully deleted.'));
19+
return view('users.index');
8620
}
8721
}

src/argon-stubs/resources/views/users/create.blade.php

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/argon-stubs/resources/views/users/edit.blade.php

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)