Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Commit

Permalink
Merge pull request #9 from prateekkarki/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
prateekkarki authored Feb 14, 2019
2 parents 5ced3c4 + 2e3d05b commit e2e0f62
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 18 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ This is a work in progress. Please check back later for complete package.
## Features
Generate and scaffold everything required for a basic laravel project. Starting with controllers, models, requests, views, assets, migrations, seeders, routes. More to be added in future releases.

## Usage

To be updated later.

## Install

Via Composer

``` bash
$ composer require prateekkarki/laragen
$ php artisan vendor:publish --provider="Prateekkarki\Laragen\LaragenServiceProvider"
```

## Usage

To be updated later.

``` bash
$ php artisan laragen:make
```

## Security

Expand Down
8 changes: 4 additions & 4 deletions src/Generators/Seeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ protected function getUsedModels(){

foreach ($foreignModels as $models) {
foreach($models as $column => $module){
$usedModels .= PHP_EOL . "use " . $namespace . $this->moduleToModelName($module) . ";";
$namespace = ($module == 'users' && class_exists('App\\User')) ? "App\\" : "App\\Models\\";
$class = $namespace . $this->moduleToModelName($module);
$usedModels .= PHP_EOL . "use " . $class . ";";
}
}
return $usedModels;
}

protected function getDataDefinition(){
$typeToDefinition = [];

$specialTypesToDefinition = [
'title' => 'title',
'title' => 'realText(50)',
'firstname' => 'firstname',
'lastname' => 'lastname',
'name' => 'name',
Expand Down
17 changes: 10 additions & 7 deletions src/resources/stubs/Views/_show.stub
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@
</div>
@endif
<div class="{{modelNameSingularLowercase}}-grid-info">
<h3 v-pre >{{ link_to_route('{{moduleName}}.show', ${{modelNameSingularLowercase}}->title, ${{modelNameSingularLowercase}}) }}</h3>
<h3>
<a href="{{ route('{{moduleName}}.show', ['slug' => ${{modelNameSingularLowercase}}->slug]) }}">
{{ ${{modelNameSingularLowercase}}->title }}
</a>
</h3>
<div class="{{modelNameSingularLowercase}}-single">
<p class="desc">
@if ($stripped{{modelNameSingularLowercase}}>260)
{{ substr($stripped{{modelNameSingularLowercase}}, 0, strpos($stripped{{modelNameSingularLowercase}}, ' ', 260)) }}...
@else
{{ $stripped{{modelNameSingularLowercase}} }}
@endif
{{ ${{modelNameSingularLowercase}}->content }}
</p>
{{ link_to_route('{{moduleName}}.show', 'Read More', ${{modelNameSingularLowercase}}) }}

<a href="{{ route('{{moduleName}}.show', ['slug' => ${{modelNameSingularLowercase}}->slug]) }}">
Read More
</a>
</div>
</div>
<div class="clear"> </div>
Expand Down
11 changes: 9 additions & 2 deletions src/resources/stubs/Views/show.stub
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@
@endif

<div class="{{modelNameSingularLowercase}}-grid-info">
<h3 v-pre >{{ link_to_route('{{moduleName}}.show', ${{modelNameSingularLowercase}}->title, ${{modelNameSingularLowercase}}) }}</h3>
<h3>
<a href="{{ route('{{moduleName}}.show', ['slug' => ${{modelNameSingularLowercase}}->slug]) }}">
{{ ${{modelNameSingularLowercase}}->title }}
</a>
</h3>
<div class="{{modelNameSingularLowercase}}-single">
<p class="desc">
{{ ${{modelNameSingularLowercase}}->content }}
</p>
{{ link_to_route('{{moduleName}}.show', 'Read More', ${{modelNameSingularLowercase}}) }}

<a href="{{ route('{{moduleName}}.show', ['slug' => ${{modelNameSingularLowercase}}->slug]) }}">
Read More
</a>
</div>
</div>
<div class="clear"> </div>
Expand Down

0 comments on commit e2e0f62

Please sign in to comment.