public function testStaticSeed()
 {
     $name = 'User';
     $closure = function () {
     };
     $coreMock = $this->getMock('Woodling\\Core', array('seed'));
     $coreMock->expects($this->once())->method('seed')->with($this->equalTo($name), $this->isInstanceOf('Closure'));
     Woodling::core($coreMock);
     Woodling::seed($name, $closure);
 }
Пример #2
0
<?php

use Woodling\Woodling;
Woodling::seed('User', function ($blueprint) {
    $blueprint->sequence('email', function ($i) {
        return 'testing_' . $i . '@mail.net';
    });
    $blueprint->sequence('username', function ($i) {
        return 'test_' . $i;
    });
    $blueprint->password = '******';
    $blueprint->password_confirmation = 'password';
    $blueprint->confirmation_code = rand(100, 1000);
    $blueprint->confirmed = 1;
    $blueprint->status = 1;
});
Пример #3
0
<?php

use Woodling\Woodling;
use J20\Uuid;
use Carbon\Carbon;
Woodling::seed('Game 1', array('class' => 'Game', 'do' => function ($blueprint) {
    $blueprint->title = 'Mario Kart 8';
    $blueprint->image = 'assets/images/portfolio/vign4.jpg';
    $blueprint->slug = 'game-1';
    $blueprint->content = "Hola \n supu";
    $blueprint->meta_title = 'Game 1';
    $blueprint->meta_description = 'Game 1';
    $blueprint->meta_keywords = 'Game 1, console, game';
}));
Woodling::seed('Game 2', array('class' => 'Game', 'do' => function ($blueprint) {
    $blueprint->title = 'Game 2';
    $blueprint->image = 'assets/images/portfolio/game2.jpg';
    $blueprint->slug = 'game-2';
    $blueprint->meta_title = "Hola \n supu";
    $blueprint->content = 'body 2';
    $blueprint->meta_description = 'Game 2';
    $blueprint->meta_keywords = 'Game 2, console, game';
}));
Пример #4
0
<?php

use Woodling\Woodling;
use J20\Uuid;
use Carbon\Carbon;
Woodling::seed('UserAdmin', array('class' => 'User', 'do' => function ($blueprint) {
    $blueprint->username = '******';
    $blueprint->email = '*****@*****.**';
    $blueprint->confirmation_code = md5(uniqid(mt_rand(), true));
    $blueprint->confirmed = 1;
    $blueprint->created = Carbon::now();
    $blueprint->updated = Carbon::now()->addMonths(2);
    $blueprint->role = function () {
        return Woodling::retrieve('RoleAdmin');
    };
}));
Woodling::seed('UserUser', array('class' => 'User', 'do' => function ($blueprint) {
    $blueprint->username = '******';
    $blueprint->email = '*****@*****.**';
    $blueprint->confirmation_code = md5(uniqid(mt_rand(), true));
    $blueprint->confirmed = 1;
    $blueprint->created = Carbon::now();
    $blueprint->updated = Carbon::now()->addMonths(2);
    $blueprint->role = function () {
        return Woodling::retrieve('RoleComment');
    };
}));
Пример #5
0
<?php

use Woodling\Woodling;
Woodling::seed('RoleAdmin', array('class' => 'Role', 'do' => function ($blueprint) {
    $blueprint->id = 1;
    $blueprint->name = 'admin';
}));
Woodling::seed('RoleComment', array('class' => 'Role', 'do' => function ($blueprint) {
    $blueprint->id = 1;
    $blueprint->name = 'comment';
}));
Пример #6
0
<?php

use Woodling\Woodling;
use Carbon\Carbon;
Woodling::seed('Comment', array('class' => 'Comment', 'do' => function ($blueprint) {
    $blueprint->created_at = Carbon::now();
    $blueprint->updated_at = Carbon::now();
}));
Woodling::seed('CommentOld', array('class' => 'Comment', 'do' => function ($blueprint) {
    $blueprint->created_at = Carbon::now()->subWeeks(2);
    $blueprint->updated_at = Carbon::now()->subWeeks(2);
}));
Пример #7
0
<?php

use Woodling\Woodling;
Woodling::seed('Upload', function ($blueprint) {
    $blueprint->path = 'uploads';
    $blueprint->sequence('filename', function ($i) {
        return 'test-upload-' . $i . '.jpg';
    });
});
Пример #8
0
<?php

use Woodling\Woodling;
Woodling::seed('manage_posts', array('class' => 'Permission', 'do' => function ($blueprint) {
    $blueprint->id = 1;
    $blueprint->name = 'manage_posts';
    $blueprint->display_name = 'manage posts';
}));
Woodling::seed('manage_pages', array('class' => 'Permission', 'do' => function ($blueprint) {
    $blueprint->id = 2;
    $blueprint->name = 'manage_pages';
    $blueprint->display_name = 'manage pages';
}));
Woodling::seed('manage_users', array('class' => 'Permission', 'do' => function ($blueprint) {
    $blueprint->id = 3;
    $blueprint->name = 'manage_users';
    $blueprint->display_name = 'manage users';
}));
Woodling::seed('post_comment', array('class' => 'Permission', 'do' => function ($blueprint) {
    $blueprint->id = 4;
    $blueprint->name = 'post_comment';
    $blueprint->display_name = 'post_comment';
}));
<?php

use Woodling\Woodling;
use Carbon\Carbon;
Woodling::seed('Post', array('class' => 'Post', 'do' => function ($blueprint) {
    $blueprint->slug = 'in-iisque-similique-reprimique-eum';
    $blueprint->created_at = Carbon::now();
    $blueprint->updated_at = Carbon::now();
}));
Woodling::seed('PostOld', array('class' => 'Post', 'do' => function ($blueprint) {
    $blueprint->slug = 'in-iisque-similique-reprimique-eum';
    $blueprint->created_at = Carbon::now()->subWeeks(2);
    $blueprint->updated_at = Carbon::now()->subWeeks(2);
}));
Пример #10
0
<?php

use Woodling\Woodling;
Woodling::seed('Role', function ($blueprint) {
    $blueprint->sequence('name', function ($i) {
        return 'role_' . $i;
    });
});