Jump to content

FlyAbove

New Members
  • Posts

    5
  • Joined

  • Last visited

FlyAbove's Achievements

Newbie

Newbie (1/5)

0

Reputation

1

Community Answers

  1. I am trying to find a way to delete my category that I have created. I get the error attempt to read image is null, I think the error has to do with category_id being null. How can I retrieve it for my category object? class Index extends Component { use WithPagination; protected $paginationTheme = 'bootstrap'; public $category_id; //setting category_id public function deleteCategory($category_id) { $this->category_id = $category_id; } public function destroyCategory() { $category = Category::find($this->category_id); // dd($this); $path = 'uploads/category/'.$category->image; if (File::exists($path)) { File::delete($path); } $category->delete(); session()->flash('message', 'Category Deleted'); $this->dispatchBrowserEvent('close-modal'); } public function render() { $categories = Category::orderBy('id', 'DESC')->paginate(10); return view('livewire.admin.category.index', ['categories' => $categories]); } }
  2. I am thinking of downloading the latest version of xampp but if I did would it show xdebug in phpinfo?
  3. I am using a mac and when I type php -v I get the version php 8.1.12 but when I load the phpinfo page from xampp it shows 8.1.5 and I am wondering how I can get the phpinfo page to show the same thing as php -v (it also give me the xdebug extension which does not show up in phpinfo)? I have 2 different php ini files. One for xampp and the other for php8.1.
  4. I was able to solve the issue with this. if (!preg_match('/[A-Z]/', $pw)) { array_push($this->errorArray, Constants::$passwordContainCapital); return; }
  5. I am trying to make the password contain one uppercase letter when registering but I am not sure how to do that in PHP. Am I writing the right regex for it? //password must contain a capital letter if (preg_match('/((?=.*[A-Z]))/', $pw)) { array_push($this->errorArray, Constants::$passwordContainCapital); return; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.