class OrderPresenter < SimpleDelegator
attr_reader :current_user
def initialize(order, current_user:)
super(order)
@current_user = current_user
<?php
use App\Http\Controllers\DocumentsController;
use Illuminate\Support\Facades\Route;
Route::middleware('auth')->group(function () {
class CommentsController < ApplicationController
before_action :set_post
def create
@comment = @post.comments.build(comment_params)
class Order < ApplicationRecord
has_many :line_items, dependent: :destroy, inverse_of: :order
accepts_nested_attributes_for :line_items,
reject_if: :all_blank,
allow_destroy: true
module Cacheable
extend ActiveSupport::Concern
def cache_query(prefix, scope, expires_in: 15.minutes)
key = [prefix, cache_version_token(scope)].join("/")
class SubscriptionsController < ApplicationController
before_action :set_subscription, only: %i[show destroy]
def new
@subscription = Subscription.new
end
class DownloadsController < ApplicationController
before_action :authenticate_user!
def show
report = current_account.reports.find(params[:report_id])
authorize! :download, report
class ArticlesController < ApplicationController
before_action :set_article, only: %i[edit update]
def new
@article = Article.new
end
<?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;
class User < ApplicationRecord
has_secure_password
RESET_TOKEN_TTL = 30.minutes
def self.reset_verifier
<?php
namespace App\Policies;
use App\Models\Post;
use App\Models\User;
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;