diff --git a/.env.example b/.env.example index 95bc5b0a..6e971c0d 100755 --- a/.env.example +++ b/.env.example @@ -2,23 +2,40 @@ APP_NAME=LaraBlog APP_ENV=local APP_KEY= APP_DEBUG=true -APP_LOG_LEVEL=debug +APP_TIMEZONE=UTC APP_URL=http://localhost +APP_LOCALE=en +APP_FALLBACK_LOCALE=en +APP_FAKER_LOCALE=en_US + +APP_MAINTENANCE_DRIVER=file +APP_MAINTENANCE_STORE=database + +BCRYPT_ROUNDS=12 + +LOG_CHANNEL=stack +LOG_STACK=single +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 -DB_DATABASE=homestead +DB_DATABASE=larablog DB_USERNAME=root DB_PASSWORD= -BROADCAST_DRIVER=log -CACHE_DRIVER=array -SESSION_DRIVER=file -QUEUE_DRIVER=database +BROADCAST_CONNECTION=log +FILESYSTEM_DISK=local +QUEUE_CONNECTION=database -TELESCOPE_ENABLED=true +CACHE_STORE=database +CACHE_PREFIX= +MEMCACHED_HOST=127.0.0.1 + +REDIS_CLIENT=phpredis REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 @@ -32,9 +49,13 @@ MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS=null MAIL_FROM_NAME="${APP_NAME}" -PUSHER_APP_ID= -PUSHER_KEY= -PUSHER_SECRET= +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET= +AWS_USE_PATH_STYLE_ENDPOINT=false + +VITE_APP_NAME="${APP_NAME}" GOOGLE_DRIVE_CLIENT_ID= GOOGLE_DRIVE_CLIENT_SECRET= @@ -45,3 +66,4 @@ GOOGLE_ANALYTICS_TRACKING_ID= SENTRY_LARAVEL_DSN= SENTRY_TRACES_SAMPLE_RATE=1.0 + diff --git a/README.md b/README.md index e0914138..d12b112a 100755 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ A full-featured blogging system for personal use. No frontend theme and anything * Can navigate articles based on categories. ### Installation Process -1. Execute `composer create-project alimranahmed/larablog` on your terminal to download this project. +1. Execute `git clone https://github.com/alimranahmed/LaraBlog.git` on your terminal to download this project. 2. Go to the project root directory and execute `composer install` to install all PHP dependencies of the project 3. Create a file named as .env and copy the content of .env.example to newly created .env file 4. Then execute `php artisan key:generate` on your terminal/cmd to generate environment key diff --git a/app/Console/Commands/BackupSiteData.php b/app/Console/Commands/BackupSiteData.php deleted file mode 100644 index 20aaecef..00000000 --- a/app/Console/Commands/BackupSiteData.php +++ /dev/null @@ -1,51 +0,0 @@ - $path"); - Mail::to(Config::get('admin_email'))->send(new BackUpDatabase($path)); - } -} diff --git a/app/Console/Commands/GenerateSitemap.php b/app/Console/Commands/GenerateSitemap.php index f447ccf6..d2ff1129 100644 --- a/app/Console/Commands/GenerateSitemap.php +++ b/app/Console/Commands/GenerateSitemap.php @@ -14,7 +14,7 @@ class GenerateSitemap extends Command protected $description = 'Generate sitemap'; - public function handle() + public function handle(): void { $paginatedArticles = Article::getPaginated(); $latestArticleAt = $paginatedArticles->first()->created_at ?? Carbon::now()->toDateString(); diff --git a/app/Console/Commands/GetLocationByIP.php b/app/Console/Commands/GetLocationByIP.php deleted file mode 100644 index b7828825..00000000 --- a/app/Console/Commands/GetLocationByIP.php +++ /dev/null @@ -1,74 +0,0 @@ -get(); - - $this->info('Fetching location of '.$addresses->count().' addresses'); - - foreach ($addresses as $index => $address) { - $ip = $address->ip; - $location = $geoIp->getGeo($ip); - - $this->info( - ($index + 1).'/'.$addresses->count()." {$ip} => Country: ".($location->country_name ?? '') - ); - - if (! empty($location)) { - $address->update([ - 'country_code' => $location->country_code, - 'country_name' => $location->country_name, - 'region_name' => $location->region_name, - 'city' => $location->city ?? '', - 'zip_code' => $location->zip ?? '', - 'extra' => $location->extray ?? '', - 'timezone' => $location->time_zone ?? '', - 'latitude' => $location->latitude ?? '', - 'longitude' => $location->longitude ?? '', - 'metro_code' => $location->metro_code ?? '', - ]); - } - } - - $this->info('Done!'); - } -} diff --git a/app/Console/Commands/Utility/SyncPermission.php b/app/Console/Commands/Utility/SyncPermission.php index 2f0a658a..214d63a8 100644 --- a/app/Console/Commands/Utility/SyncPermission.php +++ b/app/Console/Commands/Utility/SyncPermission.php @@ -7,36 +7,11 @@ class SyncPermission extends Command { - /** - * The name and signature of the console command. - * - * @var string - */ protected $signature = 'utility:sync-permission'; - /** - * The console command description. - * - * @var string - */ - protected $description = 'Command description'; + protected $description = 'Sync permission based on acl.php config file'; - /** - * Create a new command instance. - * - * @return void - */ - public function __construct() - { - parent::__construct(); - } - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() + public function handle(): void { $this->info('Syncing the roles and permission'); (new \RolesAndPermissionsTableSeeder())->run(); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php deleted file mode 100755 index e078f077..00000000 --- a/app/Console/Kernel.php +++ /dev/null @@ -1,32 +0,0 @@ -command('get-ip-location')->hourly(); - - $schedule->command('backup:run', ['--only-db'])->monthly(); - - $schedule->command('sitemap:generate')->weekly(); - - $schedule->command('telescope:prune')->daily(); - } - - /** - * Register the Closure based commands for the application. - */ - protected function commands(): void - { - $this->load(__DIR__.'/Commands'); - require base_path('routes/console.php'); - } -} diff --git a/app/Events/ArticleHit.php b/app/Events/ArticleHit.php deleted file mode 100644 index 20ae4bd4..00000000 --- a/app/Events/ArticleHit.php +++ /dev/null @@ -1,40 +0,0 @@ -article = $article; - $this->clientIP = $clientIP; - } - - /** - * Get the channels the event should broadcast on. - * - * @return \Illuminate\Broadcasting\Channel|array - */ - public function broadcastOn() - { - return new PrivateChannel('channel-name'); - } -} diff --git a/app/Events/CommentOnArticle.php b/app/Events/CommentOnArticle.php deleted file mode 100644 index f6c730e1..00000000 --- a/app/Events/CommentOnArticle.php +++ /dev/null @@ -1,60 +0,0 @@ -message = $message; - $this->broadcastToPusher(); - } - - private function broadcastToPusher() - { - $options = [ - 'encrypted' => true, - ]; - $pusher = new Pusher( - env('PUSHER_KEY'), - env('PUSHER_SECRET'), - env('PUSHER_APP_ID'), - $options - ); - - $data['message'] = $this->message; - $pusher->trigger('visitor-activity', 'comment', $data); - } - - /** - * Get the channels the event should broadcast on. - * - * @return Channel|array - */ - public function broadcastOn() - { - return new PrivateChannel('visitor-activity'); - } - - public function broadcastAs() - { - return 'comment-on-article'; - } -} diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php deleted file mode 100755 index 26fbddf5..00000000 --- a/app/Exceptions/Handler.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ - protected $dontFlash = [ - 'current_password', - 'password', - 'password_confirmation', - ]; - - /** - * Register the exception handling callbacks for the application. - */ - public function register(): void - { - $this->reportable(function (Throwable $e) { - if (app()->bound('sentry')) { - app('sentry')->captureException($e); - } - }); - } -} diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php deleted file mode 100644 index 847ca049..00000000 --- a/app/Helpers/helpers.php +++ /dev/null @@ -1,24 +0,0 @@ - $value) { - $arrayElements[] = [ - 'key' => $key, - 'value' => $value, - ]; - } - - return json_encode($arrayElements); -} - -function exceptionLine(Exception $e): string -{ - return $e->getLine().': '.$e->getFile().' '.$e->getMessage(); -} diff --git a/app/Http/Controllers/ArticleController.php b/app/Http/Controllers/ArticleController.php index 2cb3d5f2..5b0e29be 100644 --- a/app/Http/Controllers/ArticleController.php +++ b/app/Http/Controllers/ArticleController.php @@ -71,7 +71,7 @@ private function getRelatedArticles(Article $article): Collection */ public function search(Request $request): View { - $this->validate($request, ['query_string' => 'required']); + $request->validate(['query_string' => 'required']); $queryString = $request->get('query_string'); diff --git a/app/Http/Controllers/Auth/ConfirmPasswordController.php b/app/Http/Controllers/Auth/ConfirmPasswordController.php deleted file mode 100644 index 138c1f08..00000000 --- a/app/Http/Controllers/Auth/ConfirmPasswordController.php +++ /dev/null @@ -1,40 +0,0 @@ -middleware('auth'); - } -} diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php deleted file mode 100755 index 465c39cc..00000000 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ /dev/null @@ -1,22 +0,0 @@ -middleware('guest', ['except' => 'logout']); - } -} diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php deleted file mode 100755 index 54195a88..00000000 --- a/app/Http/Controllers/Auth/RegisterController.php +++ /dev/null @@ -1,70 +0,0 @@ -middleware('guest'); - } - - /** - * Get a validator for an incoming registration request. - * - * @return \Illuminate\Contracts\Validation\Validator - */ - protected function validator(array $data) - { - return Validator::make($data, [ - 'name' => 'required|max:255', - 'email' => 'required|email|max:255|unique:users', - 'password' => 'required|min:6|confirmed', - ]); - } - - /** - * Create a new user instance after a valid registration. - * - * @return User - */ - protected function create(array $data) - { - return User::create([ - 'name' => $data['name'], - 'email' => $data['email'], - 'password' => bcrypt($data['password']), - ]); - } -} diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php deleted file mode 100755 index b1726a36..00000000 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ /dev/null @@ -1,30 +0,0 @@ -middleware('auth'); - $this->middleware('signed')->only('verify'); - $this->middleware('throttle:6,1')->only('verify', 'resend'); - } -} diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 0104c07e..8edcdb50 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -2,12 +2,14 @@ namespace App\Http\Controllers; +use Illuminate\Contracts\View\View; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; class AuthController extends Controller { - public function showLoginForm() + public function showLoginForm(): View|RedirectResponse { if (Auth::check()) { return redirect()->route('admin-dashboard'); @@ -16,15 +18,12 @@ public function showLoginForm() return view('backend.auth'); } - public function login(Request $request) + public function login(Request $request): RedirectResponse { - $this->validate( - $request, - [ - 'email' => 'required|email', - 'password' => 'required|min:4', - ] - ); + $request->validate([ + 'email' => 'required|email', + 'password' => 'required|min:4', + ]); $credentials = $request->only('email', 'password'); @@ -37,7 +36,7 @@ public function login(Request $request) return back()->with('auth_error', 'Invalid credentials')->withInput(); } - public function logout() + public function logout(): RedirectResponse { Auth::logout(); diff --git a/app/Http/Controllers/Backend/SubscriberController.php b/app/Http/Controllers/Backend/SubscriberController.php index 9eb19226..a873e562 100644 --- a/app/Http/Controllers/Backend/SubscriberController.php +++ b/app/Http/Controllers/Backend/SubscriberController.php @@ -2,9 +2,11 @@ namespace App\Http\Controllers\Backend; +use Illuminate\Contracts\View\View; + class SubscriberController { - public function index() + public function index(): View { return view('backend.subscribers.index'); } diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index 9c3ae24f..16bc6d72 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -3,16 +3,17 @@ namespace App\Http\Controllers; use App\Models\Article; +use Illuminate\Contracts\View\View; use Illuminate\Http\Request; class CategoryController extends Controller { - public function index() + public function index(): View { return view('backend.categories.index'); } - public function getArticles(Request $request, $categoryAlias) + public function getArticles(Request $request, $categoryAlias): View { $articles = Article::getPaginated($request); diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php index 0672411e..3f2fc8bd 100644 --- a/app/Http/Controllers/CommentController.php +++ b/app/Http/Controllers/CommentController.php @@ -5,33 +5,37 @@ use App\Mail\NotifyCommentThread; use App\Models\Comment; use App\Models\User; +use Illuminate\Contracts\View\View; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Mail; class CommentController extends Controller { - public function index() + public function index(): View { return view('backend.comments.index'); } - public function edit(Comment $comment) + public function edit(Comment $comment): View { return view('backend.comments.edit', compact('comment')); } - public function show(Comment $comment) + public function show(Comment $comment): View { return view('backend.comments.show', compact('comment')); } - public function confirmComment(Request $request, $commentId) + public function confirmComment(Request $request, $commentId): View|RedirectResponse { try { - $this->validate($request, ['token' => 'required']); + $request->validate(['token' => 'required']); - $comment = Comment::where('id', $commentId) + /** @var Comment $comment */ + $comment = Comment::query() + ->where('id', $commentId) ->where('token', $request->get('token')) ->with('article') ->first(); @@ -52,11 +56,11 @@ public function confirmComment(Request $request, $commentId) //notify all user of the comment thread about the new comment except him person who replied if ($comment->parent_comment_id) { - $threadUserIDs = Comment::where('parent_comment_id', $comment->parent_comment_id) + $threadUserIDs = Comment::query()->where('parent_comment_id', $comment->parent_comment_id) ->orWhere('id', $comment->parent_comment_id) ->pluck('user_id'); - $threadUserEmails = User::whereIn('id', $threadUserIDs) + $threadUserEmails = User::query()->whereIn('id', $threadUserIDs) ->where('email', '!=', $comment->user->email) ->pluck('email') ->unique() diff --git a/app/Http/Controllers/ConfigController.php b/app/Http/Controllers/ConfigController.php index 5834c7fc..225f0728 100644 --- a/app/Http/Controllers/ConfigController.php +++ b/app/Http/Controllers/ConfigController.php @@ -2,9 +2,11 @@ namespace App\Http\Controllers; +use Illuminate\Contracts\View\View; + class ConfigController extends Controller { - public function index() + public function index(): View { return view('backend.config.index'); } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 2df725f3..6ed7efb6 100755 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -3,15 +3,10 @@ namespace App\Http\Controllers; use Exception; -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; -use Illuminate\Foundation\Validation\ValidatesRequests; -use Illuminate\Routing\Controller as BaseController; use Illuminate\Validation\ValidationException; -class Controller extends BaseController +abstract class Controller { - use AuthorizesRequests, ValidatesRequests; - protected string $frontView; public function __construct() diff --git a/app/Http/Controllers/FeedbackController.php b/app/Http/Controllers/FeedbackController.php index c5157e29..95119e3e 100644 --- a/app/Http/Controllers/FeedbackController.php +++ b/app/Http/Controllers/FeedbackController.php @@ -5,17 +5,19 @@ use App\Mail\NotifyAdmin; use App\Models\Config; use App\Models\Feedback; +use Illuminate\Contracts\View\View; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Mail; class FeedbackController extends Controller { - public function index() + public function index(): View { return view('backend.feedback.index'); } - public function store(Request $request) + public function store(Request $request): RedirectResponse { $data = $request->validate([ 'email' => 'required|email', @@ -25,7 +27,7 @@ public function store(Request $request) $data['ip'] = $_SERVER['REMOTE_ADDR']; - $feedback = Feedback::create($data); + $feedback = Feedback::query()->create($data); Mail::to(Config::get('admin_email'))->queue(new NotifyAdmin($feedback, route('login-form'))); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index f7f203ed..15832a68 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,12 +2,13 @@ namespace App\Http\Controllers; +use Illuminate\Contracts\View\View; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; class HomeController extends Controller { - public function index(Request $request) + public function index(Request $request): View { if (Auth::check()) { $dashboard = new DashboardController(); diff --git a/app/Http/Controllers/KeywordController.php b/app/Http/Controllers/KeywordController.php index c35ee6b5..1f3c3ed7 100644 --- a/app/Http/Controllers/KeywordController.php +++ b/app/Http/Controllers/KeywordController.php @@ -4,18 +4,19 @@ use App\Models\Article; use App\Models\Keyword; +use Illuminate\Contracts\View\View; use Illuminate\Http\Request; class KeywordController extends Controller { - public function index() + public function index(): View { $keywords = Keyword::with('articles')->get(); return view('backend.keywords.index', compact('keywords')); } - public function getArticles(Request $request, $keywordName) + public function getArticles(Request $request, $keywordName): View { $articles = Article::getPaginated($request); diff --git a/app/Http/Controllers/SubscriptionController.php b/app/Http/Controllers/SubscriptionController.php index 65dffe0d..2c73494d 100644 --- a/app/Http/Controllers/SubscriptionController.php +++ b/app/Http/Controllers/SubscriptionController.php @@ -3,15 +3,16 @@ namespace App\Http\Controllers; use App\Models\Subscriber; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; class SubscriptionController extends Controller { - public function confirm(Request $request) + public function confirm(Request $request): RedirectResponse { - $this->validate($request, ['token' => 'required']); + $request->validate(['token' => 'required']); - $subscriber = Subscriber::where('token', $request->token)->first(); + $subscriber = Subscriber::query()->where('token', $request->token)->first(); if (is_null($subscriber)) { return redirect()->route('home')->with('error', 'Invalid request'); @@ -22,9 +23,9 @@ public function confirm(Request $request) return redirect()->route('home')->with('success', 'Congratulation, we are connected now!'); } - public function unsubscribe(Request $request) + public function unsubscribe(Request $request): RedirectResponse { - $this->validate($request, ['token' => 'required']); + $request->validate(['token' => 'required']); $subscriber = Subscriber::where('token', $request->token)->first(); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 052b50d2..5c734731 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -3,34 +3,35 @@ namespace App\Http\Controllers; use App\Models\User; +use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Auth; use Spatie\Permission\Models\Role; class UserController extends Controller { - public function index() + public function index(): View { return view('backend.users.index'); } - public function create() + public function create(): View { - $roles = Role::where('name', '!=', 'owner')->get(); + $roles = Role::query()->where('name', '!=', 'owner')->get(); return view('backend.users.create', compact('roles')); } - public function edit(User $user) + public function edit(User $user): View { return view('backend.users.edit', compact('user')); } - public function editPassword() + public function editPassword(): View { return view('backend.users.edit_password'); } - public function profile() + public function profile(): View { $user = Auth::user(); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php deleted file mode 100755 index 0afa10ad..00000000 --- a/app/Http/Kernel.php +++ /dev/null @@ -1,85 +0,0 @@ - - */ - protected $middleware = [ - \App\Http\Middleware\TrustProxies::class, - \App\Http\Middleware\PreventRequestsDuringMaintenance::class, - \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, - \App\Http\Middleware\TrimStrings::class, - \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, - ]; - - /** - * The application's route middleware groups. - * - * @var array - */ - protected $middlewareGroups = [ - 'web' => [ - \App\Http\Middleware\EncryptCookies::class, - \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, - \Illuminate\Session\Middleware\StartSession::class, - // \Illuminate\Session\Middleware\AuthenticateSession::class, - \Illuminate\View\Middleware\ShareErrorsFromSession::class, - \App\Http\Middleware\VerifyCsrfToken::class, - \Illuminate\Routing\Middleware\SubstituteBindings::class, - ], - - 'api' => [ - \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', - \Illuminate\Routing\Middleware\SubstituteBindings::class, - ], - ]; - - /** - * The application's middleware aliases. - * - * Aliases may be used instead of class names to conveniently assign middleware to routes and groups. - * - * @var array - */ - protected $middlewareAliases = [ - 'auth' => \App\Http\Middleware\Authenticate::class, - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, - 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, - 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, - 'can' => \Illuminate\Auth\Middleware\Authorize::class, - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, - 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, - 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, - //vendor added - 'role' => \Spatie\Permission\Middleware\RoleMiddleware::class, - 'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class, - ]; - - /** - * The priority-sorted list of middleware. - * - * This forces non-global middleware to always be in the given order. - * - * @var array - */ - protected $middlewarePriority = [ - \Illuminate\Session\Middleware\StartSession::class, - \Illuminate\View\Middleware\ShareErrorsFromSession::class, - \App\Http\Middleware\Authenticate::class, - \Illuminate\Routing\Middleware\ThrottleRequests::class, - \Illuminate\Session\Middleware\AuthenticateSession::class, - \Illuminate\Routing\Middleware\SubstituteBindings::class, - \Illuminate\Auth\Middleware\Authorize::class, - ]; -} diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php deleted file mode 100755 index d4ef6447..00000000 --- a/app/Http/Middleware/Authenticate.php +++ /dev/null @@ -1,17 +0,0 @@ -expectsJson() ? null : route('login'); - } -} diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php deleted file mode 100755 index 3aa15f8d..00000000 --- a/app/Http/Middleware/EncryptCookies.php +++ /dev/null @@ -1,17 +0,0 @@ -check()) { - return redirect(RouteServiceProvider::HOME); - } - } - - return $next($request); - } -} diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php deleted file mode 100644 index 5a50e7b5..00000000 --- a/app/Http/Middleware/TrimStrings.php +++ /dev/null @@ -1,18 +0,0 @@ - - */ - public function hosts(): array - { - return [ - $this->allSubdomainsOfApplicationUrl(), - ]; - } -} diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php deleted file mode 100644 index 3391630e..00000000 --- a/app/Http/Middleware/TrustProxies.php +++ /dev/null @@ -1,28 +0,0 @@ -|string|null - */ - protected $proxies; - - /** - * The headers that should be used to detect proxies. - * - * @var int - */ - protected $headers = - Request::HEADER_X_FORWARDED_FOR | - Request::HEADER_X_FORWARDED_HOST | - Request::HEADER_X_FORWARDED_PORT | - Request::HEADER_X_FORWARDED_PROTO | - Request::HEADER_X_FORWARDED_AWS_ELB; -} diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php deleted file mode 100755 index a2c35414..00000000 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ /dev/null @@ -1,17 +0,0 @@ -filePath = $filePath; - } - - public function build() - { - return $this->from(Config::get('admin_email'), Config::get('site_name')) - ->subject('Database backup for blog') - ->view('emails.backup_database') - ->attach($this->filePath); - } -} diff --git a/app/Models/Comment.php b/app/Models/Comment.php index 2d87d662..011ca3a9 100644 --- a/app/Models/Comment.php +++ b/app/Models/Comment.php @@ -5,6 +5,8 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; class Comment extends Model { @@ -15,32 +17,32 @@ class Comment extends Model protected $casts = ['published_at' => 'datetime']; - public function article() + public function article(): BelongsTo { return $this->belongsTo(Article::class); } - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } - public function replies() + public function replies(): HasMany { return $this->hasMany(Comment::class, 'parent_comment_id'); } - public function parentComment() + public function parentComment(): BelongsTo { return $this->belongsTo(Comment::class, 'parent_comment_id'); } - public function scopePublished(Builder $builder) + public function scopePublished(Builder $builder): Builder { return $builder->where('is_published', 1); } - public function scopeNoReplies(Builder $builder) + public function scopeNoReplies(Builder $builder): Builder { return $builder->where('parent_comment_id', null); } diff --git a/app/Models/Reader.php b/app/Models/Reader.php index 603b5099..15c9650e 100644 --- a/app/Models/Reader.php +++ b/app/Models/Reader.php @@ -9,12 +9,12 @@ class Reader extends Model { protected $guarded = ['id']; - public function scopeVerified(Builder $builder) + public function scopeVerified(Builder $builder): Builder { return $builder->where('is_verified', 1); } - public function scopeSubscribed(Builder $builder) + public function scopeSubscribed(Builder $builder): Builder { return $builder->where('notify', 1); } diff --git a/app/Models/User.php b/app/Models/User.php index 94931a1b..fc027651 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -22,13 +22,21 @@ class User extends Authenticatable use HasRoles; use Notifiable; - protected $casts = [ - 'email_verified_at' => 'datetime', - 'password' => 'hashed', - ]; - protected $guarded = ['id']; + /** + * Get the attributes that should be cast. + * + * @return array + */ + protected function casts(): array + { + return [ + 'email_verified_at' => 'datetime', + 'password' => 'hashed', + ]; + } + public function articles(): HasMany { return $this->hasMany(Article::class); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index e4bee171..68b91e17 100755 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -4,6 +4,7 @@ use App\Services\Google\GoogleDrive; use Illuminate\Pagination\Paginator; +use Illuminate\Support\Facades\Gate; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -13,6 +14,12 @@ class AppServiceProvider extends ServiceProvider */ public function boot(): void { + // Implicitly grant "Super Admin" role all permissions + // This works in the app by using gate-related functions like auth()->user->can() and @can() + Gate::before(function ($user, $ability) { + return $user->hasRole('owner') ? true : null; + }); + Paginator::useTailwind(); GoogleDrive::loadStorageDriver(); diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php deleted file mode 100755 index 44a32125..00000000 --- a/app/Providers/AuthServiceProvider.php +++ /dev/null @@ -1,32 +0,0 @@ - - */ - protected $policies = [ - // - ]; - - /** - * Register any authentication / authorization services. - */ - public function boot(): void - { - $this->registerPolicies(); - - // Implicitly grant "Super Admin" role all permissions - // This works in the app by using gate-related functions like auth()->user->can() and @can() - Gate::before(function ($user, $ability) { - return $user->hasRole('owner') ? true : null; - }); - } -} diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php deleted file mode 100755 index 896c0801..00000000 --- a/app/Providers/BroadcastServiceProvider.php +++ /dev/null @@ -1,24 +0,0 @@ -id === (int) $userId; - }); - } -} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php deleted file mode 100755 index 866a8761..00000000 --- a/app/Providers/EventServiceProvider.php +++ /dev/null @@ -1,37 +0,0 @@ -> - */ - protected $listen = [ - Registered::class => [ - //SendEmailVerificationNotification::class, - ], - ]; - - /** - * Register any events for your application. - */ - public function boot(): void - { - // - } - - /** - * Determine if events and listeners should be automatically discovered. - */ - public function shouldDiscoverEvents(): bool - { - return false; - } -} diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php deleted file mode 100755 index 71e4e9e4..00000000 --- a/app/Providers/RouteServiceProvider.php +++ /dev/null @@ -1,43 +0,0 @@ -by($request->user()?->id ?: $request->ip()); - }); - - $this->routes(function () { - Route::middleware('api') - ->prefix('api') - ->group(base_path('routes/api.php')); - - Route::middleware('web') - ->group(base_path('routes/web.php')); - - Route::middleware('web') - ->prefix('admin') - ->group(base_path('routes/backend.php')); - }); - - } -} diff --git a/artisan b/artisan index 5c23e2e2..8e04b422 100755 --- a/artisan +++ b/artisan @@ -1,53 +1,15 @@ #!/usr/bin/env php make(Illuminate\Contracts\Console\Kernel::class); - -$status = $kernel->handle( - $input = new Symfony\Component\Console\Input\ArgvInput, - new Symfony\Component\Console\Output\ConsoleOutput -); - -/* -|-------------------------------------------------------------------------- -| Shutdown The Application -|-------------------------------------------------------------------------- -| -| Once Artisan has finished running, we will fire off the shutdown events -| so that any final work may be done by the application before we shut -| down the process. This is the last thing to happen to the request. -| -*/ - -$kernel->terminate($input, $status); +// Bootstrap Laravel and handle the command... +$status = (require_once __DIR__.'/bootstrap/app.php') + ->handleCommand(new ArgvInput); exit($status); diff --git a/bootstrap/app.php b/bootstrap/app.php index 037e17df..00fac207 100755 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,55 +1,28 @@ singleton( - Illuminate\Contracts\Http\Kernel::class, - App\Http\Kernel::class -); - -$app->singleton( - Illuminate\Contracts\Console\Kernel::class, - App\Console\Kernel::class -); - -$app->singleton( - Illuminate\Contracts\Debug\ExceptionHandler::class, - App\Exceptions\Handler::class -); - -/* -|-------------------------------------------------------------------------- -| Return The Application -|-------------------------------------------------------------------------- -| -| This script returns the application instance. The instance is given to -| the calling script so we can separate the building of the instances -| from the actual running of the application and sending responses. -| -*/ - -return $app; +use Illuminate\Foundation\Application; +use Illuminate\Foundation\Configuration\Exceptions; +use Illuminate\Foundation\Configuration\Middleware; +use Illuminate\Support\Facades\Route; +use Sentry\Laravel\Integration; + +return Application::configure(basePath: dirname(__DIR__)) + ->withRouting( + web: __DIR__.'/../routes/web.php', + commands: __DIR__.'/../routes/console.php', + health: '/up', + then: function () { + Route::middleware('web') + ->prefix('admin') + ->group(base_path('routes/backend.php')); + } + ) + ->withMiddleware(function (Middleware $middleware) { + $middleware->alias([ + 'role' => \Spatie\Permission\Middleware\RoleMiddleware::class, + 'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class, + ]); + }) + ->withExceptions(function (Exceptions $exceptions) { + Integration::handles($exceptions); + })->create(); diff --git a/bootstrap/providers.php b/bootstrap/providers.php new file mode 100644 index 00000000..ca0f48dc --- /dev/null +++ b/bootstrap/providers.php @@ -0,0 +1,7 @@ + env('APP_NAME', 'Imranic.com'), @@ -50,7 +47,7 @@ | | This URL is used by the console to properly generate URLs when using | the Artisan command line tool. You should set this to the root of - | your application so that it is used when running Artisan tasks. + | the application so that it's available within Artisan commands. | */ @@ -62,12 +59,12 @@ |-------------------------------------------------------------------------- | | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. We have gone - | ahead and set this to a sensible default for you out of the box. + | will be used by the PHP date and date-time functions. The timezone + | is set to "UTC" by default as it is suitable for most use cases. | */ - 'timezone' => 'UTC', + 'timezone' => env('APP_TIMEZONE', 'UTC'), /* |-------------------------------------------------------------------------- @@ -75,101 +72,54 @@ |-------------------------------------------------------------------------- | | The application locale determines the default locale that will be used - | by the translation service provider. You are free to set this value - | to any of the locales which will be supported by the application. + | by Laravel's translation / localization methods. This option can be + | set to any locale for which you plan to have translation strings. | */ - 'locale' => 'en', + 'locale' => env('APP_LOCALE', 'en'), - /* - |-------------------------------------------------------------------------- - | Application Fallback Locale - |-------------------------------------------------------------------------- - | - | The fallback locale determines the locale to use when the current one - | is not available. You may change the value to correspond to any of - | the language folders that are provided through your application. - | - */ + 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), - 'fallback_locale' => 'en', + 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), /* |-------------------------------------------------------------------------- | Encryption Key |-------------------------------------------------------------------------- | - | This key is used by the Illuminate encrypter service and should be set - | to a random, 32 character string, otherwise these encrypted strings - | will not be safe. Please do this before deploying an application! + | This key is utilized by Laravel's encryption services and should be set + | to a random, 32 character string to ensure that all encrypted values + | are secure. You should do this prior to deploying the application. | */ - 'key' => env('APP_KEY'), - 'cipher' => 'AES-256-CBC', - /* - |-------------------------------------------------------------------------- - | Logging Configuration - |-------------------------------------------------------------------------- - | - | Here you may configure the log settings for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. - | - | Available Settings: "single", "daily", "syslog", "errorlog" - | - */ - - 'log' => env('APP_LOG', 'single'), + 'key' => env('APP_KEY'), - 'log_level' => env('APP_LOG_LEVEL', 'debug'), + 'previous_keys' => [ + ...array_filter( + explode(',', env('APP_PREVIOUS_KEYS', '')) + ), + ], /* |-------------------------------------------------------------------------- - | Autoloaded Service Providers + | Maintenance Mode Driver |-------------------------------------------------------------------------- | - | The service providers listed here will be automatically loaded on the - | request to your application. Feel free to add your own services to - | this array to grant expanded functionality to your applications. - | - */ - - 'providers' => ServiceProvider::defaultProviders()->merge([ - /* - * Package Service Providers... - */ - - Spatie\Permission\PermissionServiceProvider::class, - - /* - * Application Service Providers... - */ - App\Providers\AppServiceProvider::class, - App\Providers\AuthServiceProvider::class, - App\Providers\BroadcastServiceProvider::class, - App\Providers\EventServiceProvider::class, - App\Providers\TelescopeServiceProvider::class, - App\Providers\RouteServiceProvider::class, - App\Providers\ViewServiceProvider::class, - ])->toArray(), - - /* - |-------------------------------------------------------------------------- - | Class Aliases - |-------------------------------------------------------------------------- + | These configuration options determine the driver used to determine and + | manage Laravel's "maintenance mode" status. The "cache" driver will + | allow maintenance mode to be controlled across multiple machines. | - | This array of class aliases will be registered when this application - | is started. However, feel free to register as many as you wish as - | the aliases are "lazy" loaded so they don't hinder performance. + | Supported drivers: "file", "cache" | */ - 'aliases' => Facade::defaultAliases()->merge([ - // 'Example' => App\Facades\Example::class, - ])->toArray(), + 'maintenance' => [ + 'driver' => env('APP_MAINTENANCE_DRIVER', 'file'), + 'store' => env('APP_MAINTENANCE_STORE', 'database'), + ], ]; diff --git a/config/auth.php b/config/auth.php index 9548c15d..0ba5d5d8 100755 --- a/config/auth.php +++ b/config/auth.php @@ -7,15 +7,15 @@ | Authentication Defaults |-------------------------------------------------------------------------- | - | This option controls the default authentication "guard" and password - | reset options for your application. You may change these defaults + | This option defines the default authentication "guard" and password + | reset "broker" for your application. You may change these values | as required, but they're a perfect start for most applications. | */ 'defaults' => [ - 'guard' => 'web', - 'passwords' => 'users', + 'guard' => env('AUTH_GUARD', 'web'), + 'passwords' => env('AUTH_PASSWORD_BROKER', 'users'), ], /* @@ -25,11 +25,11 @@ | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you - | here which uses session storage and the Eloquent user provider. + | which utilizes session storage plus the Eloquent user provider. | - | All authentication drivers have a user provider. This defines how the + | All authentication guards have a user provider, which defines how the | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. + | system used by the application. Typically, Eloquent is utilized. | | Supported: "session" | @@ -47,12 +47,12 @@ | User Providers |-------------------------------------------------------------------------- | - | All authentication drivers have a user provider. This defines how the + | All authentication guards have a user provider, which defines how the | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. + | system used by the application. Typically, Eloquent is utilized. | | If you have multiple user tables or models you may configure multiple - | sources which represent each model / table. These sources may then + | providers to represent the model / table. These providers may then | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" @@ -62,7 +62,7 @@ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => App\Models\User::class, + 'model' => env('AUTH_MODEL', App\Models\User::class), ], // 'users' => [ @@ -76,9 +76,9 @@ | Resetting Passwords |-------------------------------------------------------------------------- | - | You may specify multiple password reset configurations if you have more - | than one user table or model in the application and you want to have - | separate password reset settings based on the specific user types. + | These configuration options specify the behavior of Laravel's password + | reset functionality, including the table utilized for token storage + | and the user provider that is invoked to actually retrieve users. | | The expiry time is the number of minutes that each reset token will be | considered valid. This security feature keeps tokens short-lived so @@ -93,7 +93,7 @@ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_reset_tokens', + 'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'), 'expire' => 60, 'throttle' => 60, ], @@ -105,11 +105,11 @@ |-------------------------------------------------------------------------- | | Here you may define the amount of seconds before a password confirmation - | times out and the user is prompted to re-enter their password via the + | window expires and users are asked to re-enter their password via the | confirmation screen. By default, the timeout lasts for three hours. | */ - 'password_timeout' => 10800, + 'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800), ]; diff --git a/config/broadcasting.php b/config/broadcasting.php deleted file mode 100755 index 24104853..00000000 --- a/config/broadcasting.php +++ /dev/null @@ -1,71 +0,0 @@ - env('BROADCAST_DRIVER', 'null'), - - /* - |-------------------------------------------------------------------------- - | Broadcast Connections - |-------------------------------------------------------------------------- - | - | Here you may define all of the broadcast connections that will be used - | to broadcast events to other systems or over websockets. Samples of - | each available type of connection are provided inside this array. - | - */ - - 'connections' => [ - - 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), - 'options' => [ - 'cluster' => env('PUSHER_APP_CLUSTER'), - 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', - 'port' => env('PUSHER_PORT', 443), - 'scheme' => env('PUSHER_SCHEME', 'https'), - 'encrypted' => true, - 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', - ], - 'client_options' => [ - // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html - ], - ], - - 'ably' => [ - 'driver' => 'ably', - 'key' => env('ABLY_KEY'), - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - ], - - 'log' => [ - 'driver' => 'log', - ], - - 'null' => [ - 'driver' => 'null', - ], - - ], - -]; diff --git a/config/cache.php b/config/cache.php index d4171e22..925f7d2e 100755 --- a/config/cache.php +++ b/config/cache.php @@ -9,13 +9,13 @@ | Default Cache Store |-------------------------------------------------------------------------- | - | This option controls the default cache connection that gets used while - | using this caching library. This connection is used when another is - | not explicitly specified when executing a given caching function. + | This option controls the default cache store that will be used by the + | framework. This connection is utilized if another isn't explicitly + | specified when running a cache operation inside the application. | */ - 'default' => env('CACHE_DRIVER', 'file'), + 'default' => env('CACHE_STORE', 'database'), /* |-------------------------------------------------------------------------- @@ -26,17 +26,13 @@ | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | - | Supported drivers: "apc", "array", "database", "file", - | "memcached", "redis", "dynamodb", "octane", "null" + | Supported drivers: "array", "database", "file", "memcached", + | "redis", "dynamodb", "octane", "null" | */ 'stores' => [ - 'apc' => [ - 'driver' => 'apc', - ], - 'array' => [ 'driver' => 'array', 'serialize' => false, @@ -44,9 +40,10 @@ 'database' => [ 'driver' => 'database', - 'table' => 'cache', - 'connection' => null, - 'lock_connection' => null, + 'connection' => env('DB_CACHE_CONNECTION'), + 'table' => env('DB_CACHE_TABLE', 'cache'), + 'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'), + 'lock_table' => env('DB_CACHE_LOCK_TABLE'), ], 'file' => [ @@ -76,8 +73,8 @@ 'redis' => [ 'driver' => 'redis', - 'connection' => 'cache', - 'lock_connection' => 'default', + 'connection' => env('REDIS_CACHE_CONNECTION', 'cache'), + 'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'), ], 'dynamodb' => [ @@ -100,8 +97,8 @@ | Cache Key Prefix |-------------------------------------------------------------------------- | - | When utilizing the APC, database, memcached, Redis, or DynamoDB cache - | stores there might be other applications using the same cache. For + | When utilizing the APC, database, memcached, Redis, and DynamoDB cache + | stores, there might be other applications using the same cache. For | that reason, you may prefix every cache key to avoid collisions. | */ diff --git a/config/compile.php b/config/compile.php deleted file mode 100755 index 04807eac..00000000 --- a/config/compile.php +++ /dev/null @@ -1,35 +0,0 @@ - [ - // - ], - - /* - |-------------------------------------------------------------------------- - | Compiled File Providers - |-------------------------------------------------------------------------- - | - | Here you may list service providers which define a "compiles" function - | that returns additional files that should be compiled, providing an - | easy way to get common files from any packages you are utilizing. - | - */ - - 'providers' => [ - // - ], - -]; diff --git a/config/cors.php b/config/cors.php deleted file mode 100644 index 558369dc..00000000 --- a/config/cors.php +++ /dev/null @@ -1,34 +0,0 @@ - ['api/*'], - - 'allowed_methods' => ['*'], - - 'allowed_origins' => ['*'], - - 'allowed_origins_patterns' => [], - - 'allowed_headers' => ['*'], - - 'exposed_headers' => [], - - 'max_age' => 0, - - 'supports_credentials' => false, - -]; diff --git a/config/database.php b/config/database.php index 3abd0703..f8e8dcb8 100755 --- a/config/database.php +++ b/config/database.php @@ -10,26 +10,22 @@ |-------------------------------------------------------------------------- | | Here you may specify which of the database connections below you wish - | to use as your default connection for all database work. Of course - | you may use many connections at once using the Database library. + | to use as your default connection for database operations. This is + | the connection which will be utilized unless another connection + | is explicitly specified when you execute a query / statement. | */ - 'default' => env('DB_CONNECTION', 'mysql'), + 'default' => env('DB_CONNECTION', 'sqlite'), /* |-------------------------------------------------------------------------- | Database Connections |-------------------------------------------------------------------------- | - | Here are each of the database connections setup for your application. - | Of course, examples of configuring each database platform that is - | supported by Laravel is shown below to make development simple. - | - | - | All database work in Laravel is done through the PHP PDO facilities - | so make sure you have the driver for your particular database of - | choice installed on your machine before you begin development. + | Below are all of the database connections defined for your application. + | An example configuration is provided for each database system which + | is supported by Laravel. You're free to add / remove connections. | */ @@ -37,7 +33,7 @@ 'sqlite' => [ 'driver' => 'sqlite', - 'url' => env('DATABASE_URL'), + 'url' => env('DB_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), @@ -45,15 +41,15 @@ 'mysql' => [ 'driver' => 'mysql', - 'url' => env('DATABASE_URL'), + 'url' => env('DB_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', + 'charset' => env('DB_CHARSET', 'utf8mb4'), + 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, @@ -61,41 +57,56 @@ 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], + ], - 'dump' => [ - 'excludeTables' => [ - 'telescope_entries', - 'telescope_entries_tags', - ], - ], + 'mariadb' => [ + 'driver' => 'mariadb', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => env('DB_CHARSET', 'utf8mb4'), + 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], ], 'pgsql' => [ 'driver' => 'pgsql', - 'url' => env('DATABASE_URL'), + 'url' => env('DB_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '5432'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', + 'charset' => env('DB_CHARSET', 'utf8'), 'prefix' => '', 'prefix_indexes' => true, - 'schema' => 'public', + 'search_path' => 'public', 'sslmode' => 'prefer', ], 'sqlsrv' => [ 'driver' => 'sqlsrv', - 'url' => env('DATABASE_URL'), + 'url' => env('DB_URL'), 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '1433'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', + 'charset' => env('DB_CHARSET', 'utf8'), 'prefix' => '', 'prefix_indexes' => true, + // 'encrypt' => env('DB_ENCRYPT', 'yes'), + // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), ], ], @@ -107,11 +118,14 @@ | | This table keeps track of all the migrations that have already run for | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run in the database. + | the migrations on disk haven't actually been run on the database. | */ - 'migrations' => 'migrations', + 'migrations' => [ + 'table' => 'migrations', + 'update_date_on_publish' => true, + ], /* |-------------------------------------------------------------------------- @@ -120,7 +134,7 @@ | | Redis is an open source, fast, and advanced key-value store that also | provides a richer body of commands than a typical key-value system - | such as APC or Memcached. Laravel makes it easy to dig right in. + | such as Memcached. You may define your connection settings here. | */ @@ -136,7 +150,8 @@ 'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), - 'password' => env('REDIS_PASSWORD', null), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), ], @@ -144,7 +159,8 @@ 'cache' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), - 'password' => env('REDIS_PASSWORD', null), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_CACHE_DB', '1'), ], diff --git a/config/filesystems.php b/config/filesystems.php index 9bfb57c4..c5f244d7 100755 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -9,35 +9,22 @@ | | Here you may specify the default filesystem disk that should be used | by the framework. The "local" disk, as well as a variety of cloud - | based disks are available to your application. Just store away! + | based disks are available to your application for file storage. | */ - 'default' => env('FILESYSTEM_DRIVER', 'local'), - - /* - |-------------------------------------------------------------------------- - | Default Cloud Filesystem Disk - |-------------------------------------------------------------------------- - | - | Many applications store files both locally and in the cloud. For this - | reason, you may specify a default "cloud" driver here. This driver - | will be bound as the Cloud disk implementation in the container. - | - */ - - 'cloud' => env('FILESYSTEM_CLOUD', 's3'), + 'default' => env('FILESYSTEM_DISK', 'local'), /* |-------------------------------------------------------------------------- | Filesystem Disks |-------------------------------------------------------------------------- | - | Here you may configure as many filesystem "disks" as you wish, and you - | may even configure multiple disks of the same driver. Defaults have - | been setup for each driver as an example of the required options. + | Below you may configure as many filesystem disks as necessary, and you + | may even configure multiple disks for the same driver. Examples for + | most supported storage drivers are configured here for reference. | - | Supported Drivers: "local", "ftp", "sftp", "s3" + | Supported drivers: "local", "ftp", "sftp", "s3" | */ @@ -46,6 +33,7 @@ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), + 'throw' => false, ], 'public' => [ @@ -53,6 +41,7 @@ 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', + 'throw' => false, ], 's3' => [ @@ -63,15 +52,8 @@ 'bucket' => env('AWS_BUCKET'), 'url' => env('AWS_URL'), 'endpoint' => env('AWS_ENDPOINT'), - ], - - 'google' => [ - 'driver' => 'google', - 'clientId' => env('GOOGLE_DRIVE_CLIENT_ID'), - 'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET'), - 'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN'), - 'folder' => env('GOOGLE_DRIVE_FOLDER'), // without folder is root of drive or team drive - //'teamDriveId' => env('GOOGLE_DRIVE_TEAM_DRIVE_ID'), + 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), + 'throw' => false, ], ], @@ -90,4 +72,5 @@ 'links' => [ public_path('storage') => storage_path('app/public'), ], + ]; diff --git a/config/logging.php b/config/logging.php index c44d2763..8d94292b 100644 --- a/config/logging.php +++ b/config/logging.php @@ -12,9 +12,9 @@ | Default Log Channel |-------------------------------------------------------------------------- | - | This option defines the default log channel that gets used when writing - | messages to the logs. The name specified in this option should match - | one of the channels defined in the "channels" configuration array. + | This option defines the default log channel that is utilized to write + | messages to your logs. The value provided here should match one of + | the channels present in the list of "channels" configured below. | */ @@ -33,7 +33,7 @@ 'deprecations' => [ 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), - 'trace' => false, + 'trace' => env('LOG_DEPRECATIONS_TRACE', false), ], /* @@ -41,20 +41,20 @@ | Log Channels |-------------------------------------------------------------------------- | - | Here you may configure the log channels for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. + | Here you may configure the log channels for your application. Laravel + | utilizes the Monolog PHP logging library, which includes a variety + | of powerful log handlers and formatters that you're free to use. | - | Available Drivers: "single", "daily", "slack", "syslog", - | "errorlog", "monolog", - | "custom", "stack" + | Available drivers: "single", "daily", "slack", "syslog", + | "errorlog", "monolog", "custom", "stack" | */ 'channels' => [ + 'stack' => [ 'driver' => 'stack', - 'channels' => ['single'], + 'channels' => explode(',', env('LOG_STACK', 'single')), 'ignore_exceptions' => false, ], @@ -69,15 +69,15 @@ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), - 'days' => 14, + 'days' => env('LOG_DAILY_DAYS', 14), 'replace_placeholders' => true, ], 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Laravel Log', - 'emoji' => ':boom:', + 'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'), + 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'), 'level' => env('LOG_LEVEL', 'critical'), 'replace_placeholders' => true, ], @@ -108,7 +108,7 @@ 'syslog' => [ 'driver' => 'syslog', 'level' => env('LOG_LEVEL', 'debug'), - 'facility' => LOG_USER, + 'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER), 'replace_placeholders' => true, ], @@ -126,6 +126,7 @@ 'emergency' => [ 'path' => storage_path('logs/laravel.log'), ], + ], ]; diff --git a/config/mail.php b/config/mail.php index e652bd02..df13d3df 100755 --- a/config/mail.php +++ b/config/mail.php @@ -7,13 +7,14 @@ | Default Mailer |-------------------------------------------------------------------------- | - | This option controls the default mailer that is used to send any email - | messages sent by your application. Alternative mailers may be setup - | and used as needed; however, this mailer will be used by default. + | This option controls the default mailer that is used to send all email + | messages unless another mailer is explicitly specified when sending + | the message. All additional mailers can be configured within the + | "mailers" array. Examples of each type of mailer are provided. | */ - 'default' => env('MAIL_MAILER', 'smtp'), + 'default' => env('MAIL_MAILER', 'log'), /* |-------------------------------------------------------------------------- @@ -24,46 +25,46 @@ | their respective settings. Several examples have been configured for | you and you are free to add your own as your application requires. | - | Laravel supports a variety of mail "transport" drivers to be used while - | sending an e-mail. You will specify which one you are using for your - | mailers below. You are free to add additional mailers as required. + | Laravel supports a variety of mail "transport" drivers that can be used + | when delivering an email. You may specify which one you're using for + | your mailers below. You may also add additional mailers if needed. | | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", - | "postmark", "log", "array", "failover" + | "postmark", "resend", "log", "array", + | "failover", "roundrobin" | */ 'mailers' => [ + 'smtp' => [ 'transport' => 'smtp', 'url' => env('MAIL_URL'), - 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), - 'port' => env('MAIL_PORT', 587), + 'host' => env('MAIL_HOST', '127.0.0.1'), + 'port' => env('MAIL_PORT', 2525), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'timeout' => null, - 'local_domain' => env('MAIL_EHLO_DOMAIN'), + 'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)), ], 'ses' => [ 'transport' => 'ses', ], - 'mailgun' => [ - 'transport' => 'mailgun', - // 'client' => [ - // 'timeout' => 5, - // ], - ], - 'postmark' => [ 'transport' => 'postmark', + // 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'), // 'client' => [ // 'timeout' => 5, // ], ], + 'resend' => [ + 'transport' => 'resend', + ], + 'sendmail' => [ 'transport' => 'sendmail', 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), @@ -85,6 +86,15 @@ 'log', ], ], + + 'roundrobin' => [ + 'transport' => 'roundrobin', + 'mailers' => [ + 'ses', + 'postmark', + ], + ], + ], /* @@ -92,9 +102,9 @@ | Global "From" Address |-------------------------------------------------------------------------- | - | You may wish for all e-mails sent by your application to be sent from - | the same address. Here, you may specify a name and address that is - | used globally for all e-mails that are sent by your application. + | You may wish for all emails sent by your application to be sent from + | the same address. Here you may specify a name and address that is + | used globally for all emails that are sent by your application. | */ @@ -103,23 +113,4 @@ 'name' => env('MAIL_FROM_NAME', 'Example'), ], - /* - |-------------------------------------------------------------------------- - | Markdown Mail Settings - |-------------------------------------------------------------------------- - | - | If you are using Markdown based email rendering, you may configure your - | theme and component paths here, allowing you to customize the design - | of the emails. Or, you may simply stick with the Laravel defaults! - | - */ - - 'markdown' => [ - 'theme' => 'default', - - 'paths' => [ - resource_path('views/vendor/mail'), - ], - ], - ]; diff --git a/config/queue.php b/config/queue.php index 01c6b054..116bd8d0 100755 --- a/config/queue.php +++ b/config/queue.php @@ -7,22 +7,22 @@ | Default Queue Connection Name |-------------------------------------------------------------------------- | - | Laravel's queue API supports an assortment of back-ends via a single - | API, giving you convenient access to each back-end using the same - | syntax for every one. Here you may define a default connection. + | Laravel's queue supports a variety of backends via a single, unified + | API, giving you convenient access to each backend using identical + | syntax for each. The default queue connection is defined below. | */ - 'default' => env('QUEUE_CONNECTION', 'sync'), + 'default' => env('QUEUE_CONNECTION', 'database'), /* |-------------------------------------------------------------------------- | Queue Connections |-------------------------------------------------------------------------- | - | Here you may configure the connection information for each server that - | is used by your application. A default configuration has been added - | for each back-end shipped with Laravel. You are free to add more. + | Here you may configure the connection options for every queue backend + | used by your application. An example configuration is provided for + | each backend supported by Laravel. You're also free to add more. | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" | @@ -36,17 +36,18 @@ 'database' => [ 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', - 'retry_after' => 90, + 'connection' => env('DB_QUEUE_CONNECTION'), + 'table' => env('DB_QUEUE_TABLE', 'jobs'), + 'queue' => env('DB_QUEUE', 'default'), + 'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90), 'after_commit' => false, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', - 'retry_after' => 90, + 'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'), + 'queue' => env('BEANSTALKD_QUEUE', 'default'), + 'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90), 'block_for' => 0, 'after_commit' => false, ], @@ -64,9 +65,9 @@ 'redis' => [ 'driver' => 'redis', - 'connection' => 'default', + 'connection' => env('REDIS_QUEUE_CONNECTION', 'default'), 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => 90, + 'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90), 'block_for' => null, 'after_commit' => false, ], @@ -85,7 +86,7 @@ */ 'batching' => [ - 'database' => env('DB_CONNECTION', 'mysql'), + 'database' => env('DB_CONNECTION', 'sqlite'), 'table' => 'job_batches', ], @@ -95,14 +96,16 @@ |-------------------------------------------------------------------------- | | These options configure the behavior of failed queue job logging so you - | can control which database and table are used to store the jobs that - | have failed. You may change them to any database / table you wish. + | can control how and where failed jobs are stored. Laravel ships with + | support for storing failed jobs in a simple file or in a database. + | + | Supported drivers: "database-uuids", "dynamodb", "file", "null" | */ 'failed' => [ 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), - 'database' => env('DB_CONNECTION', 'mysql'), + 'database' => env('DB_CONNECTION', 'sqlite'), 'table' => 'failed_jobs', ], diff --git a/config/services.php b/config/services.php index e40ef517..fedc38b7 100755 --- a/config/services.php +++ b/config/services.php @@ -14,12 +14,6 @@ | */ - 'mailgun' => [ - 'domain' => env('MAILGUN_DOMAIN'), - 'secret' => env('MAILGUN_SECRET'), - 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), - ], - 'postmark' => [ 'token' => env('POSTMARK_TOKEN'), ], @@ -30,6 +24,17 @@ 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], + 'resend' => [ + 'key' => env('RESEND_KEY'), + ], + + 'slack' => [ + 'notifications' => [ + 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), + 'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'), + ], + ], + 'google' => [ 'analytics_tracking_id' => env('GOOGLE_ANALYTICS_TRACKING_ID'), ], diff --git a/config/session.php b/config/session.php index da692f3b..f0b6541e 100755 --- a/config/session.php +++ b/config/session.php @@ -9,16 +9,16 @@ | Default Session Driver |-------------------------------------------------------------------------- | - | This option controls the default session "driver" that will be used on - | requests. By default, we will use the lightweight native driver but - | you may specify any of the other wonderful drivers provided here. + | This option determines the default session driver that is utilized for + | incoming requests. Laravel supports a variety of storage options to + | persist session data. Database storage is a great default choice. | | Supported: "file", "cookie", "database", "apc", | "memcached", "redis", "dynamodb", "array" | */ - 'driver' => env('SESSION_DRIVER', 'file'), + 'driver' => env('SESSION_DRIVER', 'database'), /* |-------------------------------------------------------------------------- @@ -27,13 +27,14 @@ | | Here you may specify the number of minutes that you wish the session | to be allowed to remain idle before it expires. If you want them - | to immediately expire on the browser closing, set that option. + | to expire immediately when the browser is closed then you may + | indicate that via the expire_on_close configuration option. | */ 'lifetime' => env('SESSION_LIFETIME', 120), - 'expire_on_close' => false, + 'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false), /* |-------------------------------------------------------------------------- @@ -41,21 +42,21 @@ |-------------------------------------------------------------------------- | | This option allows you to easily specify that all of your session data - | should be encrypted before it is stored. All encryption will be run - | automatically by Laravel and you can use the Session like normal. + | should be encrypted before it's stored. All encryption is performed + | automatically by Laravel and you may use the session like normal. | */ - 'encrypt' => false, + 'encrypt' => env('SESSION_ENCRYPT', false), /* |-------------------------------------------------------------------------- | Session File Location |-------------------------------------------------------------------------- | - | When using the native session driver, we need a location where session - | files may be stored. A default has been set for you but a different - | location may be specified. This is only needed for file sessions. + | When utilizing the "file" session driver, the session files are placed + | on disk. The default storage location is defined here; however, you + | are free to provide another location where they should be stored. | */ @@ -72,33 +73,35 @@ | */ - 'connection' => env('SESSION_CONNECTION', null), + 'connection' => env('SESSION_CONNECTION'), /* |-------------------------------------------------------------------------- | Session Database Table |-------------------------------------------------------------------------- | - | When using the "database" session driver, you may specify the table we - | should use to manage the sessions. Of course, a sensible default is - | provided for you; however, you are free to change this as needed. + | When using the "database" session driver, you may specify the table to + | be used to store sessions. Of course, a sensible default is defined + | for you; however, you're welcome to change this to another table. | */ - 'table' => 'sessions', + 'table' => env('SESSION_TABLE', 'sessions'), /* |-------------------------------------------------------------------------- | Session Cache Store |-------------------------------------------------------------------------- | - | When using the "apc", "memcached", or "dynamodb" session drivers you may - | list a cache store that should be used for these sessions. This value - | must match with one of the application's configured cache "stores". + | When using one of the framework's cache driven session backends, you may + | define the cache store which should be used to store the session data + | between requests. This must match one of your defined cache stores. + | + | Affects: "apc", "dynamodb", "memcached", "redis" | */ - 'store' => env('SESSION_STORE', null), + 'store' => env('SESSION_STORE'), /* |-------------------------------------------------------------------------- @@ -118,9 +121,9 @@ | Session Cookie Name |-------------------------------------------------------------------------- | - | Here you may change the name of the cookie used to identify a session - | instance by ID. The name specified here will get used every time a - | new session cookie is created by the framework for every driver. + | Here you may change the name of the session cookie that is created by + | the framework. Typically, you should not need to change this value + | since doing so does not grant a meaningful security improvement. | */ @@ -136,24 +139,24 @@ | | The session cookie path determines the path for which the cookie will | be regarded as available. Typically, this will be the root path of - | your application but you are free to change this when necessary. + | your application, but you're free to change this when necessary. | */ - 'path' => '/', + 'path' => env('SESSION_PATH', '/'), /* |-------------------------------------------------------------------------- | Session Cookie Domain |-------------------------------------------------------------------------- | - | Here you may change the domain of the cookie used to identify a session - | in your application. This will determine which domains the cookie is - | available to in your application. A sensible default has been set. + | This value determines the domain and subdomains the session cookie is + | available to. By default, the cookie will be available to the root + | domain and all subdomains. Typically, this shouldn't be changed. | */ - 'domain' => env('SESSION_DOMAIN', null), + 'domain' => env('SESSION_DOMAIN'), /* |-------------------------------------------------------------------------- @@ -162,7 +165,7 @@ | | By setting this option to true, session cookies will only be sent back | to the server if the browser has a HTTPS connection. This will keep - | the cookie from being sent to you if it can not be done securely. + | the cookie from being sent to you when it can't be done securely. | */ @@ -175,11 +178,11 @@ | | Setting this value to true will prevent JavaScript from accessing the | value of the cookie and the cookie will only be accessible through - | the HTTP protocol. You are free to modify this option if needed. + | the HTTP protocol. It's unlikely you should disable this option. | */ - 'http_only' => true, + 'http_only' => env('SESSION_HTTP_ONLY', true), /* |-------------------------------------------------------------------------- @@ -188,12 +191,27 @@ | | This option determines how your cookies behave when cross-site requests | take place, and can be used to mitigate CSRF attacks. By default, we - | will set this value to "lax" since this is a secure default value. + | will set this value to "lax" to permit secure cross-site requests. + | + | See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value | | Supported: "lax", "strict", "none", null | */ - 'same_site' => 'lax', + 'same_site' => env('SESSION_SAME_SITE', 'lax'), + + /* + |-------------------------------------------------------------------------- + | Partitioned Cookies + |-------------------------------------------------------------------------- + | + | Setting this value to true will tie the cookie to the top-level site for + | a cross-site context. Partitioned cookies are accepted by the browser + | when flagged "secure" and the Same-Site attribute is set to "none". + | + */ + + 'partitioned' => env('SESSION_PARTITIONED_COOKIE', false), ]; diff --git a/config/view.php b/config/view.php deleted file mode 100755 index eaf531f6..00000000 --- a/config/view.php +++ /dev/null @@ -1,32 +0,0 @@ - [ - realpath(base_path('resources/views')), - ], - - /* - |-------------------------------------------------------------------------- - | Compiled View Path - |-------------------------------------------------------------------------- - | - | This option determines where all the compiled Blade templates will be - | stored for your application. Typically, this is within the storage - | directory. However, as usual, you are free to change this value. - | - */ - - 'compiled' => realpath(storage_path('framework/views')), -]; diff --git a/database/factories/AddressFactory.php b/database/factories/AddressFactory.php deleted file mode 100644 index b7aade2e..00000000 --- a/database/factories/AddressFactory.php +++ /dev/null @@ -1,36 +0,0 @@ - $this->faker->ipv4, - 'country_code' => $this->faker->countryCode, - 'country_name' => $this->faker->country, - 'region_name' => $this->faker->city, - 'city' => $this->faker->city, - 'timezone' => $this->faker->timezone, - 'zip_code' => $this->faker->postcode, - 'latitude' => $this->faker->latitude, - 'longitude' => $this->faker->longitude, - ]; - } -} diff --git a/database/factories/CategoryFactory.php b/database/factories/CategoryFactory.php index 89840f55..eceefc7b 100644 --- a/database/factories/CategoryFactory.php +++ b/database/factories/CategoryFactory.php @@ -16,10 +16,8 @@ class CategoryFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return ['name' => $name = $this->faker->word, 'alias' => $name]; } diff --git a/database/factories/CommentFactory.php b/database/factories/CommentFactory.php index 8f4977a7..0186a46f 100644 --- a/database/factories/CommentFactory.php +++ b/database/factories/CommentFactory.php @@ -16,10 +16,8 @@ class CommentFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'content' => $this->faker->paragraph, @@ -32,7 +30,7 @@ public function definition() ]; } - public function published() + public function published(): CommentFactory { return $this->state([ 'is_published' => 1, @@ -40,7 +38,7 @@ public function published() ]); } - public function unpublished() + public function unpublished(): CommentFactory { return $this->state([ 'is_published' => 0, diff --git a/database/factories/KeywordFactory.php b/database/factories/KeywordFactory.php index ad591d55..926681a1 100644 --- a/database/factories/KeywordFactory.php +++ b/database/factories/KeywordFactory.php @@ -16,10 +16,8 @@ class KeywordFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return ['name' => $this->faker->word]; } diff --git a/database/factories/SubscriberFactory.php b/database/factories/SubscriberFactory.php index 93309dd3..74ec9fd5 100644 --- a/database/factories/SubscriberFactory.php +++ b/database/factories/SubscriberFactory.php @@ -17,10 +17,8 @@ class SubscriberFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'email' => $this->faker->email, diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index e39723c7..1b0f6881 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -8,10 +8,8 @@ class CreateFailedJobsTable extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('failed_jobs', function (Blueprint $table) { $table->bigIncrements('id'); @@ -26,10 +24,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('failed_jobs'); } diff --git a/database/migrations/2020_04_09_091100_create_cache_table.php b/database/migrations/2020_04_09_091100_create_cache_table.php new file mode 100644 index 00000000..b9c106be --- /dev/null +++ b/database/migrations/2020_04_09_091100_create_cache_table.php @@ -0,0 +1,35 @@ +string('key')->primary(); + $table->mediumText('value'); + $table->integer('expiration'); + }); + + Schema::create('cache_locks', function (Blueprint $table) { + $table->string('key')->primary(); + $table->string('owner'); + $table->integer('expiration'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('cache'); + Schema::dropIfExists('cache_locks'); + } +}; diff --git a/database/migrations/2020_04_10_185833_create_permission_tables.php b/database/migrations/2020_04_10_185833_create_permission_tables.php index 6ac61f89..da80dd6e 100644 --- a/database/migrations/2020_04_10_185833_create_permission_tables.php +++ b/database/migrations/2020_04_10_185833_create_permission_tables.php @@ -9,11 +9,10 @@ class CreatePermissionTables extends Migration /** * Run the migrations. * - * @return void * * @throws Exception */ - public function up() + public function up(): void { $tableNames = config('permission.table_names'); $columnNames = config('permission.column_names'); @@ -103,11 +102,10 @@ function (Blueprint $table) use ($tableNames, $columnNames) { /** * Reverse the migrations. * - * @return void * * @throws Exception */ - public function down() + public function down(): void { $tableNames = config('permission.table_names'); diff --git a/database/migrations/2024_06_23_091013_create_password_reset_tokens_table.php b/database/migrations/2024_06_23_091013_create_password_reset_tokens_table.php new file mode 100644 index 00000000..81a7229b --- /dev/null +++ b/database/migrations/2024_06_23_091013_create_password_reset_tokens_table.php @@ -0,0 +1,28 @@ +string('email')->primary(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('password_reset_tokens'); + } +}; diff --git a/database/migrations/2024_06_23_091256_create_job_batches_table.php b/database/migrations/2024_06_23_091256_create_job_batches_table.php new file mode 100644 index 00000000..50e38c20 --- /dev/null +++ b/database/migrations/2024_06_23_091256_create_job_batches_table.php @@ -0,0 +1,35 @@ +string('id')->primary(); + $table->string('name'); + $table->integer('total_jobs'); + $table->integer('pending_jobs'); + $table->integer('failed_jobs'); + $table->longText('failed_job_ids'); + $table->mediumText('options')->nullable(); + $table->integer('cancelled_at')->nullable(); + $table->integer('created_at'); + $table->integer('finished_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('job_batches'); + } +}; diff --git a/database/seeds/.gitkeep b/database/seeders/.gitkeep similarity index 100% rename from database/seeds/.gitkeep rename to database/seeders/.gitkeep diff --git a/database/seeds/ArticlesTableSeeder.php b/database/seeders/ArticlesTableSeeder.php similarity index 63% rename from database/seeds/ArticlesTableSeeder.php rename to database/seeders/ArticlesTableSeeder.php index b97c3856..c264859c 100644 --- a/database/seeds/ArticlesTableSeeder.php +++ b/database/seeders/ArticlesTableSeeder.php @@ -1,6 +1,11 @@ environment() != 'production') { - $faker = \Faker\Factory::create(); + $faker = Factory::create(); foreach (range(0, 10) as $i) { Article::factory()->create([ - 'category_id' => $faker->randomElement(\App\Models\Category::all()->pluck('id')->toArray()), - 'user_id' => $faker->randomElement(\App\Models\User::all()->pluck('id')->toArray()), + 'category_id' => $faker->randomElement(Category::all()->pluck('id')->toArray()), + 'user_id' => $faker->randomElement(User::all()->pluck('id')->toArray()), ]); } $articles = Article::all(); diff --git a/database/seeds/CategoriesTableSeeder.php b/database/seeders/CategoriesTableSeeder.php similarity index 91% rename from database/seeds/CategoriesTableSeeder.php rename to database/seeders/CategoriesTableSeeder.php index c0e04360..4857e30a 100644 --- a/database/seeds/CategoriesTableSeeder.php +++ b/database/seeders/CategoriesTableSeeder.php @@ -1,15 +1,17 @@ 'Object Oriented Programming', @@ -60,6 +62,6 @@ public function run() 'updated_at' => new DateTime(), ]; - \App\Models\Category::insert($categories); + Category::query()->insert($categories); } } diff --git a/database/seeds/CommentsTableSeeder.php b/database/seeders/CommentsTableSeeder.php similarity index 77% rename from database/seeds/CommentsTableSeeder.php rename to database/seeders/CommentsTableSeeder.php index fff20efa..644508a2 100644 --- a/database/seeds/CommentsTableSeeder.php +++ b/database/seeders/CommentsTableSeeder.php @@ -1,7 +1,11 @@ environment() != 'production') { foreach (Article::all() as $article) { Comment::factory()->count(3)->create([ 'article_id' => $article->id, - 'user_id' => $faker->randomElement(\App\Models\User::all()->pluck('id')->toArray()), + 'user_id' => $faker->randomElement(User::all()->pluck('id')->toArray()), ]); $article->update(['comment_count' => 3]); } diff --git a/database/seeds/ConfigsTableSeeder.php b/database/seeders/ConfigsTableSeeder.php similarity index 79% rename from database/seeds/ConfigsTableSeeder.php rename to database/seeders/ConfigsTableSeeder.php index 03a8942b..1f255056 100644 --- a/database/seeds/ConfigsTableSeeder.php +++ b/database/seeders/ConfigsTableSeeder.php @@ -1,17 +1,18 @@ insert([ ['name' => 'site_name', 'value' => 'Al- Imran Ahmed (-'], ['name' => 'site_title', 'value' => 'Al- Imran Ahmed (-'], ['name' => 'copyright_owner', 'value' => 'Al- Imran Ahmed (-'], diff --git a/database/seeds/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php similarity index 87% rename from database/seeds/DatabaseSeeder.php rename to database/seeders/DatabaseSeeder.php index 188cc2fe..6bf73dbb 100755 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -1,15 +1,15 @@ call(RolesAndPermissionsTableSeeder::class); $this->call(UsersTableSeeder::class); @@ -19,7 +19,7 @@ public function run() $this->call(ArticlesTableSeeder::class); $this->call(CommentsTableSeeder::class); $this->call(ConfigsTableSeeder::class); - if (env('APP_ENV') == 'local') { + if (app()->environment('local')) { $this->command->info('All table seeded successfully!'); $this->command->info('username: owner@gmail.com | password: owner'); } diff --git a/database/seeds/KeywordsTableSeeder.php b/database/seeders/KeywordsTableSeeder.php similarity index 59% rename from database/seeds/KeywordsTableSeeder.php rename to database/seeders/KeywordsTableSeeder.php index 85b837be..33edb4f1 100644 --- a/database/seeds/KeywordsTableSeeder.php +++ b/database/seeders/KeywordsTableSeeder.php @@ -1,18 +1,19 @@ count(5)->create(); + Keyword::factory()->count(5)->create(); } } } diff --git a/database/seeds/ReadersTableSeeder.php b/database/seeders/ReadersTableSeeder.php similarity index 81% rename from database/seeds/ReadersTableSeeder.php rename to database/seeders/ReadersTableSeeder.php index 437b2119..a615676c 100644 --- a/database/seeds/ReadersTableSeeder.php +++ b/database/seeders/ReadersTableSeeder.php @@ -1,5 +1,7 @@ create( [ 'is_verified' => 1, 'notify' => 1, ] ); - Reader::create( + Reader::query()->create( [ 'is_verified' => 0, 'notify' => 0, diff --git a/database/seeds/RolesAndPermissionsTableSeeder.php b/database/seeders/RolesAndPermissionsTableSeeder.php similarity index 80% rename from database/seeds/RolesAndPermissionsTableSeeder.php rename to database/seeders/RolesAndPermissionsTableSeeder.php index fbf529dc..355c54a1 100644 --- a/database/seeds/RolesAndPermissionsTableSeeder.php +++ b/database/seeders/RolesAndPermissionsTableSeeder.php @@ -1,5 +1,7 @@ saveRole(); $this->savePermissions(); @@ -15,9 +17,9 @@ public function run() app(PermissionRegistrar::class)->forgetCachedPermissions(); } - public function saveRole() + public function saveRole(): bool { - Role::whereNotIn('name', config('acl.roles'))->delete(); + Role::query()->whereNotIn('name', config('acl.roles'))->delete(); $roles = []; $sl = 0; @@ -34,10 +36,10 @@ public function saveRole() $sl++; } - return \Spatie\Permission\Models\Role::insert($roles); + return Role::query()->insert($roles); } - public function savePermissions() + public function savePermissions(): bool { Permission::whereNotIn('name', array_keys(config('acl.permissions')))->delete(); @@ -56,13 +58,13 @@ public function savePermissions() $sl++; } - return \Spatie\Permission\Models\Permission::insert($permissions); + return Permission::query()->insert($permissions); } - public function generateRoleBasedPermissions() + public function generateRoleBasedPermissions(): void { foreach (config('acl.roles') as $role) { - $getRole = \Spatie\Permission\Models\Role::where('name', $role)->first(); + $getRole = Role::where('name', $role)->first(); $sl = 0; $formatRoles = []; foreach (config('acl.permissions') as $permission => $roles) { diff --git a/database/seeds/UsersTableSeeder.php b/database/seeders/UsersTableSeeder.php similarity index 87% rename from database/seeds/UsersTableSeeder.php rename to database/seeders/UsersTableSeeder.php index 46bf6d97..80de5189 100644 --- a/database/seeds/UsersTableSeeder.php +++ b/database/seeders/UsersTableSeeder.php @@ -1,24 +1,25 @@ 'Al- Imran Ahmed', 'username' => 'owner', - 'password' => \Hash::make('owner'), + 'password' => Hash::make('owner'), 'email' => 'owner@gmail.com', 'last_ip' => '127.0.0.1', ] @@ -28,7 +29,7 @@ public function run() [ 'name' => 'Admin', 'username' => 'admin', - 'password' => \Hash::make('admin'), + 'password' => Hash::make('admin'), 'email' => 'admin@gmail.com', 'last_ip' => '127.0.0.1', ] @@ -38,7 +39,7 @@ public function run() [ 'name' => 'Author', 'username' => 'author', - 'password' => \Hash::make('author'), + 'password' => Hash::make('author'), 'email' => 'author@gmail.com', 'last_ip' => '127.0.0.1', ] @@ -47,7 +48,7 @@ public function run() [ 'name' => 'Reader', 'username' => 'reader', - 'password' => \Hash::make('reader'), + 'password' => Hash::make('reader'), 'email' => 'reader@gmail.com', 'last_ip' => '127.0.0.1', ] diff --git a/package.json b/package.json index 463bc88a..070d7027 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "devDependencies": { "@tailwindcss/forms": "^0.5.2", "autoprefixer": "^10.4.13", - "laravel-vite-plugin": "^0.7.5", + "laravel-vite-plugin": "^1.0", "tailwindcss": "^3.2.4", - "vite": "^4.5.3" + "vite": "^5.0" }, "dependencies": { "shiki": "^0.14.3" diff --git a/phpunit.xml b/phpunit.xml index e9f533da..ad168f2a 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -19,8 +19,9 @@ + - + diff --git a/public/index.php b/public/index.php index a8137b13..947d9896 100755 --- a/public/index.php +++ b/public/index.php @@ -1,55 +1,17 @@ make(Kernel::class); - -$response = tap($kernel->handle( - $request = Request::capture() -))->send(); - -$kernel->terminate($request, $response); +// Bootstrap Laravel and handle the request... +(require_once __DIR__.'/../bootstrap/app.php') + ->handleRequest(Request::capture()); diff --git a/resources/views/emails/backup_database.blade.php b/resources/views/emails/backup_database.blade.php deleted file mode 100644 index 30054fe6..00000000 --- a/resources/views/emails/backup_database.blade.php +++ /dev/null @@ -1,4 +0,0 @@ -@extends('emails.master') -@section('content') -

Please see the attachment for database backup of your blog

-@endsection \ No newline at end of file diff --git a/routes/api.php b/routes/api.php deleted file mode 100755 index f35f6f84..00000000 --- a/routes/api.php +++ /dev/null @@ -1,8 +0,0 @@ -user(); -})->middleware('auth:api'); diff --git a/routes/channel.php b/routes/channel.php deleted file mode 100644 index 5d451e1f..00000000 --- a/routes/channel.php +++ /dev/null @@ -1,18 +0,0 @@ -id === (int) $id; -}); diff --git a/routes/console.php b/routes/console.php index e05f4c9a..73676285 100755 --- a/routes/console.php +++ b/routes/console.php @@ -1,19 +1,8 @@ comment(Inspiring::quote()); -})->purpose('Display an inspiring quote'); +Schedule::command('backup:run --only-db')->monthly(); +Schedule::command(GenerateSitemap::class)->weekly(); +Schedule::command('telescope:prune')->daily(); diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php deleted file mode 100644 index 6c64fded..00000000 --- a/tests/CreatesApplication.php +++ /dev/null @@ -1,20 +0,0 @@ -make(Kernel::class)->bootstrap(); - - return $app; - } -} diff --git a/tests/TestCase.php b/tests/TestCase.php index c58ad548..efd7e8b7 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -7,6 +7,5 @@ abstract class TestCase extends BaseTestCase { - use CreatesApplication; use DatabaseTransactions; }