Skip to content

Commit

Permalink
add L11 stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Mar 8, 2024
1 parent c9a191c commit 67530ca
Show file tree
Hide file tree
Showing 18 changed files with 406 additions and 0 deletions.
14 changes: 14 additions & 0 deletions stubs/cast.inbound.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace {{ namespace }};

use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes;

class {{ class }} implements CastsInboundAttributes
{
public function set(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}
}
19 changes: 19 additions & 0 deletions stubs/cast.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace {{ namespace }};

use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;

class {{ class }} implements CastsAttributes
{
public function get(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}

public function set(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}
}
11 changes: 11 additions & 0 deletions stubs/class.invokable.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace {{ namespace }};

class {{ class }}
{
public function __invoke(): void
{

}
}
8 changes: 8 additions & 0 deletions stubs/class.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace {{ namespace }};

class {{ class }}
{

}
30 changes: 30 additions & 0 deletions stubs/controller.nested.singleton.api.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace {{ namespace }};

use {{ namespacedModel }};
use Illuminate\Http\Request;
use {{ namespacedParentModel }};

class {{ class }}
{
public function store(Request $request, {{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}

public function show({{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function update(Request $request, {{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function destroy({{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}
}
40 changes: 40 additions & 0 deletions stubs/controller.nested.singleton.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace {{ namespace }};

use {{ namespacedModel }};
use Illuminate\Http\Request;
use {{ namespacedParentModel }};

class {{ class }}
{
public function create({{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}

public function store(Request $request, {{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}

public function show({{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function edit({{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function update(Request $request, {{ parentModel }} ${{ parentModelVariable }})
{
//
}

public function destroy({{ parentModel }} ${{ parentModelVariable }}): never
{
abort(404);
}
}
29 changes: 29 additions & 0 deletions stubs/controller.singleton.api.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace {{ namespace }};

use {{ rootNamespace }}Http\Controllers\Controller;
use Illuminate\Http\Request;

class {{ class }} extends Controller
{
public function store(Request $request): never
{
abort(404);
}

public function show()
{
//
}

public function update(Request $request)
{
//
}

public function destroy(): never
{
abort(404);
}
}
39 changes: 39 additions & 0 deletions stubs/controller.singleton.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace {{ namespace }};

use {{ rootNamespace }}Http\Controllers\Controller;
use Illuminate\Http\Request;

class {{ class }} extends Controller
{
public function create(): never
{
abort(404);
}

public function store(Request $request): never
{
abort(404);
}

public function show()
{
//
}

public function edit()
{
//
}

public function update(Request $request)
{
//
}

public function destroy(): never
{
abort(404);
}
}
8 changes: 8 additions & 0 deletions stubs/enum.backed.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace {{ namespace }};

enum {{ class }}: {{ type }}
{
//
}
8 changes: 8 additions & 0 deletions stubs/enum.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace {{ namespace }};

enum {{ class }}
{
//
}
43 changes: 43 additions & 0 deletions stubs/markdown-mail.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace {{ namespace }};

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class {{ class }} extends Mailable
{
use Queueable;
use SerializesModels;

public function __construct()
{
//
}

public function envelope(): Envelope
{
return new Envelope(
subject: '{{ subject }}',
);
}

public function content(): Content
{
return new Content(
markdown: '{{ view }}',
);
}

/**
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}
35 changes: 35 additions & 0 deletions stubs/markdown-notification.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace {{ namespace }};

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class {{ class }} extends Notification
{
use Queueable;

public function __construct()
{
//
}

public function via(object $notifiable): array
{
return ['mail'];
}

public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)->markdown('{{ view }}');
}

public function toArray(object $notifiable): array
{
return [
//
];
}
}
38 changes: 38 additions & 0 deletions stubs/notification.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace {{ namespace }};

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class {{ class }} extends Notification
{
use Queueable;

public function __construct()
{
//
}

public function via(object $notifiable): array
{
return ['mail'];
}

public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}

public function toArray(object $notifiable): array
{
return [
//
];
}
}
8 changes: 8 additions & 0 deletions stubs/observer.plain.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace {{ namespace }};

class {{ class }}
{
//
}
33 changes: 33 additions & 0 deletions stubs/observer.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace {{ namespace }};

use {{ namespacedModel }};

class {{ class }}
{
public function created({{ model }} ${{ modelVariable }}): void
{
//
}

public function updated({{ model }} ${{ modelVariable }}): void
{
//
}

public function deleted({{ model }} ${{ modelVariable }}): void
{
//
}

public function restored({{ model }} ${{ modelVariable }}): void
{
//
}

public function forceDeleted({{ model }} ${{ modelVariable }}): void
{
//
}
}
15 changes: 15 additions & 0 deletions stubs/scope.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace {{ namespace }};

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;

class {{ class }} implements Scope
{
public function apply(Builder $builder, Model $model): void
{
//
}
}
Loading

0 comments on commit 67530ca

Please sign in to comment.