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

How to build Laravel + PostgreSQL project?

I want to build Laravel + PostgreSQL existing Project. config.php 'pgsql' => [ 'driver' => 'pgsql', 'url' => env('DATABASE_URL', "pgsql://postgres:[email protected]:5432/crawler"), 'host' => env('DB_POSTGRES_HOST', '127.0.0.1'), 'port' => env('DB_POSTGRES_PORT', '5432'), 'database' => env('DB_POSTGRES_DATABASE', 'crawler'), 'username' => env('DB_POSTGRES_USERNAME', 'postgres'), 'password' => env('DB_POSTGRES_PASSWORD', '123'),…

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
Back To Top
Search