404 not found Laravel with route argument
With route model binding there is no need to add $scopedArticle = Article::where('id', $article)->firstOrFail();
Example usage:
goto http://yourstie.com/article/1
class ArticleController extends Controller
{
public function index(Article $article)
{
return view('article', compact('article'));
}
}
404 not found when passing variable to route in laravel
You are using ajax post so instead redirect use json response like this
public function rate(Request $request, $book_id)
{
$book = Book::find($book_id);
$rating = $book->ratings()->where('user_id', auth()->user()->id)->first();
if(is_null($rating)){
$ratings = new Rating();
$ratings->rating = $request['rating'];
$ratings->user_id = auth()->user()->id;
$book->ratings()->save($ratings);
return json_encode($book);
}
else{
return response()->json(['status' => "You already left a review"]);
}
}
Add try this javascript code
$.ajax({
type:"POST",
url:"http://127.0.0.1:8000/rate/" + route.id,
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data:{rating: $('#val').val()},
success:function(res){
console.log("owls");
}
});
Laravel route with parameter causes 404
You missed project_id as parameter of your create method. Try this:
public function create($project_id)
{
return view('issue.create');
}
and make a route like this:
Route::get('/project/issue/create/{project_id}','IssueController@create');
Laravel returns 404 error when passing a parameter
I think you misunderstood routing, views etc.
For your controller to be hit, you will need to make the following route.
Route::get('cartas/{card}/vcards', 'cardControllerr@vcards')->name('cartas.vcards');
If you wanna link to this route use route()
.
route('cartas.vcards', ['card' => $card]);
404 error in Laravel routing with changing parameter order
Since you are using two routes that take generic parameters, Laravel could have problem to match a URL to a route. For example: /product/1/properties
, could perfectly fit this {prod?}/{prod_size?}
.
To fix this, I suggest that you add some prefix to the route, to identify them:
Route::get('routename1/{product}/properties', 'ProController@getpro');
Route::get('routename2/{prod?}/{prod_size?}', 'ProController@name');
Then routename1/1/properties
would never fit routename2/{prod?}/{prod_size?}
.
Then Laravel would be able to match perfectly the URL parameters to the route.
laravel- 404 not found but route exist
add /
before your url like this
<form action="/dashboard/panel/update-order-information/{{$customerOrder->id}}" method="POST" >
Edit:
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$panel = Order::findOrFail($id)
$panel->column_in_your_database = $request->input('delivery_date');
$panel->save();
}
Related Topics
How to Insert Special Character in MySQL Via PHP and Display on HTML Page
PHP Parse/Syntax Errors; and How to Solve Them
How to Fix "Headers Already Sent" Error in PHP
How to Deal With MySQLi Problems - MySQLi_Fetch_Array(): Argument #1 Must Be of Type MySQLi_Result
MySQLi or Pdo - What Are the Pros and Cons
How to Check If a String Contains a Specific Word
How to Apply Bindvalue Method in Limit Clause
Should We Ever Check For MySQLi_Connect() Errors Manually
How to Configure Xampp to Send Mail from Localhost
How to Calculate the Difference Between Two Dates Using PHP
How to Sort a Multi-Dimensional Array by Value
How to Sanitize User Input With PHP
How to Pass JavaScript Variables to PHP
How Should a Model Be Structured in MVC
How to Flatten a Multidimensional Array