Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Laravel 11.x Shift #12

Merged
merged 17 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ APP_COMPANY_NAME="Example Company Limited"
# Set this to be the URL you'll be hosting the app on
APP_URL=http://localhost

APP_TIMEZONE=UTC
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
BCRYPT_ROUNDS=12

# Set this to be the URL you want to redirect to when
# someone accesses the root/homepage of the app
HOME_REDIRECT_URL=https://example.com
Expand All @@ -33,6 +41,7 @@ MAIL_ENCRYPTION=null

# Logging details, don't need to change these to start with
LOG_CHANNEL=stack
LOG_STACK=single
LOG_LEVEL=debug

# Database connection
Expand All @@ -41,10 +50,13 @@ DB_CONNECTION=sqlite

# Queue, Cache and Session Details
# Should not need to change these
CACHE_DRIVER=file
CACHE_STORE=file
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

# Do not change these unless you know what you're doing
APP_ENV=production
Expand Down
8 changes: 4 additions & 4 deletions app/Console/Commands/AddUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public function handle(): int
}

$user = User::query()->where('email', '=', $email)->first();
if (!is_null($user)) {
if (! is_null($user)) {
$update = $this->confirm('User with that email already exists, Do you want to update them?');
if (!$update) {
if (! $update) {
$this->error('Taking no action');

return 1;
Expand All @@ -62,8 +62,8 @@ public function handle(): int
}

$user->fill([
'name' => $name,
'email' => $email,
'name' => $name,
'email' => $email,
'password' => Hash::make($password),
]);
$user->save();
Expand Down
32 changes: 0 additions & 32 deletions app/Console/Kernel.php

This file was deleted.

29 changes: 0 additions & 29 deletions app/Exceptions/Handler.php

This file was deleted.

4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/AuthenticatedSessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use App\Providers\RouteServiceProvider;
use App\Providers\AppServiceProvider;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
Expand All @@ -29,7 +29,7 @@ public function store(LoginRequest $request): RedirectResponse

$request->session()->regenerate();

return redirect(RouteServiceProvider::HOME);
return redirect(AppServiceProvider::HOME);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/Auth/ConfirmablePasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\Providers\AppServiceProvider;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
Expand All @@ -24,8 +24,8 @@ public function show(Request $request): View
*/
public function store(Request $request): RedirectResponse
{
if (!Auth::validate([
'email' => $request->user()->email,
if (! Auth::validate([
'email' => $request->user()->email,
'password' => $request->password,
])) {
return back()->withErrors([
Expand All @@ -35,6 +35,6 @@ public function store(Request $request): RedirectResponse

$request->session()->put('auth.password_confirmed_at', time());

return redirect()->intended(RouteServiceProvider::HOME);
return redirect()->intended(AppServiceProvider::HOME);
}
}
8 changes: 4 additions & 4 deletions app/Http/Controllers/Auth/NewPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function create(Request $request): View
public function store(Request $request): RedirectResponse
{
$request->validate([
'token' => 'required',
'email' => 'required|email',
'token' => 'required',
'email' => 'required|email',
'password' => 'required|string|confirmed|min:8',
]);

Expand All @@ -43,7 +43,7 @@ public function store(Request $request): RedirectResponse
$request->only('email', 'password', 'password_confirmation', 'token'),
function ($user) use ($request) {
$user->forceFill([
'password' => Hash::make($request->password),
'password' => Hash::make($request->password),
'remember_token' => Str::random(60),
])->save();

Expand All @@ -57,6 +57,6 @@ function ($user) use ($request) {
return $status == Password::PASSWORD_RESET
? redirect()->route('login')->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
->withErrors(['email' => __($status)]);
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/PasswordResetLinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public function store(Request $request): RedirectResponse
return $status == Password::RESET_LINK_SENT
? back()->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
->withErrors(['email' => __($status)]);
}
}
4 changes: 2 additions & 2 deletions app/Http/Controllers/CampaignController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function index(Request $request): View
$query = Campaign::query()->withCount(['sends', 'rssFeeds'])->orderBy('name');
$search = $request->get('search');
if ($search) {
$query->where('name', 'like', '%' . $search . '%');
$query->where('name', 'like', '%'.$search.'%');
}

$campaigns = $query->paginate(100)->withQueryString();
Expand All @@ -37,7 +37,7 @@ public function show(Request $request, Campaign $campaign): View
->withCount(['feeds']);
$search = $request->get('search');
if ($search) {
$sendQuery->where('name', 'like', '%' . $search . '%');
$sendQuery->where('name', 'like', '%'.$search.'%');
}

$sends = $sendQuery->paginate(100)->withQueryString();
Expand Down
12 changes: 6 additions & 6 deletions app/Http/Controllers/ContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function index(Request $request): View
$query = Contact::query()->orderBy('email')->withCount(['lists']);
$search = $request->get('search');
if ($search) {
$query->where('email', 'like', '%' . $search . '%');
$query->where('email', 'like', '%'.$search.'%');
}

$contacts = $query->paginate(100)->withQueryString();
Expand All @@ -44,12 +44,12 @@ public function create(): View
public function store(Request $request): RedirectResponse
{
$this->validate($request, [
'email' => 'required|email|unique:contacts,email',
'email' => 'required|email|unique:contacts,email',
'unsubscribed' => 'boolean',
]);

$contact = new Contact([
'email' => $request->get('email'),
'email' => $request->get('email'),
'unsubscribed' => $request->get('unsubscribed') === '1',
]);
$contact->save();
Expand All @@ -72,7 +72,7 @@ public function edit(Contact $contact): View
})->toArray();

return view('contacts.edit', [
'contact' => $contact,
'contact' => $contact,
'listOptions' => $allListOptions,
]);
}
Expand All @@ -83,12 +83,12 @@ public function edit(Contact $contact): View
public function update(Request $request, Contact $contact): RedirectResponse
{
$this->validate($request, [
'email' => "required|email|unique:contacts,email,{$contact->id}",
'email' => "required|email|unique:contacts,email,{$contact->id}",
'unsubscribed' => 'boolean',
]);

$contact->update([
'email' => $request->get('email'),
'email' => $request->get('email'),
'unsubscribed' => $request->get('unsubscribed') === '1',
]);

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/ContactListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ContactListController extends Controller
public function add(Request $request, Contact $contact): RedirectResponse
{
$this->validate($request, [
'lists' => 'array',
'lists' => 'array',
'lists.*' => 'integer',
]);

Expand All @@ -33,7 +33,7 @@ public function add(Request $request, Contact $contact): RedirectResponse
public function remove(Request $request, Contact $contact): RedirectResponse
{
$this->validate($request, [
'lists' => 'array',
'lists' => 'array',
'lists.*' => 'integer',
]);

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
abstract class Controller extends BaseController
{
use AuthorizesRequests;
use ValidatesRequests;
Expand Down
12 changes: 6 additions & 6 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class DashboardController extends Controller
public function index(): View
{
return view('dashboard.index', [
'recentSends' => $this->recentSends(),
'latestContacts' => $this->latestContacts(),
'popularLists' => $this->popularLists(),
'recentSends' => $this->recentSends(),
'latestContacts' => $this->latestContacts(),
'popularLists' => $this->popularLists(),
'upcomingRssFeeds' => $this->upcomingRssFeeds(),
'counts' => $this->getCounts(),
'counts' => $this->getCounts(),
]);
}

Expand All @@ -30,8 +30,8 @@ protected function getCounts(): array
{
return [
'contacts' => Contact::query()->count(),
'sends' => Send::query()->count(),
'sent' => SendRecord::query()->count(),
'sends' => Send::query()->count(),
'sent' => SendRecord::query()->count(),
];
}

Expand Down
16 changes: 8 additions & 8 deletions app/Http/Controllers/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public function index(Request $request): View
$query = MailList::query()->orderBy('name')->withCount('contacts');
$search = $request->get('search');
if ($search) {
$query->where('name', 'like', '%' . $search . '%')
->orWhere('display_name', 'like', '%' . $search . '%');
$query->where('name', 'like', '%'.$search.'%')
->orWhere('display_name', 'like', '%'.$search.'%');
}

$lists = $query->paginate(100)->withQueryString();
Expand All @@ -37,13 +37,13 @@ public function show(MailList $list, Request $request): View
$query = $list->contacts()->orderBy('email');
$search = $request->get('search');
if ($search) {
$query->where('email', 'like', '%' . $search . '%');
$query->where('email', 'like', '%'.$search.'%');
}

$contacts = $query->paginate(100)->withQueryString();

return view('lists.show', [
'list' => $list,
'list' => $list,
'contacts' => $contacts,
]);
}
Expand All @@ -64,9 +64,9 @@ public function create(): View
public function store(Request $request): RedirectResponse
{
$this->validate($request, [
'name' => 'required|max:250',
'name' => 'required|max:250',
'display_name' => 'required|max:250',
'slug' => 'max:250|alpha_dash|unique:mail_lists,slug',
'slug' => 'max:250|alpha_dash|unique:mail_lists,slug',
]);

$list = new MailList($request->all());
Expand Down Expand Up @@ -94,9 +94,9 @@ public function edit(MailList $list): View
public function update(Request $request, MailList $list): RedirectResponse
{
$this->validate($request, [
'name' => 'required|max:250',
'name' => 'required|max:250',
'display_name' => 'required|max:250',
'slug' => "max:250|alpha_dash|unique:mail_lists,slug,{$list->id}",
'slug' => "max:250|alpha_dash|unique:mail_lists,slug,{$list->id}",
]);

$list->fill($request->all());
Expand Down
Loading
Loading