php - Object not found! The requested URL was not found on this server. localhost Laravel Xampp Issue

Strange Error, most likely the solution is easy and axiomatic, I just couldn't come up with it, I had created a project in Laravel about 2 years ago and now I want to launch it back, so I installed Laravel, xampp, composer and all that it requires to start successfully, I also created the database according to the code as well. The project starts fine at first, the welcome page view works fine, but when i try to register to the system it doesn't work and it represents that error, it lets me fill the form but when i press on register it stops and returns me the following error:
Object not found!
The requested URL was not found on this server. The link on the referring
page seems to be wrong or outdated.
Please inform the author of that page about the error. If you think
this is a server error, please contact the webmaster. Error 404
localhost
Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.3.20
my RegisterController.php code:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
use App\Ens;
use App\Role;
class RegisterController extends Controller
{
public function create() {
return view('/register');
}
public function store(Request $request) {
$user = new User;
$user->name = $request->name;
$user->email = $request->email;
$user->password = bcrypt($request->password);
if($request->hasFile('photo')){
$user->photo= $request->photo->store('avatar');
}
if($request->hasFile('image')){
$user->image= $request->image->store('avatar');
}
$user->save();
$user->roles()->attach(Role::where('name', 'ElГЁve')->first());
auth()->login($user);
return redirect('/');
}
route web.php part of code:
Route::get('/register', 'RegisterController@create');
Route::post('/register', 'RegisterController@store');
So i'm guessing the problem could be the url inside the code or maybe in the browser itself, the path is different from when I first time created the website, I used to access the website using: 127.0.0.1:8000 in my browser.. now that url doesn't work at all, it takes long loading and returns finally nothing so i'm accessing now using this following url: localhost/myproject/public and it works just fine
So is there anything I have to change in the code because of this recent URL (like add 'public' in the path)?? I will be grateful for any kind of help. Thank you!
Answer
Solution:
I think your problem is on return view. Remove forward slash in view function.
Return view('register')
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: to enable extensions, verify that they are enabled in your .ini files
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.