Archive for the 'Frameworks' Category

Laravel laravel-entrust specify multiple roles in web guard.

Friday, January 5th, 2024

I was writing a Meeting tracking app in Laravel and using the shanmuga3/laravel-entrust module for roles and permissions. I created a new role for the application but needed to support some superadmin functionality within the site but was having issues with some of the routing. I found that padding the superadmin and admin with a pipe delimited list directly to the ‘role:’ entry worked.

Route::group(['prefix' => 'admin','middleware' => ['role:superadmin|admin']], function() {

        Route::get('/settings', function() {
          return "a";
        })->name('admin.edit');
})
;

Laravel on windows: Private key does not exist

Thursday, May 27th, 2021

I was setting up my Laravel development using the Homestead on a new laptop and my usual tool chain includes installing git and using git bash. When I tried the ‘vagrant up’ command I got the following error:

Check your Homestead.yaml (or Homestead.json) file, the path to your private key does not exist.

The default location for that file is the .ssh directory within your home directory. This directory does not exist unless you have run the ssh-keygen tool to create it. Run the following command to generate the key file. For local development you can just use the default options.

ssh-keygen -t rsa -C "you@homestead"

Once the file is generated you can run ‘vagrant up’ and continue your development.