Skip to content

Commit

Permalink
Renewal generator stubs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jumilla committed Aug 28, 2016
1 parent d5222dd commit 8300dbe
Show file tree
Hide file tree
Showing 22 changed files with 167 additions and 65 deletions.
5 changes: 4 additions & 1 deletion sources/Generator.php
Expand Up @@ -611,14 +611,17 @@ protected function generateLaravel5Auth(FileGenerator $generator, array $propert
{
$generator->directory('classes', function ($generator) use ($properties) {
$generator->templateDirectory('Migrations', $properties);
$generator->keepDirectory('Seeds');

$generator->templateDirectory('Controllers', $properties);

$generator->templateDirectory('Middleware', $properties);

$generator->templateDirectory('Providers', $properties);

$generator->keepDirectory('Services');

$generator->keepDirectory('Seeds');

$generator->templateFile('User.php', $properties);
});

Expand Down
Expand Up @@ -4,9 +4,6 @@ namespace {$namespace};

use Illuminate\Console\Command;

/**
* Custom class
*/
class {$class} extends Command
{
/**
Expand Down
5 changes: 1 addition & 4 deletions stubs/generator/stubs/_controller-resource.stub
Expand Up @@ -6,9 +6,6 @@ use {$root_namespace}\Http\Controllers\Controller as BaseController;
use Illuminate\Http\Request;
use {$root_namespace}\Http\Requests;

/**
* Custom class
*/
class {$class} extends BaseController
{
/**
Expand Down Expand Up @@ -68,7 +65,7 @@ class {$class} extends BaseController
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_controller.stub
Expand Up @@ -6,9 +6,6 @@ use {$root_namespace}\Http\Controllers\Controller as BaseController;
use Illuminate\Http\Request;
use {$root_namespace}\Http\Requests;

/**
* Custom class
*/
class {$class} extends BaseController
{
//
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_event.stub
Expand Up @@ -6,9 +6,6 @@ use {$root_namespace}\Events\Event;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

/**
* Custom class
*/
class {$class} extends Event
{
use SerializesModels;
Expand Down
10 changes: 3 additions & 7 deletions stubs/generator/stubs/_job-queued.stub
Expand Up @@ -2,18 +2,14 @@

namespace {$namespace};

use {$root_namespace}\Jobs\Job;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;

/**
* Custom class
*/
class {$class} extends Job implements SelfHandling, ShouldQueue
class {$class} implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
use InteractsWithQueue, Queueable, SerializesModels;

/**
* Create a new job instance.
Expand Down
Expand Up @@ -2,14 +2,12 @@

namespace {$namespace};

use {$root_namespace}\Jobs\Job;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Bus\Queueable;

/**
* Custom class
*/
class {$class} extends Job implements SelfHandling
class {$class}
{
use Queueable;

/**
* Create a new job instance.
*
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_listener-queued.stub
Expand Up @@ -6,9 +6,6 @@ use {$root_namespace}\Events\{$event};
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

/**
* Custom class
*/
class {$class} implements ShouldQueue
{
use InteractsWithQueue;
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_listener.stub
Expand Up @@ -6,9 +6,6 @@ use {$root_namespace}\Events\{$event};
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

/**
* Custom class
*/
class {$class}
{
/**
Expand Down
33 changes: 33 additions & 0 deletions stubs/generator/stubs/_mail.stub
@@ -0,0 +1,33 @@
<?php

namespace {$namespace};

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

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

/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
{
//
}

/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('view.name');
}
}
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_middleware.stub
Expand Up @@ -4,9 +4,6 @@ namespace {$namespace};

use Closure;

/**
* Custom class
*/
class {$class}
{
/**
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_migration-create.stub
Expand Up @@ -6,9 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Jumilla\Versionia\Laravel\Support\Migration;

/**
* Custom class
*/
class {$class} extends Migration
{
/**
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_migration-update.stub
Expand Up @@ -6,9 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Jumilla\Versionia\Laravel\Support\Migration;

/**
* Custom class
*/
class {$class} extends Migration
{
/**
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_migration.stub
Expand Up @@ -6,9 +6,6 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Jumilla\Versionia\Laravel\Support\Migration;

/**
* Custom class
*/
class {$class} extends Migration
{
/**
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_model.stub
Expand Up @@ -4,9 +4,6 @@ namespace {$namespace};

use Illuminate\Database\Eloquent\Model;

/**
* Custom class
*/
class {$class} extends Model
{
/**
Expand Down
61 changes: 61 additions & 0 deletions stubs/generator/stubs/_notification.stub
@@ -0,0 +1,61 @@
<?php

namespace {$namespace};

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

class {$class} extends Notification
{
use Queueable;

/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
//
}

/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}

/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', 'https://laravel.com')
->line('Thank you for using our application!');
}

/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
59 changes: 59 additions & 0 deletions stubs/generator/stubs/_policy-model.stub
@@ -0,0 +1,59 @@
<?php

namespace {$namespace};

use Illuminate\Auth\Access\HandlesAuthorization;
use ${root_namespace}\User;
use ${root_namespace}\{$model};

class {$class}
{
use HandlesAuthorization;

/**
* Determine whether the user can view the dummyModelName.
*
* @param ${root_namespace}\User $user
* @param ${root_namespace}\{$model} $dummyModelName
* @return mixed
*/
public function view(User $user, {$model} $dummyModelName)
{
//
}

/**
* Determine whether the user can create dummyPluralModelName.
*
* @param ${root_namespace}\{$model} $user
* @return mixed
*/
public function create(User $user)
{
//
}

/**
* Determine whether the user can update the dummyModelName.
*
* @param ${root_namespace}\User $user
* @param ${root_namespace}\{$model}; $dummyModelName
* @return mixed
*/
public function update(User $user, {$model} $dummyModelName)
{
//
}

/**
* Determine whether the user can delete the dummyModelName.
*
* @param ${root_namespace}\User $user
* @param ${root_namespace}\{$model} $dummyModelName
* @return mixed
*/
public function delete(User $user, {$model} $dummyModelName)
{
//
}
}
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_policy.stub
Expand Up @@ -4,9 +4,6 @@ namespace {$namespace};

use Illuminate\Auth\Access\HandlesAuthorization;

/**
* Custom class
*/
class {$class}
{
use HandlesAuthorization;
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_provider.stub
Expand Up @@ -4,9 +4,6 @@ namespace {$namespace};

use Illuminate\Support\ServiceProvider;

/**
* Custom class
*/
class {$class} extends ServiceProvider
{
/**
Expand Down
7 changes: 2 additions & 5 deletions stubs/generator/stubs/_request.stub
Expand Up @@ -2,12 +2,9 @@

namespace {$namespace};

use {$root_namespace}\Http\Requests\Request;
use Illuminate\Foundation\Http\FormRequest;

/**
* Custom class
*/
class {$class} extends Request
class {$class} extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_seeder.stub
Expand Up @@ -6,9 +6,6 @@ use Illuminate\Database\Eloquent\Model;
use Jumilla\Versionia\Laravel\Support\Seeder;
use Carbon\Carbon;

/**
* Custom class
*/
class {$class} extends Seeder
{
/**
Expand Down
3 changes: 0 additions & 3 deletions stubs/generator/stubs/_test.stub
Expand Up @@ -4,9 +4,6 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
//use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

/**
* Custom class
*/
class {$class} extends TestCase
{
/**
Expand Down

0 comments on commit 8300dbe

Please sign in to comment.