mercredi 12 avril 2023

Showing the laravel request uri in php fpm status page

I have a php fpm 7.4 status page giving the following details :-

************************
pid:                  284764
state:                Idle
start time:           11/Apr/2023:21:04:09 +0200
start since:          15258
requests:             493
request duration:     274387
request method:       POST
request URI:          /index.php
content length:       192
user:                 -
script:               /home/laravel/backend/public/index.php
last request cpu:     7.29
last request memory:  2097152

************************

Its showing the request URI and script "/index.php" in all the processes data, how can i make php fpm status page show the user request uri (eg. /user/getDetails)



via Chebli Mohamed

samedi 8 avril 2023

Laravel i get whole content of a view inside of tbody after the result of each search query

i have an issue in a view that whenever i try do a search query the like a get a child view inside the that view with result guess like the whole page appear inside tbody with the result of the search. Controller :

public function index(Request $request)
    {
        $query = Immeuble::with('plaques.user');

        // Get the search query and selected filters from the request
        $searchQuery = $request->input('q', '');
        $searchColumns = $request->input('columns', []);

        // Apply the search query and filters to the query
        if (!empty($searchQuery)) {
            $query->where(function ($q) use ($searchQuery, $searchColumns) {
                foreach ($searchColumns as $column) {
                    switch ($column) {
                        case 'im':
                            $q->orWhere('im', 'like', "%{$searchQuery}%");
                            break;
                        case 'c_rsdnce':
                            $q->orWhere('c_rsdnce', 'like', "%{$searchQuery}%");
                            break;
                        case 'property_name':
                            $q->orWhere('property_name', 'like', "%{$searchQuery}%");
                            break;
                        case 'qualif':
                            $q->orWhere('qualif', 'like', "%{$searchQuery}%");
                            break;
                        case 'name':
                            $q->orWhereHas('user', function ($q) use ($searchQuery) {
                                $q->where('name', 'like', "%{$searchQuery}%");
                            });
                            break;
                        case 'nom':
                            $q->orWhereHas('plaques', function ($q) use ($searchQuery) {
                                $q->where('nom', 'like', "%{$searchQuery}%");
                            });
                            break;
                    }
                }
            });
        }
        // Get the selected category filters from the request
        $status = $request->input('status');

        // Apply the category filters to the query
        if(!empty($status)) {
            $query->where('status', $status);
        }

        // Paginate the results
        $immeubles = $query->paginate(15)->withQueryString();


        // Pass the data to the view
        return view('admin.immeubles.index', [
            'immeubles' => $immeubles,
            'status' => $status,
            'selectedColumns' => $searchColumns,
            'searchQuery' => $searchQuery,
        ]);
    }

this is the index view i get inside of the tbody the as a result the content of the view with result of the query like it keep duplicating each time i make a search:

@extends('layouts.app')

@section('content')
@if(session('import'))
    <h6 class="alert alert-success">
        
    </h6>
@endif
<span class="align-right">
    <a href= "/admin/immeubles/create" class="btn btn-add" role="button">Ajouter un Immeuble</a><br>
</span>
<div class="container">
    <div class="card-body">
<form action="" method="post" enctype="multipart/form-data">
@csrf
    <input type="file" name="excelimport" class="control-form">
    <button class="btn">Importer</button>
</form>
<!-- The search form -->
<form id="search-form" method="GET" action="">
    <div class="form-group">
      <input type="text" name="q" class="form-control" placeholder="Search..." value="">
    </div>
    <div class="form-group">
      <label>Search in:</label>
      <div class="form-check">
        <input class="form-check-input" type="checkbox" name="columns[]" value="im" id="im" >
        <label class="form-check-label" for="im">Ref Immeuble</label>
      </div>
      <div class="form-check">
        <input class="form-check-input" type="checkbox" name="columns[]" value="name" id="user_name" >
        <label class="form-check-label" for="user_name">Technicien</label>
      </div>
      <div class="form-check">
        <input class="form-check-input" type="checkbox" name="columns[]" value="c_rsdnce" id="c_rsdnce" >
        <label class="form-check-label" for="c_rsdnce">Résidence</label>
      </div>
      <div class="form-check">
        <input class="form-check-input" type="checkbox" name="columns[]" value="qualif" id="qualif" >
        <label class="form-check-label" for="qualif">Qualif</label>
      </div>
      <div class="form-check">
        <input class="form-check-input" type="checkbox" name="columns[]" value="property_name" id="property_name" >
        <label class="form-check-label" for="property_name">Proprieter</label>
      </div>
      <div class="form-check">
        <input class="form-check-input" type="checkbox" name="columns[]" value="plaque_name" id="plaque_name" >
        <label class="form-check-label" for="plaque_name">Plaque</label>
      </div>
      <div class="form-group">
        <label>Filtré par Status:</label>
        <select class="form-control" id="status" name="status">
            <option value="">--Select Status--</option>
            <option value="terminer" >Terminer</option>
            <option value="encours" >En Cours</option>
          </select>
      </div>
    </div>
    <button type="submit" class="btn btn-primary">Search</button>
  </form>
  
  <!-- The search results table -->
  <table class="table">
    <thead>
      <tr>
        <th>Ref Immeuble</th>
        <th>Residence</th>
        <th>Propriéter</th>
        <th>Qualif</th>
        <th>Plaque</th>
        <th>Technicien</th>
        <th>Status</th>
      </tr>
    </thead>
    <tbody id="search-results">
        @foreach ($immeubles as $immeuble)
        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
    @endforeach
    </tbody>
  </table>
  
  <!-- The pagination links -->
  
  
  <!-- The AJAX script -->
  @push('filter')
  <script>
    $(document).ready(function() {
      // Submit the search form via AJAX
      $('#search-form').submit(function(event) {
        event.preventDefault();
  
        var formData = $(this).serialize();
  
        $.ajax({
          url: $(this).attr('action'),
          type: 'GET',
          data: formData,
          beforeSend: function() {
            $('#search-results').html('<tr><td colspan="4" class="text-center">Chargement en cours...</td></tr>');
          },
          success: function(response) {
            $('#search-results').html(response);
          },
          error: function(xhr) {
            console.log(xhr.responseText);
          }
        });
      });
    });
  </script>
  @endpush
@endsection

i want to just get the result without having that issue.



via Chebli Mohamed

mercredi 5 avril 2023

Type error: Too few arguments to function App\Http\Controllers\gst_billing\WOSBillingController::index(), 0 passed and exactly 1 expected

I have to show index page with corresponding id,when I dd() the query in index method I'm getting null

index method in controller

    public function index($id){
    
     $bill = DB::table('proforma_invoice as b')
                ->leftjoin('states as ss', 'ss.id', '=', 'b.shipping_state_id')
                ->leftjoin('countries as sco', 'sco.id', '=', 'ss.country_id')
                ->leftjoin('states as s', 's.id', '=', 'b.billing_state_id')
                ->leftjoin('countries as co', 'co.id', '=', 's.country_id')
                ->join('customer as c', 'c.id', '=', 'b.customer_id')
                ->select('b.billing_name', 'b.customer_id', 'b.*', 's.state_name', 'co.country_name', 'ss.state_name as shipping_state', 'sco.country_name as shipping_country')
                ->where('b.id', $id)
                ->first();
                
                dd($bill);
   return view('gst_billing.wos_billing.index')->with('bill',$bill);
    
    }

button from table that takes to index page with corresponding id:

 <a href="" title="Send to Invoice"><i class="fas fa-file-invoice"></i></a>

Route:

Route::get('/wos_billing/{id}',['as' => 'gst_billing.wos_billing.index', 'uses' => 'WOSBillingController@index'])->name('gst_billing.wos_billing.index');

can someone identitfy what I'm doing wrong here ?



via Chebli Mohamed

How can I avoid update some dependencies when I run composer update?

I'm taking over a website coded in laravel 5.6.40

I have to make a lots of updates on this project (laravel 5.6 to 5.7 then 5.7 to 5.8 etc...)

At first I want to upgrade it to 5.7.*

This website is using private packages and I don't have the repositories access.

So there is my composer.json file :

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "repositories": [
        {
            "type": "vcs",
            "url":  "git@github.com:WW/Admin_pkg.git"
        },
        {
            "type": "vcs",
            "url":  "git@github.com:WW/Assets_pkg.git"
        },
        {
            "type": "vcs",
            "url":  "git@github.com:WW/Metatags_pkg.git"
        },
        {
            "type": "vcs",
            "url":  "git@github.com:WW/Navigation_pkg.git"
        },
        {
            "type": "vcs",
            "url":  "git@github.com:WW/Notification_pkg.git"
        }
    ],
    "require": {
        "php": "^7.1.3",
        "ext-json": "*",
        "ext-openssl": "*",
        "doctrine/dbal": "^2.7",
        "fideloper/proxy": "^4.0",
        "guzzlehttp/guzzle": "^6.3",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0",
        "msurguy/honeypot": "dev-master",
        "spatie/laravel-backup": "^5.12",
        "ww/admin": "^3.0",
        "ww/assets": "^1.0",
        "ww/metatags": "^1.0",
        "ww/navigation": "^3.0",
        "ww/notification": "^1.1"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.1",
        "barryvdh/laravel-ide-helper": "^2.4",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover",
            "@composer run-script publish:admin"
        ],
        "publish:admin": [
            "@php artisan vendor:publish --provider=\"WebLogin\\Admin\\AdminServiceProvider\" --tag=public --force --no-interaction"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true,
        "allow-plugins": {
            "kylekatarnls/update-helper": true
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

On the first time I only change "laravel/framework": "5.6.*" to "laravel/framework": "5.7.*" and run composer update

This is the result :

When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+SRV02WEB+2023-04-05+1000 to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+SRV02WEB+2023-04-05+1000
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "/home/myproject/.config/composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden): 

I don't have this token so I pass and it aborting. I understand that he tries to access to the repositories.

Secondly I try to remove from composer.json the repositories part and run again composer update

The result :

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires ww/admin ^3.0, found ww/admin[v3.0.0] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
  Problem 2
    - Root composer.json requires ww/assets ^1.0, found ww/assets[v1.0.4] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
  Problem 3
    - Root composer.json requires ww/metatags ^1.0, found ww/metatags[v1.0.1] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
  Problem 4
    - Root composer.json requires ww/navigation ^3.0, found ww/navigation[v3.0.0] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.
  Problem 5
    - Root composer.json requires ww/notification ^1.1, found ww/notification[v1.1.4] in the lock file but not in remote repositories, make sure you avoid updating this package to keep the one from the lock file.

Effectively I don't want to update these but just keeping the ww vendor file that is already installed.

I understands that it recommends to avoid updating these packages but how can I do it?

EDIT : The main problem is that the project uses private packages that I've not access to.

I already have these packages installed on the project but I can't update it (due to private repos).

Someone advise me that if I have the vendor folder of these packages I can move it to the application level and use it locally.

I made some research and follow this https://laraveldaily.com/post/how-to-create-a-laravel-5-package-in-10-easy-steps to move the vendor/package folder.

Now composer update is running fine for these packages.



via Chebli Mohamed

Laravel: Integration tests failing on bitbucket pipelines

I am working on Laravel 5.5 integration tests and they are passing on local env but failing on Bitbucket pipelines. Here is my bitbucket-pipelines.yml:

image: php:7.1

pipelines:
  default:
    - step:
        script:
          - apt-get update && apt-get install -y unzip libzip-dev --force-yes
          - docker-php-ext-install zip
          - docker-php-ext-enable zip
          - docker-php-ext-install sockets
          - docker-php-ext-enable sockets
          - docker-php-ext-install bcmath
          - docker-php-ext-enable bcmath
          - docker-php-ext-install pdo_mysql
          - docker-php-ext-enable pdo_mysql
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer --version
          - composer self-update --1
          - composer install
          - cp .env.example .env
          - php artisan key:generate
          - sleep 5
          - ./vendor/bin/phpunit --testsuite=unit-api
          - ./vendor/bin/phpunit --testsuite=unit-domain
          - ./vendor/bin/phpunit --testsuite=unit-controllers
          - ./vendor/bin/phpunit --testsuite=integration
        services:
          - mysql
definitions:
  services:
    mysql:
      image: mysql:5.7
      variables:
        MYSQL_DATABASE: 'my_db'
        MYSQL_RANDOM_ROOT_PASSWORD: 'yes'

Here is the error I am receving:

  1. DeleteOrderFileTest::apiDeleteOrderFile Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] No such file or directory (SQL: insert into modules (name, description, updated_at, created_at) values (System Administration, System administration feature, 2023-04-05 09:07:03, 2023-04-05 09:07:03)) /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Connection.php:624 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Connection.php:459 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Connection.php:411 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php:32 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2494 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:1283 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:787 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:752 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:615 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:755 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Support/helpers.php:1041 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:756 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1570 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1582 /opt/atlassian/pipelines/agent/build/tests/integration/database/seeds/shared/TestModulesTableSeeder.php:26 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/Container.php:564 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:122 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:42 /opt/atlassian/pipelines/agent/build/tests/integration/database/seeds/shared/TestDefaultSeeder.php:24 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/Container.php:564 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:122 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:42 /opt/atlassian/pipelines/agent/build/tests/integration/database/seeds/shared/TestSeeder.php:22 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/Container.php:564 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:122 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:42 /opt/atlassian/pipelines/agent/build/tests/integration/OrderLineProcessing/OrderLinesFilesSeeder.php:18 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/Container.php:564 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Seeder.php:122 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php:63 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php:122 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php:64 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Container/Container.php:564 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Console/Command.php:179 /opt/atlassian/pipelines/agent/build/vendor/symfony/console/Command/Command.php:255 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Console/Command.php:166 /opt/atlassian/pipelines/agent/build/vendor/symfony/console/Application.php:1021 /opt/atlassian/pipelines/agent/build/vendor/symfony/console/Application.php:275 /opt/atlassian/pipelines/agent/build/vendor/symfony/console/Application.php:149 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Console/Application.php:89 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Console/Application.php:188 /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:250 /opt/atlassian/pipelines/agent/build/vendor/laravel/browser-kit-testing/src/Concerns/InteractsWithConsole.php:25 /opt/atlassian/pipelines/agent/build/vendor/laravel/browser-kit-testing/src/Concerns/InteractsWithDatabase.php:87 /opt/atlassian/pipelines/agent/build/tests/integration/IntegrationTestCase.php:19 /opt/atlassian/pipelines/agent/build/tests/integration/API/DeleteOrderFileTest.php:46

What am I doing wrong here?



via Chebli Mohamed

dimanche 2 avril 2023

Attempt to read property "nom" on null

I am facing this error 'Attempt to read property "nom" on null' in Laravel 10. though the User eloquent model work fine beside for Plaques;

Here is my Code:

Plaques Model:

class Plaques extends Model
{
    use HasFactory;

    protected $table = 'Plaques';

    protected $fillable = ['nom', 'zone', 'el_plaque', 'tranche', 'gc_mecanise', 'gc_trad', 'gpon', 'ville', 'status_plaque', 'closed_by' , 'created_by'];

    public function chambres()
    {
        return $this->hasMany(Chambres::class);
    }

    public function immeuble()
    {
        return $this->hasMany(Immeuble::class);
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}

Chambres Model:

class Chambres extends Model
{
    use HasFactory;

    protected $table = 'Chambres';

    protected $fillable = ['ref_chambre', 'type_chambre', 'chambre_terminer', 'loc_x_chambre', 'loc_y_chambre', 'plaque_id', 'user_id', 'status_chambre', 'created_by', 'closed_by', 'affected_by'];

    public function photos()
    {
        return $this->hasMany(Photos::class);
    }

    public function immeuble()
    {
        return $this->hasMany(Immeuble::class);
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function plaques()
    {
        return $this->belongsTo(Plaques::class);
    }

}

ChambresController:

use App\Models\Chambres;
use App\Models\Plaques;
use App\Models\User;

class ChambresController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index()
    {
        return view('admin.chambres.index')
        ->with('chambres', Chambres::get());
    }

View:

<tbody>
            @forelse ($chambres as $chambre)
            <tr>
                <th scope="col"><a href= "/admin/chambres/" class="badge badge-primary" role="button"> </a></th>
                <th scope="col"></th>
                <th scope="col"></th>
                <th scope="col"></th>
                <th scope="col"><a href= "/admin/chambres//edit" class="badge badge-primary" role="button"> Modifier </a></th>
                <th scope="col">
                    <form id="valider" action="/admin/chambres/" method="post" class="hidden">
                    @csrf
                    @method('delete')
                    <button class="btn" role="button">Supprimer</button>
                </form>
                </th>
            </tr>

Chambres Migration:

        Schema::create('chambres', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->nullable();
            $table->unsignedBigInteger('plaque_id')->nullable();
            $table->string('ref_chambre')->unique();
            $table->string('type_chambre');
            $table->date('chambre_terminer')->nullable()->change();
            $table->string('loc_x_chambre');
            $table->string('loc_y_chambre');
            $table->boolean('status_chambre')->nullable();
            $table->string('created_by')->nullable();
            $table->string('closed_by')->nullable();
            $table->string('affected_by')->nullable();
            $table->foreign('plaque_id')->references('id')->on('plaques')->onDelete('cascade');
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->timestamps();
        });

i want to get 'nom' column value from 'Plaques' table which has foreign key on 'Chambres' table.



via Chebli Mohamed