Skip to content

Commit

Permalink
Merge pull request #11 from mohamadreza1388/main
Browse files Browse the repository at this point in the history
editor
  • Loading branch information
BaseMax authored Sep 16, 2024
2 parents 59b7c1c + d992da6 commit 131d8e2
Show file tree
Hide file tree
Showing 18 changed files with 572 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ public function store(Request $request): RedirectResponse
'title' => 'forgot_password',
]);

$client = Client::account('default');
$client->connect();

$inbox = $client->getFolder('INBOX');
$messages = $inbox->messages()->all()->get();

if ($messages->count() > 0) {
$message = $messages->last();
if ($message = 'Mail delivery failed: returning message to sender') {
return back()->with('status', 'verification-link-fail');
}
} else {
return back()->with('status', 'verification-link-fail');
}
// $client = Client::account('default');
// $client->connect();
//
// $inbox = $client->getFolder('INBOX');
// $messages = $inbox->messages()->all()->get();
//
// if ($messages->count() > 0) {
// $message = $messages->last();
// if ($message = 'Mail delivery failed: returning message to sender') {
// return back()->with('status', 'verification-link-fail');
// }
// } else {
// return back()->with('status', 'verification-link-fail');
// }

return back()->with('status', 'verification-link-sent');
}
Expand Down
30 changes: 27 additions & 3 deletions app/Http/Controllers/EditorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,36 @@

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests\EditorRequest;
use App\Models\Code;
use Symfony\Component\Uid\Uuid;

class EditorController extends Controller
{
public function index()
public function index($uuid = null)
{
return view("editor");
if ($uuid !== null) {
$code = Code::where('uuid', $uuid)->firstOrFail();

return view('editor', [
'value' => $code['code'],
]);
} else {
return view('editor');
}
}

public function save(EditorRequest $editorRequest)
{
Code::create([
'uuid' => Uuid::v4(),
'title' => $editorRequest->title,
'code' => $editorRequest->all()['code'],
'user_id' => auth()->user()->id,
]);

alert()->success('ذخیره شد', 'کد شما با موفقیت ذخیره شد.');

return back();
}
}
29 changes: 29 additions & 0 deletions app/Http/Requests/EditorRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class EditorRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'title' => 'required|string|min:3|max:255',
'code' => 'required|string',
];
}
}
2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function register(): void
*/
public function boot(): void
{
if (env("APP_URL") !== "http://127.0.0.1:8000") {
if (env('APP_URL') !== 'http://127.0.0.1:8000') {
$this->app['request']->server->set('HTTPS', 'on');
}
}
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.9",
"morilog/jalali": "^3.4",
"realrashid/sweet-alert": "^7.2",
"webklex/laravel-imap": "^5.3",
"yajra/laravel-datatables": "^11.0",
"yajra/laravel-datatables-oracle": "11.0"
Expand Down
92 changes: 91 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 131d8e2

Please sign in to comment.