View registering.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Illuminate\Support\Facades\Gate; | |
Gate::guessPolicyNamesUsing(function (string $modelClass) { | |
// Provide the name of the model’s policy class… | |
}); |
View registerPolicy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use App\Models\Post; | |
use App\Policies\PostPolicy; | |
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; |
View PostPolicy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use App\Policies\PostPolicy; | |
use Illuminate\Support\Facades\Gate; | |
/** | |
* Register all authorization and authentication services. | |
*/ |
View update-policy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use App\Models\Post; | |
use App\Models\User; | |
use Illuminate\Support\Facades\Gate; | |
/** | |
* Register all authorization and authentication services. |
View policy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PostPolicy | |
{ | |
public function update(User $user) | |
{ | |
return $ $user->role == ‘admin’; |
View gate.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gate::define('can_post', function($user) { | |
return $user->role == 'admin'; | |
}); |
View .dockerignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#.dockerignore | |
.idea/ | |
.git/ | |
/node_modules | |
/.next/ | |
/out/ | |
/build |
NewerOlder