Questions tagged [laravel-controller]
218 questions
0
votes
2 answers
How Laravel Generate Model Migration Controller all command related files?
after these commands
php artisan make:model 'FileName' -mcs
Laravel make command files sources (Model, Controller, Migration, Seeder, Factory etc...)
How all basic files generate and where from these files comes?

Shourov Shahadat
- 13
- 4
0
votes
2 answers
Unable to send ajax data to Laravel controller
I'm just trying to send the editable table row data to the controller onClick of the Save button, update that data in the database, and return success.
But I cannot display the data inside the controller function of laravel. Data inside saveMe…

Faizan Kamal
- 1,732
- 3
- 27
- 56
0
votes
2 answers
Session is not getting saved after page redirect in Laravel Application
I am redirecting the page after a successful login check and the session is created but the session is not available after page redirection.
My Login Controller:
$validated = $request->validate([
'email' => 'required|email',
'password' =>…
0
votes
5 answers
Method Illuminate\Database\Eloquent\Collection::orderby does not exist
$posts = Post::all()->orderby('created_at','desc')->where('usr_id','=',session('LoggedUser'))->get();
return view('admin.profile',compact('userInfo' , 'posts'));
i am making a custom auth for a journal activity but i cant sort the content i…
0
votes
1 answer
How can I send data from a form into the table in the database?
I have a form that adds a new property listing into the properties table in the db. I keep getting errors that inputs are null and also Laravel isn't grabbing the value inputted into the select HTML tag. I am putting data into the form, but it keeps…

JayDev95
- 777
- 2
- 5
- 18
0
votes
2 answers
how to access data ($count) from laravel controller to vue component
I want to access a variable $count from my controller and access it to a vue component (frontend). currently have this code on my controller:
public function index()
{
$count = User::where('created_at', Carbon::today())->count();
return…

Sansa
- 5
- 3
0
votes
1 answer
How to show message to the user after email verification in Laravel?
I want to display a message to the user after email verification. Getting an email to email verification after new user sign up to the website. There is a VerficationController. how I can modify to get the notification?

kumari shwetha
- 61
- 2
- 12
0
votes
2 answers
Undefined variable in Blade/view in Laravel
I'm getting $navs is not defined in my Blade view, even though I have it defined and passed to the view by my controller. I am still getting the following error regardless.
ErrorException Undefined variable: navs…

Ebrusike Favour
- 1
- 2
0
votes
1 answer
My laravel Yajra datatable does not render. It says invalid json response. However I can not read the error since the response is empty
Hello I have the following controller method to return data to my datatable in Laravel,
Controller Method
public function get(Request $request) {
return Datatables::of(AppUser::all())
->addColumn('status', function ($user) {
if…

gfit21x
- 141
- 9
0
votes
2 answers
how to paginate read notifications in Laravel
I got an error related to the pagination of read notifications. Thank you for your help.
This is my controller code that gives this error when it runs
public function NotificationsRead(User $user)
{
$no =…

user16426192
- 23
- 6
0
votes
1 answer
laravel withCount() Cardinality violation error when relationship is hasMany
This is my models:
//project model
class Project extends Model {
.....
public function items(){
return $this->hasMany(ProjectItem::class,'project_id');
}
}
//project items model
class ProjectItem extends Model{
...
public…

dev-jim
- 2,404
- 6
- 35
- 61
0
votes
1 answer
SQLSTATE[HY000]: General error: 1364 Field 'seller_id' doesn't have a default value
$product = new Product([
'productName' => $request->productName,
'quantity' => $request->quantity,
'weight' => $request->weight,
'boxes' => $request->boxes,
'MRP' => $request->MRP,
'costprice'…

Ritik Rai
- 11
- 3
0
votes
1 answer
I am unable to send data to my database , getting no error
namespace App\Http\Controllers;
use App\Models\Product;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
class ProductController extends Controller
{
public function store(Request $request) {
…

Ritik Rai
- 11
- 3
0
votes
1 answer
Using groupBy with resource collection laravel
I am working on api, and using resource to send data. I want to send collection which is grouped by status. So far I have done the following:
public function data(){
$collection = ModelNameResource::collection(
ModelName::query()
…

Gaurav
- 149
- 12
0
votes
3 answers
how to use two functions from same controller in single page route using get in laravel
Am trying to use two different functions from one controller in a single page route
Route::get('/cart','App\Http\Controllers\Frontend\CartController@index');
Route::get('/cart','App\Http\Controllers\Frontend\CartController@alldata');
But the…

Sam Leumas
- 23
- 5