public function rules()
{
return [
'name' => 'required|string|min:2|max:30',
'email' => ['required', 'email', Rule::unique('users', 'email')->ignore($this->id)],
'password' => 'min:8',
'role' => 'required'
];
}
}
public function rules()
{
return [
'title' => ['required', Rule::unique('vh_nodes', 'title')->ignore($this->id)],
'url' => 'required',
'login' => 'required',
'password' => 'required',
];
}
{{ old('name') }}
возвращает валидатор. Request точно, другие не использовал. $this->user = Auth::User();
это текущий авторизованный пользователь.public function invoiceView($id, $invoiceId)
{
$pdf = PDF::loadView('pdf.invoice', ['data' => User::where('id', $id], ['invoice' => Invoice::where('id', $invoiceId)->first()]);
return $pdf->stream('invoice.pdf');
}
public function index()
{
$categories = Category::withCount('posts')->orderByDesc('posts_count')->get();
return view('blog.category-index', ['categories' => $categories]);
}
@if($category->posts_count === 0)
<a href="#" class="uk-icon-link" uk-icon="trash" onclick="deleteCategory({{ $category->id }}, '{{ $category->title }}');"></a>
<form action="{{ route('category.destroy', $category->id) }}" method="post" id="destroy-{{ $category->id }}">
@csrf
</form>
@endif