skip to Main Content

Data not returned in variable using Laravel's View Composer

I'm using view composer in Laravel as follows: namespace AppProviders; use IlluminateSupportServiceProvider; use IlluminateSupportFacadesView; use AppModelsGreen; use AppModelsBlue; class SidebarServiceProvider extends ServiceProvider { public function boot(): void { View::composer('layouts.sidebar', function ($view) { $dataGreen = Green::all(); $dataBlue = Blue::all(); $view->with([ 'green'…

VIEW QUESTION

Laravel – My route to delete is not working in simple crud

I am trying to delete a particular data with corresponding id but it redirects me to the Show page although the route is directing it to destroy. My index.blade <td><form class="action"><button type="submit" formaction="{{route('products.show',$product->id)}}">Show</button></form></td> <td><form class="action"><button type="submit" formaction="{{route('products.edit',$product->id)}}">Edit</button></form></td> <td><form class="delete" action="{{…

VIEW QUESTION

Javascript – unable to retrieve data using postgres and nodeJS

Here is how i've set the following files: index.js const express = require('express') const app = express() const port = 8000 const expense_model = require('./expense_model') app.use(express.json()); app.use(function (req, res, next) { res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8000'); res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,OPTIONS'); res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers'); next(); });…

VIEW QUESTION

How can I display book details in Laravel using Eloquent join and where clauses?

Undefined property: IlluminateDatabaseQueryBuilder::$title public function show(string $id) { $books = DB::table("book_tbls") ->where("author_tbls.id", "=", $id) ->where("author_tbls.id", "=", "book_tbls . author_id") ->where("categories.id", "=", $id) ->where("categories.id", "=", "book_tbls . category_id"); // $books = book_tbl::find($id); return view('books.show', compact('books')); } I am learning laravel for…

VIEW QUESTION

assign data to variable PHP – Laravel

I wan to get data for two variables in same method but its not happening function display(){ $datas=Req::all(); $products = Product::all(); return view ('products.dispaly')->with('products', $products,'datas',$datas); } here i want to get data from table and assign them to two separate…

VIEW QUESTION

Bracket wrong in react – Reactjs

Can not see why this isn't working. This is a react.js app App.js import {useState} from "react"; import './App.css'; function App() { const [age, setAge] = useState(0); const [inputValue, setInputValue] = useState(""); const [showText, setShowText] = useState(true); const [textColor, setTextColor]…

VIEW QUESTION
Back To Top
Search