PHP code example of yanhaoli / office-building

1. Go to this page and download the library: Download yanhaoli/office-building library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yanhaoli / office-building example snippets


Yanhaoli\OfficeBuilding\Providers\OfficeBuildingServiceProvider::class,

    php artisan vendor:publish --provider="Yanhaoli\OfficeBuilding\Providers\OfficeBuildingServiceProvider"
    

    

    namespace App\Http\Controller;
    use OfficeBuilding;
    use App\OfficeBuilding\Employee;

    class OfficeEmployeeController extends Controller
    {
      public function browse(Request $request, $office_id)
      {
        $employees = OfficeBuilding::visit($office_id, function(){
          return Employee::all();
        });

        return response($employees, 200);
      }
    }