-
app/Policies/TransactionPolicy.php
Open in GitHubuse App\Models\Transactions\Transaction; use App\Models\User; use Illuminate\Auth\Access\HandlesAuthorization; class TransactionPolicy { use HandlesAuthorization; public function show( User $user, Transaction $transaction ) { if( $user->id == $transaction->user_id ){ return true; }else{ return false; } } public function update( User $user, Transaction $transaction ) { if( $user->id == $transaction->user_id ){ return true; }else{ return false; } } }
-
app/Http/Controllers/Web/Transactions/TransactionsController.php
Open in GitHubuse App\Http\Controllers\Controller; class TransactionsController extends Controller { public function __construct() { // $this->middleware('can:show,transaction')->only('show'); $this->middleware('can:update,transaction')->only('update'); } // }