Empty array from controller to view - Laravel - php

I'm new at Laravel, and I'm having some problems setting up an update for my application. I'm trying to pass an id from a view to a controller through routing to select an specific line, and after that I need to pass from the controller to another view. Idk where I'm doing wrong.
Here's my view code that passes de id:
#forEach($line as $data)
<tr>
<td><i class="icon ion-md-create"></i></td>
<td>{{$data->name}}</td>
<td>{{$data->time}}</td>
</tr>
#endforEach
Here's the route:
Route::get('/lineEdit/{id}', 'LineController#formEdit')->name('edit.line')->middleware('auth');
Here's the controller function from route:
public function formEdit($id){
$line = Line::find($id);
$lineUp = Line::select('*')
->where('id', $line)->get();
return view('lineEdit')->with('line', $lineUp);
}
And here's the piece of the view that will recieve the array:
<div class="card-body">
#forEach($line as $data)
<form method="POST" action="{{route('update.line', $data->id)}}">
#csrf
<div class="form-group row">
<label for="name" class="col-md-4 col-form-label text-md-right">
{{__('Name')}}
</label>
<div class="col-md-8">
<input type="text" name="name" class="form-control {{$errors->has('name') ? 'is-invalid' : ''}}" value={{$data->name}} required autofocus >
#if($errors->has('name'))
<span class="invalid-feedback" role="alert">
<strong>{{$errors->first('name')}}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row">
<label for="time" class="col-md-4 col-form-label text-md-right">
{{__('Time')}}
</label>
<div class="col-md-8">
<input type="number" name="time" class="form-control {{$errors->has('time') ? 'is-invalid' : ''}}" value={{$data->time}} required >
#if($errors->has('time'))
<span class="invalid-feedback" role="alert">
<strong>{{$errors->first('time')}}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Save') }}
</button>
</div>
</div>
</form>
#endforEach
</div>
Everything inside the forEach doesn't render. I can't see the problem.

In your controller:
public function formEdit($id){
$line = Line::find($id);
return view('lineEdit', compact('line'));
}
I use the compact method to send the $line variable to the view.
Also, if you want to get the Line model to edit you dont need this:
$lineUp = Line::select('*')->where('id', $line)->get();
you only need this to find your model:
$line = Line::find($id);

Try this in your controller:
public function formEdit($id){
$line = Line::find($id);
return View::make('lineEdit', compact('line'));
}
This should pass a variable $line to your view

Looks like the problem is in the controller code.
$line = Line::find($id);
returns you an object (just one object!) of class Line if a) $id is an integer b) $id is the primary key c) this key exists in the DB
So, either $line is null or a model object. The next query
$lineUp = Line::select('*')->where('id', $line)->get();
cannot be successful in either case.
As I understand your intent $id is just an attribute (because you expect to have a collection of objects). So, try
$lineUp = Line::select('*')->where('id', $id)->get();

Related

Data is submitted to database but not displaying with foreach() in laravel 9

i hope you are doing good.
i'am new to laravel and i searched a lot but no chance.
So i hava a form it contain fields to submit a comment here is the code :
<!-- comment -->
<div class="clearfix"></div>
<div class="margin-top-35"></div>
<div class="utf-inner-blog-section-title">
<h4><i class="icon-line-awesome-comments-o"></i> Laisse votre commentaire</h4>
</div>
<div class="margin-top-15"></div>
<input type="hidden" name="prop_id" id="prop_id" value="{{ $proprety->id }}">
<div id="add-comment">
<form class="add-comment" action="/commentannonce" method="POST">
#csrf
<input type="hidden" name="prop_id" value="{{ $proprety->id }}">
<fieldset>
<div class="row">
<div class="col-md-6">
<input type="text" placeholder="Nom Complet*" value="" name="nom"
required />
</div>
<div class="col-md-6">
<input type="email" placeholder="Adresse Email *" value="" name="email"
required />
</div>
<div class="col-md-6">
<input type="tel" placeholder="Numéro de téléphone *" value=""
name="telephone" required />
</div>
<div class="col-md-6">
<input type="text" placeholder="Sujet" value="" name="sujet"
required />
</div>
<div class="col-md-12">
<textarea cols="30" placeholder="Commentaire..." rows="2" name="commentaire" required></textarea>
</div>
</div>
</fieldset>
<div class="utf-centered-button">
<button type="submit" class="button">Submit Comment</button>
</div>
<div class="clearfix"></div>
</form>
</div>
<!-- comment -->
when i submit this form it store in the database normally.
here is my model for the comment
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Annoncecomment extends Model
{
use HasFactory;
protected $fillable = [
'prop_id',
'nom',
'telephone',
'email',
'sujet',
'commentaire',
];
}
and this is my controller for the comment :
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request){
$form_data = array(
'prop_id' => $request->prop_id,
'nom' =>$request->nom,
'telephone' => $request->telephone,
'sujet'=>$request->sujet,
'email' =>$request->email,
'commentaire'=>$request->commentaire,
);
$commentaire = Annoncecomment::create($form_data);
$user = User::first();
$commentaire = Annoncecomment::where('prop_id',$request->prop_id)->count();
$commentaires = Annoncecomment::where('prop_id',$request->prop_id)->orderBy('id','desc')->get();
$user = User::first();
return redirect('/proprety/'.$request->prop_id)->with([ 'commentaire'=>$commentaire, 'commentaires'=>$commentaires]);
}
So now i need to display these comments on a property page so i added code to property controller and i made it like this where $commentaires and commentaire are my variables one who get count and seconde to display.
$commentaire = Annoncecomment::where('prop_id',$proprety)->count();
$commentaires = Annoncecomment::where('prop_id',$proprety)->orderBy('id','desc')->get();
$rate = DB::table('clients')
->join('ratings', 'ratings.client', '=', 'clients.id')
->where('ratings.client',$proprety->client)->sum('star_rating');
$rateC = DB::table('clients')
->join('ratings', 'ratings.client', '=', 'clients.id')
->where('ratings.client',$proprety->client)->count();
if($rateC == 0){
$rate = 0;
}else{
$rate = $rate/$rateC;
}
return view('client.propretry.showProprety')->with(["commentaire"=>$commentaire, "commentaires"=>$commentaires,"rate"=>$rate,'cat'=>$cat,'area'=>$area,'price'=>$price,'type'=>$type,'client'=>$client,'similair'=>$similar,'image'=>$image,"states"=>$state,"proprety"=>$proprety]);
Back to the view of the property page i made a foreach but it dont display data and there is NO error or something in the console i made my for each like this :
section class="comments">
<div class="utf-inner-blog-section-title">
<h4><i class="icon-line-awesome-commenting-o"></i> Commentaires ({{ $commentaire->count() }})</h4>
</div>
<ul>
#foreach ($commentaires as $i)
<li>
<div class="avatar"><img src="/assets/media/avatars/blank.png" alt="" /></div>
<div class="comment-content">
<div class="arrow-comment"></div>
<div class="comment-by">{{ $i->nom }}
<span class="date">{{ date('F j, Y', strtotime($i->created_at)) }}</span>
#if (Auth::user())
<a href="#" data-id="{{ $i->id }}" id="replay"
class="reply"><i class="fa fa-reply"></i> Répondre</a>
#endif
</div>
<p>{{ $i->commentaire }}</p>
</div>
<ul>
What i did wrong ?
I know this is a little bit long but i'am struggling for 5 hours now.
Thank you very much
UPDATE UPDATE :
when i change this, from property controller it display all the comment but not the specifique comment for the prop :
this :$commentaires = Annoncecomment::where('prop_id',$proprety)->get();
to this : $commentaires = Annoncecomment::all();
Please pass the data in view method as second parameter not in with;
return view('client.propretry.showProprety', ["commentaire"=>$commentaire, "commentaires"=>$commentaires,"rate"=>$rate,'cat'=>$cat,'area'=>$area,'price'=>$price,'type'=>$type,'client'=>$client,'similair'=>$similar,'image'=>$image,"states"=>$state,"proprety"=>$proprety]);

laravel 7 nothing happens when i click sign up button it seems like event is not triggering

hello and sorry for my bad English ,
can any one help me ? when i try to sign up nothing happens .
i use laravel 7.
every time I click the sign up button, nothing happens and also no errors are showing.
UserController.php
namespace App\Http\Controllers\Web\User;
use Reminder;
use Exception;
use Modules\User\Http\Controllers\AuthController;
class UserController extends AuthController
{
public $routes = [
'home' => 'web.home.index',
'forgot_password' => 'frontend.forgot.password',
'reset_password' => 'web.user.reset-password',
];
public function getLogin()
{
$return_url = '';
if ( request()->has('return-url') )
$return_url .= request()->input('return-url');
$data = [
'authenticate_url' => route('web.user.authenticate', ['return-url' => strip_tags(trim($return_url))])
];
return view('web.user.login', $data);
}
/**
* getNewAccount
*
* #return view
*/
public function getNewAccount()
{
return view('web.user.new-account')->with(['url' => route('web.user.post-new-account')]);
}
/**
* Logout current user.
*
* #return void
*/
public function getForgotPassword()
{
return view('web.user.forgot-password')->with(['url' => route('web.user.post-forgot-password')]);
}
/**
*
* getResetPassword()
*
* #return template
* #access public
**/
public function getResetPassword($userHashId,$reminderCode)
{
try {
$hashId = hasher($userHashId, true);
if ( !$hashId )
throw new Exception('Wrong user hash key, please check the url carefully.');
$user = $this->auth->findById($hashId);
$isReminderCodeExist = Reminder::exists($user);
if(!$isReminderCodeExist)
throw new Exception("Reset code is not exists, please retry.");
return view('web.user.reset-password')->with(['url' => route('web.user.post-reset-password'),
'code' => $reminderCode,
'hash_code' => $userHashId
]);
} catch (Exception $e) {
return redirect()->back()->withInput()->withErrors($e->getMessage());
}
}
}
new-account.blade.php
#extends( "layouts.master-login")
#section('content')
<div class="row no-gutters justify-content-center ">
<div class="hero-static col-sm-8 col-md-8 col-xl-8 d-flex align-items-center px-sm-0">
<div class="col-md-12 col-xl-10" style="margin: 0 auto;">
<div class="row no-gutters">
<div class="col-md-6 order-md-1 bg-white">
<div class="block-content block-content-full px-lg-5 py-md-5 py-lg-6">
<!-- Header -->
<div class="mb-2 text-center">
<p> #include('common.logo')</p>
<p class="text-uppercase font-w700 font-size-sm text-muted"> {{ __('dcm.new_account')}} </p>
</div>
<!-- END Header -->
<!-- Sign In Form -->
<form action="{{ $url }}" method="POST">
#if(session('error.message') )
<div class="form-group">
<span class="text-danger">{{ session('error.message') }}</span>
</div>
#endif
#csrf
<div class="form-group">
<input type="text" class="form-control form-control-alt {{ $errors->has('username') ? ' is-invalid' : '' }}" id="username-username" name="username" placeholder="{{ __('dcm.username_placeholder')}}">
{!! $errors->first('username', '<span class="text-danger">:message</span>') !!}
</div>
<div class="form-group">
<input type="text" class="form-control form-control-alt {{ $errors->has('email') ? ' is-invalid' : '' }}" id="email-email" name="email" placeholder="{{ __('dcm.email_placeholder')}}">
{!! $errors->first('email', '<span class="text-danger">:message</span>') !!}
</div>
<div class="form-group">
<input type="text" class="form-control form-control-alt {{ $errors->has('first_name') ? ' is-invalid' : '' }}" id="first_name-first_name" name="first_name" placeholder="{{ __('dcm.firstname_placeholder')}}">
{!! $errors->first('first_name', '<span class="text-danger">:message</span>') !!}
</div>
<div class="form-group">
<input type="text" class="form-control form-control-alt {{ $errors->has('last_name') ? ' is-invalid' : '' }}" id="last_name-last_name" name="last_name" placeholder="{{ __('dcm.lastname_placeholder')}}">
{!! $errors->first('last_name', '<span class="text-danger">:message</span>') !!}
</div>
<div class="form-group">
<input type="password" class="form-control form-control-alt {{ $errors->has('password') ? ' is-invalid' : '' }}" id="password" name="password" placeholder="{{ __('dcm.password_placeholder')}}">
{!! $errors->first('password', '<span class="text-danger">:message</span>') !!}
</div>
<div class="form-group">
<button type="submit" class="btn btn-block btn-hero-primary">
<i class="fas fa-plus mr-1"></i> {{ __('dcm.sign_up')}}
</button>
</div>
<hr/>
<div class="form-group">
<p class="mt-3 mb-0 d-lg-flex justify-content-lg-between">
<a class="btn btn-secondary btn-block d-block d-lg-inline-block mb-1" href="{{ route('web.user.index') }}" title="{{ __('dcm.sign_in')}}">
<i class="fa fa-fw fa-sign-in-alt mr-1"></i> {{ __('dcm.sign_in')}}
</a>
</p>
</div>
</form>
<!-- END Sign In Form -->
routes/web/user.php
<?php
// using this pattern to used php artisan route:cache,
// instead of using router closure/grouping.
$userRouteNameSpace = 'Web\User';
$middlewareName = 'dcm.logged.in';
// UserController
$userController = "{$userRouteNameSpace}\UserController";
// authenticate user
Route::get('user/login', "{$userController}#getLogin")->name('web.user.index');
Route::post('user/authenticate', "{$userController}#postAuthenticate")
->name('web.user.authenticate');
// logout user
Route::get('user/logout', "{$userController}#logout")
->name('web.user.logout');
// forgot password
Route::get('user/forgot-password', "{$userController}#getForgotPassword")
->name('web.user.forgot-password');
Route::post('user/forgot-password', "{$userController}#postForgotPassword")
->name('web.user.post-forgot-password');
// reset password
Route::get('user/reset-password/{hashId}/{resetcode}', "{$userController}#getResetPassword")
->name('web.user.reset-password');
Route::post('user/reset-password', "{$userController}#postResetPassword")
->name('web.user.post-reset-password');
// create new user account
Route::get('user/new-account', "{$userController}#getNewAccount")
->name('web.user.new-account');
Route::post('user/new-account', "{$userController}#postNewAccount")
->name('web.user.post-new-account');
// ProfileController
$profileController = "{$userRouteNameSpace}\ProfileController";
Route::get('user/profile', "{$profileController}#getProfile")
->name('web.user.profile')
->middleware($middlewareName);
Route::post('user/update-profile', "{$profileController}#postUpdateProfile")
->name('web.user.update.profile')
->middleware($middlewareName);
// update user avatar
Route::post('user/update-avatar/{hashId}', "{$profileController}#postUpdateAvatar")
->name('web.user.update.avatar')
->middleware($middlewareName);
// Verify User
Route::get('/verify','Auth\RegisterController#verifyUser')->name('verify.user');
When I click on sign up, nothing happens, it seems like event is not triggering
First
Please try to understand carefully, you have your both routes (GET route: get('user/new-account' for new-account page and POST route: post('user/new-account' for getting the values from new-account page) for creating a new user and they are ok. Don't change anything here:
// create new user account
Route::get('user/new-account', "{$userController}#getNewAccount")
->name('web.user.new-account');
Route::post('user/new-account', "{$userController}#postNewAccount")
->name('web.user.post-new-account');
Second
As you said, you don't have the method postNewAccount() in your userController so you must have one. So add this code inside your userController so that you can get the submitted data here:
public function postNewAccount(Request $request)
{
// you will get your submitted data here
// you can either dd() or return to see the submitted data
dd($request->all()); // or return $request->all();
// you can do the rest of the work here
}
If you successfully get data, then you can do next step like validation or storing data to database there.
Important note: your controller names start with small letter which is also problematic. So, change them like userController will be UserController
Suggestion:: Please follow the laravel documentation for better understanding the codes before trying them

Laravel form validation doesn't work when in my controller declaring more databases

I declare a variable containing the database so that the blade can select, but when doing so, the validation does not work. Please help me. Thank you very much.
this is the variable I call in the database to use select in the blade.
public function new_department(){
//return view('admin.new-department');
$manage_faculties=DB::table('faculties')->orderBy('id','asc')->get();
$all_manage_faculties=view('admin.new-department')->with('manage_faculties', $manage_faculties);
return view('layouts.master')->with('admin.new-department', $all_manage_faculties);
}
Here is the validation I use in the insert information and database.
public function save_new_department(Request $request){
$data = [];
$data['department_name'] = $request->input('department_name');
$data['description'] = $request->input('description');
$data['faculty_id'] = $request->input('faculty_name');
if($request->isMethod('post')){
$validator = Validator::make($request->all(), [
'department_name' => 'required|min:3|max:100|unique:departments',
'description' => 'required|max:500',
]);
if ($validator->fails()) {
return back()->with('toast_error', $validator->messages()->all()[0])->withInput();
}
DB::table('departments')->insert($data);
return redirect('/admin/departments/new')->withSuccess('Post Created Successfully!');
}
}
display it in the blade
After entering data whether it is true or false, it is not possible to report an error on the screen.After entering data whether it is true or false, it is not possible to report an error on the screen.
<form class="mt-3"method="post" action="{{ url('admin/department/new-department') }}">
{{csrf_field()}}
<div class="modal-content">
<div class="modal-header bg-primary">
<h5 class="modal-title">Create a Department</h5>
</div>
<!--end of modal head-->
<div class="modal-body">
<div class="form-group row align-items-center" {{ $errors->get('name') ? 'has-error' : '' }}>
<label class="col-2">Department</label>
<input class="form-control col" type="text" placeholder="Department name" name="department_name" required/>
#foreach($errors->get('name') as $error)
<span class="help-block">{{ $error }}</span>
#endforeach
</div>
<div class="form-group row align-items-center">
<label class="col-2">Faculty</label>
<select name="faculty_name" class="form-control col" required>
<option value="" selected>Select a Faculty</option>
#foreach($manage_faculties as $key => $cate_pro)
<option value="{{$cate_pro->id}}">{{$cate_pro->faculty_name}}</option>
#endforeach
</select>
</div>
<div class="form-group row">
<label class="col-2">Description</label>
<textarea class="form-control col" rows="10" placeholder="Write something here..." name="description" required ></textarea>
</div>
</div>
<!--end of modal body-->
<div class="modal-footer">
<button role="button" class="btn btn-primary" type="submit">
Post
</button>
</div>
</div>
</form>
You can look here for displaying errors in Laravel.
Why did you put :
{{ $errors->get('name') ? 'has-error' : '' }}
inside a "div" like a attribute ?

update function from my profile controller doent change data ffrom DB

after i submit my edited form nothing changes in the database i want to explain more but its hard for me with english i hope you understand.
well i want to make a view for profile updating :
here is my my view :
<div class="row contact_form_row">
<div class="col">
<div class="contact_form_container">
<form method="PUT" action="{{ route('profile.update',auth()->id()) }}" class="contact_form text-center" id="contact_form">
{{ csrf_field() }}
{{ method_field('PUT') }}
<div class="row">
#foreach ($infos as $infos)
<div class="col-lg-6">
<div class="col-lg-12">
<label> Nom : </label>
<input type="text" class="contact_input" name="name" value="{{$infos->name}}" required="required">
</div>
<label> E-mail : </label>
<div class="col-lg-12">
<input type="text" class="contact_input" name="email" value="{{$infos->email}}" required="required">
</div>
<div class="col-lg-12">
<label> Numero de telephone : </label>
<input type="text" class="contact_input" name="tele_user" value="{{$infos->tele_user}}" required="required">
</div>
<div class="col-lg-12">
<label> Adresse personnalisée : </label>
<input type="text" class="contact_input" name="adresse" value="{{$infos->adresse}}" required="required">
</div>
</div>
<div class="col-lg-12">
<label> Presentation : </label>
<textarea class="contact_textarea contact_input" name="presentation" placeholder="presentation" required="required">{{$infos->presentation}}</textarea>
</div>
#endforeach
<button class="contact_button right" type="submit">Valider!</button>
</div>
</form>
</div>
</div>
</div>
and here is my controller :
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use App\User;
use App\users;
use App\http_request;
class ProfileController extends Controller
{
/**
* Display a listing of the resource.
*
* #return \Illuminate\Http\Response
*/
public function index()
{
//
$infos = DB::table('users')
->where('users.id',auth()->user()->id)
->join('ville','ville.ID_Ville','=','users.ID_Ville')
->join('region','region.ID_REGION','=','ville.ID_REGION')
->get();
return view('profile')->with('infos',$infos);
}
public function update(Request $request, $id)
{
//$user = users::find($id);
$user = DB::table('users')
->select('users.*')
->where('user.id', $id);
$user->nom =$request->input('nom');
$user->email =$request->input('email');
$user->tele_user =$request->input('tele_user');
$user->adresse =$request->input('adresse');
$user->presentation =$request->input('presentation');
$user->save();
$infos = DB::table('users')
->where('users.id',auth()->user()->id)
->join('ville','ville.ID_Ville','=','users.ID_Ville')
->join('region','region.ID_REGION','=','ville.ID_REGION')
->get();
return view('/profile')->with('infos',$infos);
}
}
after i submit i get a white page instead of the the view /profile with and url :
http://localhost/testprojet/public/profile/1?_token=R4cTYZuLPX9shqkg0i2JKoCwx7g23PbRc5Vhke5A&_method=PUT&name=Othmaneee&email=othmane.messaoud%40gmail.com&tele_user=642213124&adresse=Maroc%2C+Rabat+Al+Irfan+ENSIAS&presentation=je+m%27appelle+othmane+
it means that the information passed but nothing changes in the database
any help please
You are missing a
}
At the end of your file to close the class
PHP Syntax Check: Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in your code on line 49

Eloquent $model->update() does not make changes on database record

When I update my comment it goes back to the page and changes the comment back to orignal, so the update hasn't been done. No errors or something.
db: comments
Schema::create('comments', function (Blueprint $table) {
$table->increments('id');
$table->integer('articleID')->unsigned();
$table->string('comment');
$table->timestamps();
});
model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
protected $fillable = ['comment', 'articleID'];
public function article() {
return $this->belongsTo('App\Article');
}
}
CommentsController
public function edit($commentID) {
$comment = Comment::findOrFail($commentID);
return view('pages.comments.edit', compact('comment'));
}
public function update($commentID, CommentRequest $request) {
$comment = Comment::findOrFail($commentID);
$comment->update($request->all());
return view('/');
}
editComment view
<form action="{{ route('updateComments', ['commentID' => $comment->id]) }}" class="form-horizontal" method="get">
{{ csrf_field() }}
{{ method_field('PATCH') }}
<!-- Article data -->
<div class="form-group">
<label class="col-sm-3 control-label" for="body">Comment</label>
<div class="col-sm-6">
<textarea class="form-control" id="body" name="body" maxlength="1000">{{ $comment->comment }}</textarea>
</div>
</div>
<!-- Add Article Button -->
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button class="btn btn-default" type="submit"><i class="fa fa-pencil-square-o"></i> Edit comment</button>
</div>
</div>
</form>
Your problem is:
You cannot do form submit with get method, even with hidden method_field('PATCH') in fact it does not event get to update action (:
Your form field name body is not correct if we look at fillable field of model
So just fix Your form:
<form
action="{{ route('updateComments', ['commentID' => $comment->id]) }}"
method="post"
class="form-horizontal">
{{ csrf_field() }}
<!-- Article data -->
<div class="form-group">
<label class="col-sm-3 control-label" for="comment">Comment</label>
<div class="col-sm-6">
<textarea
id="comment"
name="comment"
maxlength="1000"
class="form-control"
>{{ $comment->comment }}</textarea>
</div>
</div>
<!-- Add Article Button -->
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button class="btn btn-default" type="submit">
<i class="fa fa-pencil-square-o"></i> Edit comment
</button>
</div>
</div>
</form>
or change Your schema and model to have field called body not comment
p.s. also fix Your update action:
public function update(CommentRequest $request, $commentID) {
$comment = Comment::findOrFail($commentID);
$comment->update($request->except(['articleID'])); // for safety we are ignoring "possible existence" of articleID in forma
return redirect(route('updateComments', compact('commentID')));
}
doing return view('/') is not correct - it's trying to find file with name / that of course does not exist.

Categories