Skip to content

Commit 2b84f16

Browse files
Merge pull request #34 from creativetimofficial/master
merge repos
2 parents 6e59860 + c0072e9 commit 2b84f16

File tree

4,756 files changed

+189159
-34140
lines changed

Some content is hidden

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

4,756 files changed

+189159
-34140
lines changed

src/ArgonPreset.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ protected static function updatePackageArray(array $packages)
4747
*/
4848
protected static function updateAssets()
4949
{
50-
static::copyDirectory('resources/assets', public_path('argon'));
50+
static::copyDirectory('resources/assets', public_path('assets'));
51+
static::copyDirectory('resources/argon', public_path('argon'));
5152
}
5253

5354
/**
@@ -129,13 +130,14 @@ public static function addUserManagement()
129130
// Add routes
130131
file_put_contents(
131132
'./routes/web.php',
132-
"Route::group(['middleware' => 'auth'], function () {\n\tRoute::resource('user', 'UserController', ['except' => ['show']]);\n\tRoute::get('profile', ['as' => 'profile.edit', 'uses' => 'ProfileController@edit']);\n\tRoute::put('profile', ['as' => 'profile.update', 'uses' => 'ProfileController@update']);\n\tRoute::put('profile/password', ['as' => 'profile.password', 'uses' => 'ProfileController@password']);\n});\n\n",
133+
"Route::group(['middleware' => 'auth'], function () {\n\tRoute::resource('user', 'UserController', ['except' => ['show']]);\n\tRoute::get('profile', ['as' => 'profile.edit', 'uses' => 'ProfileController@edit']);\n\tRoute::put('profile', ['as' => 'profile.update', 'uses' => 'ProfileController@update']);\n\tRoute::get('upgrade', function () {return view('pages.upgrade');})->name('upgrade'); \n\t Route::get('map', function () {return view('pages.maps');})->name('map');\n\t Route::get('icons', function () {return view('pages.icons');})->name('icons'); \n\t Route::get('table-list', function () {return view('pages.tables');})->name('table');\n\tRoute::put('profile/password', ['as' => 'profile.password', 'uses' => 'ProfileController@password']);\n});\n\n",
133134
FILE_APPEND
134135
);
135136

136137
// Copy views
137138
static::copyDirectory('resources/views/users', resource_path('views/users'));
138139
static::copyDirectory('resources/views/profile', resource_path('views/profile'));
140+
static::copyDirectory('resources/views/pages', resource_path('views/pages'));
139141
}
140142

141143
/**
@@ -172,4 +174,4 @@ private static function copyDirectory($directory, $destination)
172174
{
173175
(new Filesystem)->copyDirectory(static::STUBSPATH.$directory, $destination);
174176
}
175-
}
177+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\User;
6+
use Illuminate\Console\Command;
7+
use Illuminate\Support\Facades\Hash;
8+
9+
class DeleteOldUsers extends Command
10+
{
11+
/**
12+
* The name and signature of the console command.
13+
*
14+
* @var string
15+
*/
16+
protected $signature = 'users:delete';
17+
18+
/**
19+
* The console command description.
20+
*
21+
* @var string
22+
*/
23+
protected $description = 'Delete user that more than 3 days older';
24+
25+
/**
26+
* Create a new command instance.
27+
*
28+
* @return void
29+
*/
30+
public function __construct()
31+
{
32+
parent::__construct();
33+
}
34+
35+
/**
36+
* Execute the console command.
37+
*
38+
* @return mixed
39+
*/
40+
public function handle()
41+
{
42+
User::where('id', 1)->update(['email' => '[email protected]', 'password' => Hash::make('secret')]);
43+
User::where('id', '!=', 1)->where('created_at', '<=', now()->subDays(3))->delete();
44+
}
45+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use App\Console\Commands\DeleteOldUsers;
6+
use Illuminate\Console\Scheduling\Schedule;
7+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
8+
9+
class Kernel extends ConsoleKernel
10+
{
11+
/**
12+
* The Artisan commands provided by your application.
13+
*
14+
* @var array
15+
*/
16+
protected $commands = [
17+
//
18+
];
19+
20+
/**
21+
* Define the application's command schedule.
22+
*
23+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
24+
* @return void
25+
*/
26+
protected function schedule(Schedule $schedule)
27+
{
28+
// * * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
29+
$schedule->command(DeleteOldUsers::class)->daily();
30+
}
31+
32+
/**
33+
* Register the commands for the application.
34+
*
35+
* @return void
36+
*/
37+
protected function commands()
38+
{
39+
$this->load(__DIR__.'/Commands');
40+
41+
require base_path('routes/console.php');
42+
}
43+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Throwable;
6+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
7+
8+
class Handler extends ExceptionHandler
9+
{
10+
/**
11+
* A list of the exception types that are not reported.
12+
*
13+
* @var array
14+
*/
15+
protected $dontReport = [
16+
//
17+
];
18+
19+
/**
20+
* A list of the inputs that are never flashed for validation exceptions.
21+
*
22+
* @var array
23+
*/
24+
protected $dontFlash = [
25+
'password',
26+
'password_confirmation',
27+
];
28+
29+
/**
30+
* Report or log an exception.
31+
*
32+
* @param \Exception $exception
33+
* @return void
34+
*/
35+
public function report(Throwable $exception)
36+
{
37+
parent::report($exception);
38+
}
39+
40+
/**
41+
* Render an exception into an HTTP response.
42+
*
43+
* @param \Illuminate\Http\Request $request
44+
* @param \Exception $exception
45+
* @return \Illuminate\Http\Response
46+
*/
47+
public function render($request, Throwable $exception)
48+
{
49+
return parent::render($request, $exception);
50+
}
51+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
7+
8+
class ForgotPasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset emails and
16+
| includes a trait which assists in sending these notifications from
17+
| your application to your users. Feel free to explore this trait.
18+
|
19+
*/
20+
21+
use SendsPasswordResetEmails;
22+
23+
/**
24+
* Create a new controller instance.
25+
*
26+
* @return void
27+
*/
28+
public function __construct()
29+
{
30+
$this->middleware('guest');
31+
}
32+
33+
/**
34+
* Send a reset link to the given user.
35+
*
36+
* @param \Illuminate\Http\Request $request
37+
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
38+
*/
39+
public function sendResetLinkEmail(Request $request)
40+
{
41+
$this->validateEmail($request);
42+
43+
return redirect()->back()->withInfo('Emails are not sent in the demo environment.');
44+
45+
// We will send the password reset link to this user. Once we have attempted
46+
// to send the link, we will examine the response then see the message we
47+
// need to show to the user. Finally, we'll send out a proper response.
48+
$response = $this->broker()->sendResetLink(
49+
$this->credentials($request)
50+
);
51+
52+
return $response == Password::RESET_LINK_SENT
53+
? $this->sendResetLinkResponse($request, $response)
54+
: $this->sendResetLinkFailedResponse($request, $response);
55+
}
56+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\AuthenticatesUsers;
7+
8+
class LoginController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Login Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller handles authenticating users for the application and
16+
| redirecting them to your home screen. The controller uses a trait
17+
| to conveniently provide its functionality to your applications.
18+
|
19+
*/
20+
21+
use AuthenticatesUsers;
22+
23+
/**
24+
* Where to redirect users after login.
25+
*
26+
* @var string
27+
*/
28+
protected $redirectTo = '/home';
29+
30+
/**
31+
* Create a new controller instance.
32+
*
33+
* @return void
34+
*/
35+
public function __construct()
36+
{
37+
$this->middleware('guest')->except('logout');
38+
}
39+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\User;
6+
use App\Http\Controllers\Controller;
7+
use Illuminate\Support\Facades\Hash;
8+
use Illuminate\Support\Facades\Validator;
9+
use Illuminate\Foundation\Auth\RegistersUsers;
10+
11+
class RegisterController extends Controller
12+
{
13+
/*
14+
|--------------------------------------------------------------------------
15+
| Register Controller
16+
|--------------------------------------------------------------------------
17+
|
18+
| This controller handles the registration of new users as well as their
19+
| validation and creation. By default this controller uses a trait to
20+
| provide this functionality without requiring any additional code.
21+
|
22+
*/
23+
24+
use RegistersUsers;
25+
26+
/**
27+
* Where to redirect users after registration.
28+
*
29+
* @var string
30+
*/
31+
protected $redirectTo = '/home';
32+
33+
/**
34+
* Create a new controller instance.
35+
*
36+
* @return void
37+
*/
38+
public function __construct()
39+
{
40+
$this->middleware('guest');
41+
}
42+
43+
/**
44+
* Get a validator for an incoming registration request.
45+
*
46+
* @param array $data
47+
* @return \Illuminate\Contracts\Validation\Validator
48+
*/
49+
protected function validator(array $data)
50+
{
51+
return Validator::make($data, [
52+
'name' => ['required', 'string', 'max:255'],
53+
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
54+
'password' => ['required', 'string', 'min:6', 'confirmed'],
55+
]);
56+
}
57+
58+
/**
59+
* Create a new user instance after a valid registration.
60+
*
61+
* @param array $data
62+
* @return \App\User
63+
*/
64+
protected function create(array $data)
65+
{
66+
return User::create([
67+
'name' => $data['name'],
68+
'email' => $data['email'],
69+
'password' => Hash::make($data['password']),
70+
]);
71+
}
72+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\ResetsPasswords;
7+
8+
class ResetPasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset requests
16+
| and uses a simple trait to include this behavior. You're free to
17+
| explore this trait and override any methods you wish to tweak.
18+
|
19+
*/
20+
21+
use ResetsPasswords;
22+
23+
/**
24+
* Where to redirect users after resetting their password.
25+
*
26+
* @var string
27+
*/
28+
protected $redirectTo = '/home';
29+
30+
/**
31+
* Create a new controller instance.
32+
*
33+
* @return void
34+
*/
35+
public function __construct()
36+
{
37+
$this->middleware('guest');
38+
}
39+
}

0 commit comments

Comments
 (0)