Route::post('/contacts', [ContactsController::class, 'receive'])
->middleware([\Spatie\Honeypot\ProtectAgainstSpam::class])
->name('site.form.feedback');
<form class="form" method="post" action="{{ route('site.form.feedback') }}">
@csrf
@honeypot
<VirtualHost *:8080>
DocumentRoot "d:/dev/projects/wofh-tools/wofh-tools.project/public"
ServerName "wofh-tools.project"
ServerAlias "wofh-tools.project"
SetEnvIfNoCase X-Forwarded-Proto https HTTPS=on
</VirtualHost>
server {
listen 127.0.0.1:80;
listen 127.0.0.1:443 ssl;
server_name wofh-tools.project ;
ssl_certificate "d:/openserver/userdata/config/cert_files/server.crt";
ssl_certificate_key "d:/openserver/userdata/config/cert_files/server.key";
location ~ /\. {deny all;}
location / {
proxy_buffer_size 64k;
proxy_buffering on;
proxy_buffers 4 64k;
proxy_connect_timeout 5s;
proxy_ignore_client_abort off;
proxy_intercept_errors off;
proxy_pass http://127.0.0.1:3333;
proxy_pass_header Server;
proxy_read_timeout 5m;
proxy_redirect off;
proxy_send_timeout 5m;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /api {
proxy_pass http://wofh-tools.project:8080/api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /admin {
proxy_pass http://wofh-tools.project:8080/admin;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /tracy {
proxy_pass http://wofh-tools.project:8080/tracy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /vendor {
proxy_pass http://wofh-tools.project:8080/vendor;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /storage {
proxy_pass http://wofh-tools.project:8080/storage;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
artisan make:model Article -m
Model created successfully.
Created Migration: 2021_05_28_111836_create_articles_table
class CreateArticlesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('articles', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('articles');
}
}
public function store(Request $request) {
$validator = Validator::make($request->all(), [
'title' => 'required|string',
'source' => 'required|string',
'category_id' => 'required|integer|exists:categories,id',
]);
try {
$input = $validator->validate();
} catch (ValidationException $e) {
return redirect()->back()->withErrors($validator)->withInput();
}
$input['id'] = Auth::user()->id;
$input['private'] = $request->has('private') ? 0 : 1;
Pass::create($input);
return redirect()->route('home');
}
Estimated Upgrade Time: 15 Minutes
public function setTopic(Request $request) {
$selectSetTopic = $request->input('selectSetTopic');
dd($selectSetTopic);
return redirect()->route('post')->with('success', 'Ok!');
}
$userId = Auth::user()->id; // Переменную плохо назвали. Это ID, а не пользователь
$editor = Pass::where('user_id', $userId)->first(); // А здесь редактор, не ID. Может быть NULL если не найдено.
// Нужно проверить, нашлась ли запись и совпали ли ID
//if ($editor && $userId == $editor->user_id) { }
// Но исходя из условия запроса, если запись нашлась, то ID уже совпали
// Значит достаточно такой проверки:
if ($editor) { }