Browse Source

wip: Change name attribute to title

pull/29/head
Nafies Luthfi 5 years ago
parent
commit
40bbca2feb
  1. 6
      src/stubs/controllers/api.stub
  2. 4
      src/stubs/controllers/full-formrequests.stub
  3. 6
      src/stubs/controllers/full.stub
  4. 6
      src/stubs/controllers/simple.stub
  5. 2
      src/stubs/database/factories/model-factory.stub
  6. 2
      src/stubs/database/migrations/migration-create.stub
  7. 8
      src/stubs/models/model-formfield.stub
  8. 8
      src/stubs/models/model.stub
  9. 2
      src/stubs/requests/create-request.stub
  10. 2
      src/stubs/requests/update-request.stub
  11. 2
      src/stubs/resources/lang/en/master.stub
  12. 2
      src/stubs/resources/lang/id/master.stub
  13. 8
      src/stubs/resources/views/full/create-bs3.stub
  14. 2
      src/stubs/resources/views/full/create-formfield-bs3.stub
  15. 2
      src/stubs/resources/views/full/create-formfield.stub
  16. 6
      src/stubs/resources/views/full/create.stub
  17. 12
      src/stubs/resources/views/full/edit-bs3.stub
  18. 6
      src/stubs/resources/views/full/edit-formfield-bs3.stub
  19. 6
      src/stubs/resources/views/full/edit-formfield.stub
  20. 10
      src/stubs/resources/views/full/edit.stub
  21. 4
      src/stubs/resources/views/full/index-bs3.stub
  22. 4
      src/stubs/resources/views/full/index-formfield-bs3.stub
  23. 4
      src/stubs/resources/views/full/index-formfield.stub
  24. 4
      src/stubs/resources/views/full/index.stub
  25. 2
      src/stubs/resources/views/full/show-bs3.stub
  26. 2
      src/stubs/resources/views/full/show-formfield-bs3.stub
  27. 2
      src/stubs/resources/views/full/show-formfield.stub
  28. 2
      src/stubs/resources/views/full/show.stub
  29. 20
      src/stubs/resources/views/simple/forms-bs3.stub
  30. 8
      src/stubs/resources/views/simple/forms-formfield-bs3.stub
  31. 8
      src/stubs/resources/views/simple/forms-formfield.stub
  32. 16
      src/stubs/resources/views/simple/forms.stub
  33. 4
      src/stubs/resources/views/simple/index-bs3.stub
  34. 4
      src/stubs/resources/views/simple/index-formfield-bs3.stub
  35. 4
      src/stubs/resources/views/simple/index-formfield.stub
  36. 4
      src/stubs/resources/views/simple/index.stub
  37. 58
      src/stubs/testcases/feature/api.stub
  38. 46
      src/stubs/testcases/feature/full.stub
  39. 54
      src/stubs/testcases/feature/simple.stub
  40. 8
      src/stubs/testcases/unit/model-formfield.stub
  41. 8
      src/stubs/testcases/unit/model.stub

6
src/stubs/controllers/api.stub

@ -16,7 +16,7 @@ class MasterController extends Controller
public function index()
{
$singleMstrQuery = Master::query();
$singleMstrQuery->where('name', 'like', '%'.request('q').'%');
$singleMstrQuery->where('title', 'like', '%'.request('q').'%');
$mstrCollections = $singleMstrQuery->paginate(25);
return $mstrCollections;
@ -33,7 +33,7 @@ class MasterController extends Controller
$this->authorize('create', new Master);
$newMaster = $request->validate([
'name' => 'required|max:60',
'title' => 'required|max:60',
'description' => 'nullable|max:255',
]);
$newMaster['creator_id'] = auth()->id();
@ -69,7 +69,7 @@ class MasterController extends Controller
$this->authorize('update', $singleMstr);
$singleMstrData = $request->validate([
'name' => 'required|max:60',
'title' => 'required|max:60',
'description' => 'nullable|max:255',
]);
$singleMstr->update($singleMstrData);

4
src/stubs/controllers/full-formrequests.stub

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers;
titlespace App\Http\Controllers;
use fullMstr;
use Illuminate\Http\Request;
@ -17,7 +17,7 @@ class MasterController extends Controller
public function index()
{
$singleMstrQuery = Master::query();
$singleMstrQuery->where('name', 'like', '%'.request('q').'%');
$singleMstrQuery->where('title', 'like', '%'.request('q').'%');
$mstrCollections = $singleMstrQuery->paginate(25);
return view('masters.index', compact('mstrCollections'));

6
src/stubs/controllers/full.stub

@ -15,7 +15,7 @@ class MasterController extends Controller
public function index()
{
$singleMstrQuery = Master::query();
$singleMstrQuery->where('name', 'like', '%'.request('q').'%');
$singleMstrQuery->where('title', 'like', '%'.request('q').'%');
$mstrCollections = $singleMstrQuery->paginate(25);
return view('masters.index', compact('mstrCollections'));
@ -44,7 +44,7 @@ class MasterController extends Controller
$this->authorize('create', new Master);
$newMaster = $request->validate([
'name' => 'required|max:60',
'title' => 'required|max:60',
'description' => 'nullable|max:255',
]);
$newMaster['creator_id'] = auth()->id();
@ -90,7 +90,7 @@ class MasterController extends Controller
$this->authorize('update', $singleMstr);
$singleMstrData = $request->validate([
'name' => 'required|max:60',
'title' => 'required|max:60',
'description' => 'nullable|max:255',
]);
$singleMstr->update($singleMstrData);

6
src/stubs/controllers/simple.stub

@ -16,7 +16,7 @@ class MasterController extends Controller
{
$editableMaster = null;
$singleMstrQuery = Master::query();
$singleMstrQuery->where('name', 'like', '%'.request('q').'%');
$singleMstrQuery->where('title', 'like', '%'.request('q').'%');
$mstrCollections = $singleMstrQuery->paginate(25);
if (in_array(request('action'), ['edit', 'delete']) && request('id') != null) {
@ -37,7 +37,7 @@ class MasterController extends Controller
$this->authorize('create', new Master);
$newMaster = $request->validate([
'name' => 'required|max:60',
'title' => 'required|max:60',
'description' => 'nullable|max:255',
]);
$newMaster['creator_id'] = auth()->id();
@ -59,7 +59,7 @@ class MasterController extends Controller
$this->authorize('update', $singleMstr);
$singleMstrData = $request->validate([
'name' => 'required|max:60',
'title' => 'required|max:60',
'description' => 'nullable|max:255',
]);
$singleMstr->update($singleMstrData);

2
src/stubs/database/factories/model-factory.stub

@ -13,7 +13,7 @@ class MasterFactory extends Factory
public function definition()
{
return [
'name' => $this->faker->word,
'title' => $this->faker->word,
'description' => $this->faker->sentence,
'creator_id' => function () {
return User::factory()->create()->id;

2
src/stubs/database/migrations/migration-create.stub

@ -15,7 +15,7 @@ class CreateMastersTable extends Migration
{
Schema::create('masters', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name', 60);
$table->string('title', 60);
$table->string('description')->nullable();
$table->unsignedBigInteger('creator_id');
$table->timestamps();

8
src/stubs/models/model-formfield.stub

@ -10,14 +10,14 @@ class Master extends Model
{
use HasFactory;
protected $fillable = ['name', 'description', 'creator_id'];
protected $fillable = ['title', 'description', 'creator_id'];
public function getNameLinkAttribute()
public function getTitleLinkAttribute()
{
return link_to_route('masters.show', $this->name, [$this], [
return link_to_route('masters.show', $this->title, [$this], [
'title' => __(
'app.show_detail_title',
['name' => $this->name, 'type' => __('master.master')]
['title' => $this->title, 'type' => __('master.master')]
),
]);
}

8
src/stubs/models/model.stub

@ -10,16 +10,16 @@ class Master extends Model
{
use HasFactory;
protected $fillable = ['name', 'description', 'creator_id'];
protected $fillable = ['title', 'description', 'creator_id'];
public function getNameLinkAttribute()
public function getTitleLinkAttribute()
{
$title = __('app.show_detail_title', [
'name' => $this->name, 'type' => __('master.master'),
'title' => $this->title, 'type' => __('master.master'),
]);
$link = '<a href="'.route('masters.show', $this).'"';
$link .= ' title="'.$title.'">';
$link .= $this->name;
$link .= $this->title;
$link .= '</a>';
return $link;

2
src/stubs/requests/create-request.stub

@ -25,7 +25,7 @@ class CreateRequest extends FormRequest
public function rules()
{
return [
'name' => 'required|max:60',
'title' => 'required|max:60',
'description' => 'nullable|max:255',
];
}

2
src/stubs/requests/update-request.stub

@ -24,7 +24,7 @@ class UpdateRequest extends FormRequest
public function rules()
{
return [
'name' => 'required|max:60',
'title' => 'required|max:60',
'description' => 'nullable|max:255',
];
}

2
src/stubs/resources/lang/en/master.stub

@ -28,6 +28,6 @@ return [
'undeleteable' => 'Master data cannot be deleted.',
// Attributes
'name' => 'Master Name',
'title' => 'Master Title',
'description' => 'Master Description',
];

2
src/stubs/resources/lang/id/master.stub

@ -28,6 +28,6 @@ return [
'undeleteable' => 'Data Master tidak dapat dihapus.',
// Attributes
'name' => 'Nama Master',
'title' => 'Judul Master',
'description' => 'Deskripsi Master',
];

8
src/stubs/resources/views/full/create-bs3.stub

@ -10,10 +10,10 @@
<form method="POST" action="{{ route('masters.store') }}" accept-charset="UTF-8">
{{ csrf_field() }}
<div class="panel-body">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="control-label">{{ __('master.name') }}</label>
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required>
{!! $errors->first('name', '<span class="help-block small">:message</span>') !!}
<div class="form-group{{ $errors->has('title') ? ' has-error' : '' }}">
<label for="title" class="control-label">{{ __('master.title') }}</label>
<input id="title" type="text" class="form-control" name="title" value="{{ old('title') }}" required>
{!! $errors->first('title', '<span class="help-block small">:message</span>') !!}
</div>
<div class="form-group{{ $errors->has('description') ? ' has-error' : '' }}">
<label for="description" class="control-label">{{ __('master.description') }}</label>

2
src/stubs/resources/views/full/create-formfield-bs3.stub

@ -9,7 +9,7 @@
<div class="panel-heading"><h3 class="panel-title">{{ __('master.create') }}</h3></div>
{{ Form::open(['route' => 'masters.store']) }}
<div class="panel-body">
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!}
{!! FormField::text('title', ['required' => true, 'label' => __('master.title')]) !!}
{!! FormField::textarea('description', ['label' => __('master.description')]) !!}
</div>
<div class="panel-footer">

2
src/stubs/resources/views/full/create-formfield.stub

@ -9,7 +9,7 @@
<div class="card-header">{{ __('master.create') }}</div>
{{ Form::open(['route' => 'masters.store']) }}
<div class="card-body">
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!}
{!! FormField::text('title', ['required' => true, 'label' => __('master.title')]) !!}
{!! FormField::textarea('description', ['label' => __('master.description')]) !!}
</div>
<div class="card-footer">

6
src/stubs/resources/views/full/create.stub

@ -11,9 +11,9 @@
{{ csrf_field() }}
<div class="card-body">
<div class="form-group">
<label for="name" class="form-label">{{ __('master.name') }} <span class="form-required">*</span></label>
<input id="name" type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" value="{{ old('name') }}" required>
{!! $errors->first('name', '<span class="invalid-feedback" role="alert">:message</span>') !!}
<label for="title" class="form-label">{{ __('master.title') }} <span class="form-required">*</span></label>
<input id="title" type="text" class="form-control{{ $errors->has('title') ? ' is-invalid' : '' }}" name="title" value="{{ old('title') }}" required>
{!! $errors->first('title', '<span class="invalid-feedback" role="alert">:message</span>') !!}
</div>
<div class="form-group">
<label for="description" class="form-label">{{ __('master.description') }}</label>

12
src/stubs/resources/views/full/edit-bs3.stub

@ -10,8 +10,8 @@
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ __('master.delete') }}</h3></div>
<div class="panel-body">
<label class="control-label text-primary">{{ __('master.name') }}</label>
<p>{{ $singleMstr->name }}</p>
<label class="control-label text-primary">{{ __('master.title') }}</label>
<p>{{ $singleMstr->title }}</p>
<label class="control-label text-primary">{{ __('master.description') }}</label>
<p>{{ $singleMstr->description }}</p>
{!! $errors->first('master_id', '<span class="form-error small">:message</span>') !!}
@ -34,10 +34,10 @@
<form method="POST" action="{{ route('masters.update', $singleMstr) }}" accept-charset="UTF-8">
{{ csrf_field() }} {{ method_field('patch') }}
<div class="panel-body">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="control-label">{{ __('master.name') }}</label>
<input id="name" type="text" class="form-control" name="name" value="{{ old('name', $singleMstr->name) }}" required>
{!! $errors->first('name', '<span class="help-block small">:message</span>') !!}
<div class="form-group{{ $errors->has('title') ? ' has-error' : '' }}">
<label for="title" class="control-label">{{ __('master.title') }}</label>
<input id="title" type="text" class="form-control" name="title" value="{{ old('title', $singleMstr->title) }}" required>
{!! $errors->first('title', '<span class="help-block small">:message</span>') !!}
</div>
<div class="form-group{{ $errors->has('description') ? ' has-error' : '' }}">
<label for="description" class="control-label">{{ __('master.description') }}</label>

6
src/stubs/resources/views/full/edit-formfield-bs3.stub

@ -10,8 +10,8 @@
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ __('master.delete') }}</h3></div>
<div class="panel-body">
<label class="control-label text-primary">{{ __('master.name') }}</label>
<p>{{ $singleMstr->name }}</p>
<label class="control-label text-primary">{{ __('master.title') }}</label>
<p>{{ $singleMstr->title }}</p>
<label class="control-label text-primary">{{ __('master.description') }}</label>
<p>{{ $singleMstr->description }}</p>
{!! $errors->first('master_id', '<span class="form-error small">:message</span>') !!}
@ -34,7 +34,7 @@
<div class="panel-heading"><h3 class="panel-title">{{ __('master.edit') }}</h3></div>
{{ Form::model($singleMstr, ['route' => ['masters.update', $singleMstr], 'method' => 'patch']) }}
<div class="panel-body">
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!}
{!! FormField::text('title', ['required' => true, 'label' => __('master.title')]) !!}
{!! FormField::textarea('description', ['label' => __('master.description')]) !!}
</div>
<div class="panel-footer">

6
src/stubs/resources/views/full/edit-formfield.stub

@ -10,8 +10,8 @@
<div class="card">
<div class="card-header">{{ __('master.delete') }}</div>
<div class="card-body">
<label class="control-label text-primary">{{ __('master.name') }}</label>
<p>{{ $singleMstr->name }}</p>
<label class="control-label text-primary">{{ __('master.title') }}</label>
<p>{{ $singleMstr->title }}</p>
<label class="control-label text-primary">{{ __('master.description') }}</label>
<p>{{ $singleMstr->description }}</p>
{!! $errors->first('master_id', '<span class="form-error small">:message</span>') !!}
@ -34,7 +34,7 @@
<div class="card-header">{{ __('master.edit') }}</div>
{{ Form::model($singleMstr, ['route' => ['masters.update', $singleMstr], 'method' => 'patch']) }}
<div class="card-body">
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!}
{!! FormField::text('title', ['required' => true, 'label' => __('master.title')]) !!}
{!! FormField::textarea('description', ['label' => __('master.description')]) !!}
</div>
<div class="card-footer">

10
src/stubs/resources/views/full/edit.stub

@ -10,8 +10,8 @@
<div class="card">
<div class="card-header">{{ __('master.delete') }}</div>
<div class="card-body">
<label class="form-label text-primary">{{ __('master.name') }}</label>
<p>{{ $singleMstr->name }}</p>
<label class="form-label text-primary">{{ __('master.title') }}</label>
<p>{{ $singleMstr->title }}</p>
<label class="form-label text-primary">{{ __('master.description') }}</label>
<p>{{ $singleMstr->description }}</p>
{!! $errors->first('master_id', '<span class="invalid-feedback" role="alert">:message</span>') !!}
@ -35,9 +35,9 @@
{{ csrf_field() }} {{ method_field('patch') }}
<div class="card-body">
<div class="form-group">
<label for="name" class="form-label">{{ __('master.name') }} <span class="form-required">*</span></label>
<input id="name" type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" value="{{ old('name', $singleMstr->name) }}" required>
{!! $errors->first('name', '<span class="invalid-feedback" role="alert">:message</span>') !!}
<label for="title" class="form-label">{{ __('master.title') }} <span class="form-required">*</span></label>
<input id="title" type="text" class="form-control{{ $errors->has('title') ? ' is-invalid' : '' }}" name="title" value="{{ old('title', $singleMstr->title) }}" required>
{!! $errors->first('title', '<span class="invalid-feedback" role="alert">:message</span>') !!}
</div>
<div class="form-group">
<label for="description" class="form-label">{{ __('master.description') }}</label>

4
src/stubs/resources/views/full/index-bs3.stub

@ -29,7 +29,7 @@
<thead>
<tr>
<th class="text-center">{{ __('app.table_no') }}</th>
<th>{{ __('master.name') }}</th>
<th>{{ __('master.title') }}</th>
<th>{{ __('master.description') }}</th>
<th class="text-center">{{ __('app.action') }}</th>
</tr>
@ -38,7 +38,7 @@
@foreach($mstrCollections as $key => $singleMstr)
<tr>
<td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td>
<td>{!! $singleMstr->name_link !!}</td>
<td>{!! $singleMstr->title_link !!}</td>
<td>{{ $singleMstr->description }}</td>
<td class="text-center">
@can('view', $singleMstr)

4
src/stubs/resources/views/full/index-formfield-bs3.stub

@ -26,7 +26,7 @@
<thead>
<tr>
<th class="text-center">{{ __('app.table_no') }}</th>
<th>{{ __('master.name') }}</th>
<th>{{ __('master.title') }}</th>
<th>{{ __('master.description') }}</th>
<th class="text-center">{{ __('app.action') }}</th>
</tr>
@ -35,7 +35,7 @@
@foreach($mstrCollections as $key => $singleMstr)
<tr>
<td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td>
<td>{{ $singleMstr->name_link }}</td>
<td>{{ $singleMstr->title_link }}</td>
<td>{{ $singleMstr->description }}</td>
<td class="text-center">
@can('view', $singleMstr)

4
src/stubs/resources/views/full/index-formfield.stub

@ -26,7 +26,7 @@
<thead>
<tr>
<th class="text-center">{{ __('app.table_no') }}</th>
<th>{{ __('master.name') }}</th>
<th>{{ __('master.title') }}</th>
<th>{{ __('master.description') }}</th>
<th class="text-center">{{ __('app.action') }}</th>
</tr>
@ -35,7 +35,7 @@
@foreach($mstrCollections as $key => $singleMstr)
<tr>
<td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td>
<td>{{ $singleMstr->name_link }}</td>
<td>{{ $singleMstr->title_link }}</td>
<td>{{ $singleMstr->description }}</td>
<td class="text-center">
@can('view', $singleMstr)

4
src/stubs/resources/views/full/index.stub

@ -29,7 +29,7 @@
<thead>
<tr>
<th class="text-center">{{ __('app.table_no') }}</th>
<th>{{ __('master.name') }}</th>
<th>{{ __('master.title') }}</th>
<th>{{ __('master.description') }}</th>
<th class="text-center">{{ __('app.action') }}</th>
</tr>
@ -38,7 +38,7 @@
@foreach($mstrCollections as $key => $singleMstr)
<tr>
<td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td>
<td>{!! $singleMstr->name_link !!}</td>
<td>{!! $singleMstr->title_link !!}</td>
<td>{{ $singleMstr->description }}</td>
<td class="text-center">
@can('view', $singleMstr)

2
src/stubs/resources/views/full/show-bs3.stub

@ -9,7 +9,7 @@
<div class="panel-heading"><h3 class="panel-title">{{ __('master.detail') }}</h3></div>
<table class="table table-condensed">
<tbody>
<tr><td>{{ __('master.name') }}</td><td>{{ $singleMstr->name }}</td></tr>
<tr><td>{{ __('master.title') }}</td><td>{{ $singleMstr->title }}</td></tr>
<tr><td>{{ __('master.description') }}</td><td>{{ $singleMstr->description }}</td></tr>
</tbody>
</table>

2
src/stubs/resources/views/full/show-formfield-bs3.stub

@ -9,7 +9,7 @@
<div class="panel-heading"><h3 class="panel-title">{{ __('master.detail') }}</h3></div>
<table class="table table-condensed">
<tbody>
<tr><td>{{ __('master.name') }}</td><td>{{ $singleMstr->name }}</td></tr>
<tr><td>{{ __('master.title') }}</td><td>{{ $singleMstr->title }}</td></tr>
<tr><td>{{ __('master.description') }}</td><td>{{ $singleMstr->description }}</td></tr>
</tbody>
</table>

2
src/stubs/resources/views/full/show-formfield.stub

@ -10,7 +10,7 @@
<div class="card-body">
<table class="table table-sm">
<tbody>
<tr><td>{{ __('master.name') }}</td><td>{{ $singleMstr->name }}</td></tr>
<tr><td>{{ __('master.title') }}</td><td>{{ $singleMstr->title }}</td></tr>
<tr><td>{{ __('master.description') }}</td><td>{{ $singleMstr->description }}</td></tr>
</tbody>
</table>

2
src/stubs/resources/views/full/show.stub

@ -10,7 +10,7 @@
<div class="card-body">
<table class="table table-sm">
<tbody>
<tr><td>{{ __('master.name') }}</td><td>{{ $singleMstr->name }}</td></tr>
<tr><td>{{ __('master.title') }}</td><td>{{ $singleMstr->title }}</td></tr>
<tr><td>{{ __('master.description') }}</td><td>{{ $singleMstr->description }}</td></tr>
</tbody>
</table>

20
src/stubs/resources/views/simple/forms-bs3.stub

@ -2,10 +2,10 @@
@can('create', new fullMstr)
<form method="POST" action="{{ route('masters.store') }}" accept-charset="UTF-8">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="control-label">{{ __('master.name') }}</label>
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required>
{!! $errors->first('name', '<span class="help-block small">:message</span>') !!}
<div class="form-group{{ $errors->has('title') ? ' has-error' : '' }}">
<label for="title" class="control-label">{{ __('master.title') }}</label>
<input id="title" type="text" class="form-control" name="title" value="{{ old('title') }}" required>
{!! $errors->first('title', '<span class="help-block small">:message</span>') !!}
</div>
<div class="form-group{{ $errors->has('description') ? ' has-error' : '' }}">
<label for="description" class="control-label">{{ __('master.description') }}</label>
@ -21,10 +21,10 @@
@can('update', $editableMaster)
<form method="POST" action="{{ route('masters.update', $editableMaster) }}" accept-charset="UTF-8">
{{ csrf_field() }} {{ method_field('patch') }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="control-label">{{ __('master.name') }}</label>
<input id="name" type="text" class="form-control" name="name" value="{{ old('name', $editableMaster->name) }}" required>
{!! $errors->first('name', '<span class="help-block small">:message</span>') !!}
<div class="form-group{{ $errors->has('title') ? ' has-error' : '' }}">
<label for="title" class="control-label">{{ __('master.title') }}</label>
<input id="title" type="text" class="form-control" name="title" value="{{ old('title', $editableMaster->title) }}" required>
{!! $errors->first('title', '<span class="help-block small">:message</span>') !!}
</div>
<div class="form-group{{ $errors->has('description') ? ' has-error' : '' }}">
<label for="description" class="control-label">{{ __('master.description') }}</label>
@ -46,8 +46,8 @@
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ __('master.delete') }}</h3></div>
<div class="panel-body">
<label class="control-label text-primary">{{ __('master.name') }}</label>
<p>{{ $editableMaster->name }}</p>
<label class="control-label text-primary">{{ __('master.title') }}</label>
<p>{{ $editableMaster->title }}</p>
<label class="control-label text-primary">{{ __('master.description') }}</label>
<p>{{ $editableMaster->description }}</p>
{!! $errors->first('master_id', '<span class="form-error small">:message</span>') !!}

8
src/stubs/resources/views/simple/forms-formfield-bs3.stub

@ -1,7 +1,7 @@
@if (Request::get('action') == 'create')
@can('create', new fullMstr)
{{ Form::open(['route' => 'masters.store']) }}
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!}
{!! FormField::text('title', ['required' => true, 'label' => __('master.title')]) !!}
{!! FormField::textarea('description', ['label' => __('master.description')]) !!}
{{ Form::submit(__('master.create'), ['class' => 'btn btn-success']) }}
{{ link_to_route('masters.index', __('app.cancel'), [], ['class' => 'btn btn-default']) }}
@ -11,7 +11,7 @@
@if (Request::get('action') == 'edit' && $editableMaster)
@can('update', $editableMaster)
{{ Form::model($editableMaster, ['route' => ['masters.update', $editableMaster], 'method' => 'patch']) }}
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!}
{!! FormField::text('title', ['required' => true, 'label' => __('master.title')]) !!}
{!! FormField::textarea('description', ['label' => __('master.description')]) !!}
@if (request('q'))
{{ Form::hidden('q', request('q')) }}
@ -37,8 +37,8 @@
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">{{ __('master.delete') }}</h3></div>
<div class="panel-body">
<label class="control-label text-primary">{{ __('master.name') }}</label>
<p>{{ $editableMaster->name }}</p>
<label class="control-label text-primary">{{ __('master.title') }}</label>
<p>{{ $editableMaster->title }}</p>
<label class="control-label text-primary">{{ __('master.description') }}</label>
<p>{{ $editableMaster->description }}</p>
{!! $errors->first('master_id', '<span class="form-error small">:message</span>') !!}

8
src/stubs/resources/views/simple/forms-formfield.stub

@ -1,7 +1,7 @@
@if (Request::get('action') == 'create')
@can('create', new fullMstr)
{{ Form::open(['route' => 'masters.store']) }}
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!}
{!! FormField::text('title', ['required' => true, 'label' => __('master.title')]) !!}
{!! FormField::textarea('description', ['label' => __('master.description')]) !!}
{{ Form::submit(__('master.create'), ['class' => 'btn btn-success']) }}
{{ link_to_route('masters.index', __('app.cancel'), [], ['class' => 'btn btn-link']) }}
@ -11,7 +11,7 @@
@if (Request::get('action') == 'edit' && $editableMaster)
@can('update', $editableMaster)
{{ Form::model($editableMaster, ['route' => ['masters.update', $editableMaster], 'method' => 'patch']) }}
{!! FormField::text('name', ['required' => true, 'label' => __('master.name')]) !!}
{!! FormField::text('title', ['required' => true, 'label' => __('master.title')]) !!}
{!! FormField::textarea('description', ['label' => __('master.description')]) !!}
@if (request('q'))
{{ Form::hidden('q', request('q')) }}
@ -37,8 +37,8 @@
<div class="card">
<div class="card-header">{{ __('master.delete') }}</div>
<div class="card-body">
<label class="control-label text-primary">{{ __('master.name') }}</label>
<p>{{ $editableMaster->name }}</p>
<label class="control-label text-primary">{{ __('master.title') }}</label>
<p>{{ $editableMaster->title }}</p>
<label class="control-label text-primary">{{ __('master.description') }}</label>
<p>{{ $editableMaster->description }}</p>
{!! $errors->first('master_id', '<span class="form-error small">:message</span>') !!}

16
src/stubs/resources/views/simple/forms.stub

@ -3,9 +3,9 @@
<form method="POST" action="{{ route('masters.store') }}" accept-charset="UTF-8">
{{ csrf_field() }}
<div class="form-group">
<label for="name" class="form-label">{{ __('master.name') }} <span class="form-required">*</span></label>
<input id="name" type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" value="{{ old('name') }}" required>
{!! $errors->first('name', '<span class="invalid-feedback" role="alert">:message</span>') !!}
<label for="title" class="form-label">{{ __('master.title') }} <span class="form-required">*</span></label>
<input id="title" type="text" class="form-control{{ $errors->has('title') ? ' is-invalid' : '' }}" name="title" value="{{ old('title') }}" required>
{!! $errors->first('title', '<span class="invalid-feedback" role="alert">:message</span>') !!}
</div>
<div class="form-group">
<label for="description" class="form-label">{{ __('master.description') }}</label>
@ -22,9 +22,9 @@
<form method="POST" action="{{ route('masters.update', $editableMaster) }}" accept-charset="UTF-8">
{{ csrf_field() }} {{ method_field('patch') }}
<div class="form-group">
<label for="name" class="form-label">{{ __('master.name') }} <span class="form-required">*</span></label>
<input id="name" type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" value="{{ old('name', $editableMaster->name) }}" required>
{!! $errors->first('name', '<span class="invalid-feedback" role="alert">:message</span>') !!}
<label for="title" class="form-label">{{ __('master.title') }} <span class="form-required">*</span></label>
<input id="title" type="text" class="form-control{{ $errors->has('title') ? ' is-invalid' : '' }}" name="title" value="{{ old('title', $editableMaster->title) }}" required>
{!! $errors->first('title', '<span class="invalid-feedback" role="alert">:message</span>') !!}
</div>
<div class="form-group">
<label for="description" class="form-label">{{ __('master.description') }}</label>
@ -46,8 +46,8 @@
<div class="card">
<div class="card-header">{{ __('master.delete') }}</div>
<div class="card-body">
<label class="form-label text-primary">{{ __('master.name') }}</label>
<p>{{ $editableMaster->name }}</p>
<label class="form-label text-primary">{{ __('master.title') }}</label>
<p>{{ $editableMaster->title }}</p>
<label class="form-label text-primary">{{ __('master.description') }}</label>
<p>{{ $editableMaster->description }}</p>
{!! $errors->first('master_id', '<span class="invalid-feedback" role="alert">:message</span>') !!}

4
src/stubs/resources/views/simple/index-bs3.stub

@ -29,7 +29,7 @@
<thead>
<tr>
<th class="text-center">{{ __('app.table_no') }}</th>
<th>{{ __('master.name') }}</th>
<th>{{ __('master.title') }}</th>
<th>{{ __('master.description') }}</th>
<th class="text-center">{{ __('app.action') }}</th>
</tr>
@ -38,7 +38,7 @@
@foreach($mstrCollections as $key => $singleMstr)
<tr>
<td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td>
<td>{{ $singleMstr->name }}</td>
<td>{{ $singleMstr->title }}</td>
<td>{{ $singleMstr->description }}</td>
<td class="text-center">
@can('update', $singleMstr)

4
src/stubs/resources/views/simple/index-formfield-bs3.stub

@ -26,7 +26,7 @@
<thead>
<tr>
<th class="text-center">{{ __('app.table_no') }}</th>
<th>{{ __('master.name') }}</th>
<th>{{ __('master.title') }}</th>
<th>{{ __('master.description') }}</th>
<th class="text-center">{{ __('app.action') }}</th>
</tr>
@ -35,7 +35,7 @@
@foreach($mstrCollections as $key => $singleMstr)
<tr>
<td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td>
<td>{{ $singleMstr->name }}</td>
<td>{{ $singleMstr->title }}</td>
<td>{{ $singleMstr->description }}</td>
<td class="text-center">
@can('update', $singleMstr)

4
src/stubs/resources/views/simple/index-formfield.stub

@ -26,7 +26,7 @@
<thead>
<tr>
<th class="text-center">{{ __('app.table_no') }}</th>
<th>{{ __('master.name') }}</th>
<th>{{ __('master.title') }}</th>
<th>{{ __('master.description') }}</th>
<th class="text-center">{{ __('app.action') }}</th>
</tr>
@ -35,7 +35,7 @@
@foreach($mstrCollections as $key => $singleMstr)
<tr>
<td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td>
<td>{{ $singleMstr->name }}</td>
<td>{{ $singleMstr->title }}</td>
<td>{{ $singleMstr->description }}</td>
<td class="text-center">
@can('update', $singleMstr)

4
src/stubs/resources/views/simple/index.stub

@ -29,7 +29,7 @@
<thead>
<tr>
<th class="text-center">{{ __('app.table_no') }}</th>
<th>{{ __('master.name') }}</th>
<th>{{ __('master.title') }}</th>
<th>{{ __('master.description') }}</th>
<th class="text-center">{{ __('app.action') }}</th>
</tr>
@ -38,7 +38,7 @@
@foreach($mstrCollections as $key => $singleMstr)
<tr>
<td class="text-center">{{ $mstrCollections->firstItem() + $key }}</td>
<td>{{ $singleMstr->name }}</td>
<td>{{ $singleMstr->title }}</td>
<td>{{ $singleMstr->description }}</td>
<td class="text-center">
@can('update', $singleMstr)

58
src/stubs/testcases/feature/api.stub

@ -20,7 +20,7 @@ class ManageMasterTest extends TestCase
'Authorization' => 'Bearer '.$user->api_token
]);
$this->seeJson(['name' => $singleMstr->name]);
$this->seeJson(['title' => $singleMstr->title]);
}
/** @test */
@ -29,21 +29,21 @@ class ManageMasterTest extends TestCase
$user = $this->createUser();
$this->postJson(route('api.masters.store'), [
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
], [
'Authorization' => 'Bearer '.$user->api_token
]);
$this->seeInDatabase('masters', [
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
]);
$this->seeStatusCode(201);
$this->seeJson([
'message' => __('master.created'),
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
]);
}
@ -51,18 +51,18 @@ class ManageMasterTest extends TestCase
private function getCreateFields(array $overrides = [])
{
return array_merge([
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
], $overrides);
}
/** @test */
public function validate_master_name_is_required()
public function validate_master_title_is_required()
{
$user = $this->createUser();
// name empty
$requestBody = $this->getCreateFields(['name' => '']);
// title empty
$requestBody = $this->getCreateFields(['title' => '']);
$this->postJson(
route('api.masters.store'),
$requestBody,
@ -70,16 +70,16 @@ class ManageMasterTest extends TestCase
);
$this->seeStatusCode(422);
$this->seeJsonStructure(['errors' => ['name']]);
$this->seeJsonStructure(['errors' => ['title']]);
}
/** @test */
public function validate_master_name_is_not_more_than_60_characters()
public function validate_master_title_is_not_more_than_60_characters()
{
$user = $this->createUser();
// name 70 characters
$requestBody = $this->getCreateFields(['name' => str_repeat('Test Title', 7)]);
// title 70 characters
$requestBody = $this->getCreateFields(['title' => str_repeat('Test Title', 7)]);
$this->postJson(
route('api.masters.store'),
$requestBody,
@ -87,7 +87,7 @@ class ManageMasterTest extends TestCase
);
$this->seeStatusCode(422);
$this->seeJsonStructure(['errors' => ['name']]);
$this->seeJsonStructure(['errors' => ['title']]);
}
/** @test */
@ -111,37 +111,37 @@ class ManageMasterTest extends TestCase
public function user_can_get_a_master_detail()
{
$user = $this->createUser();
$singleMstr = Master::factory()->create(['name' => 'Testing 123']);
$singleMstr = Master::factory()->create(['title' => 'Testing 123']);
$this->getJson(route('api.masters.show', $singleMstr), [
'Authorization' => 'Bearer '.$user->api_token
]);
$this->seeJson(['name' => 'Testing 123']);
$this->seeJson(['title' => 'Testing 123']);
}
/** @test */
public function user_can_update_a_master()
{
$user = $this->createUser();
$singleMstr = Master::factory()->create(['name' => 'Testing 123']);
$singleMstr = Master::factory()->create(['title' => 'Testing 123']);
$this->patchJson(route('api.masters.update', $singleMstr), [
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
], [
'Authorization' => 'Bearer '.$user->api_token
]);
$this->seeInDatabase('masters', [
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
]);
$this->seeStatusCode(200);
$this->seeJson([
'message' => __('master.updated'),
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
]);
}
@ -149,19 +149,19 @@ class ManageMasterTest extends TestCase
private function getEditFields(array $overrides = [])
{
return array_merge([
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
], $overrides);
}
/** @test */
public function validate_master_name_update_is_required()
public function validate_master_title_update_is_required()
{
$user = $this->createUser();
$singleMstr = Master::factory()->create();
// name empty
$requestBody = $this->getEditFields(['name' => '']);
// title empty
$requestBody = $this->getEditFields(['title' => '']);
$this->patchJson(
route('api.masters.update', $singleMstr),
$requestBody,
@ -169,17 +169,17 @@ class ManageMasterTest extends TestCase
);
$this->seeStatusCode(422);
$this->seeJsonStructure(['errors' => ['name']]);
$this->seeJsonStructure(['errors' => ['title']]);
}
/** @test */
public function validate_master_name_update_is_not_more_than_60_characters()
public function validate_master_title_update_is_not_more_than_60_characters()
{
$user = $this->createUser();
$singleMstr = Master::factory()->create();
// name 70 characters
$requestBody = $this->getEditFields(['name' => str_repeat('Test Title', 7)]);
// title 70 characters
$requestBody = $this->getEditFields(['title' => str_repeat('Test Title', 7)]);
$this->patchJson(
route('api.masters.update', $singleMstr),
$requestBody,
@ -187,14 +187,14 @@ class ManageMasterTest extends TestCase
);
$this->seeStatusCode(422);
$this->seeJsonStructure(['errors' => ['name']]);
$this->seeJsonStructure(['errors' => ['title']]);
}
/** @test */
public function validate_master_description_update_is_not_more_than_255_characters()
{
$user = $this->createUser();
$singleMstr = Master::factory()->create(['name' => 'Testing 123']);
$singleMstr = Master::factory()->create(['title' => 'Testing 123']);
// description 256 characters
$requestBody = $this->getEditFields(['description' => str_repeat('Long description', 16)]);

46
src/stubs/testcases/feature/full.stub

@ -17,13 +17,13 @@ class ManageMasterTest extends TestCase
$this->loginAsUser();
$this->visitRoute('masters.index');
$this->see($singleMstr->name);
$this->see($singleMstr->title);
}
private function getCreateFields(array $overrides = [])
{
return array_merge([
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
], $overrides);
}
@ -45,25 +45,25 @@ class ManageMasterTest extends TestCase
}
/** @test */
public function validate_master_name_is_required()
public function validate_master_title_is_required()
{
$this->loginAsUser();
// name empty
$this->post(route('masters.store'), $this->getCreateFields(['name' => '']));
$this->assertSessionHasErrors('name');
// title empty
$this->post(route('masters.store'), $this->getCreateFields(['title' => '']));
$this->assertSessionHasErrors('title');
}
/** @test */
public function validate_master_name_is_not_more_than_60_characters()
public function validate_master_title_is_not_more_than_60_characters()
{
$this->loginAsUser();
// name 70 characters
// title 70 characters
$this->post(route('masters.store'), $this->getCreateFields([
'name' => str_repeat('Test Title', 7),
'title' => str_repeat('Test Title', 7),
]));
$this->assertSessionHasErrors('name');
$this->assertSessionHasErrors('title');
}
/** @test */
@ -81,7 +81,7 @@ class ManageMasterTest extends TestCase
private function getEditFields(array $overrides = [])
{
return array_merge([
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
], $overrides);
}
@ -90,7 +90,7 @@ class ManageMasterTest extends TestCase
public function user_can_edit_a_master()
{
$this->loginAsUser();
$singleMstr = Master::factory()->create(['name' => 'Testing 123']);
$singleMstr = Master::factory()->create(['title' => 'Testing 123']);
$this->visitRoute('masters.show', $singleMstr);
$this->click('edit-master-'.$singleMstr->id);
@ -106,34 +106,34 @@ class ManageMasterTest extends TestCase
}
/** @test */
public function validate_master_name_update_is_required()
public function validate_master_title_update_is_required()
{
$this->loginAsUser();
$master = Master::factory()->create(['name' => 'Testing 123']);
$master = Master::factory()->create(['title' => 'Testing 123']);
// name empty
$this->patch(route('masters.update', $master), $this->getEditFields(['name' => '']));
$this->assertSessionHasErrors('name');
// title empty
$this->patch(route('masters.update', $master), $this->getEditFields(['title' => '']));
$this->assertSessionHasErrors('title');
}
/** @test */
public function validate_master_name_update_is_not_more_than_60_characters()
public function validate_master_title_update_is_not_more_than_60_characters()
{
$this->loginAsUser();
$master = Master::factory()->create(['name' => 'Testing 123']);
$master = Master::factory()->create(['title' => 'Testing 123']);
// name 70 characters
// title 70 characters
$this->patch(route('masters.update', $master), $this->getEditFields([
'name' => str_repeat('Test Title', 7),
'title' => str_repeat('Test Title', 7),
]));
$this->assertSessionHasErrors('name');
$this->assertSessionHasErrors('title');
}
/** @test */
public function validate_master_description_update_is_not_more_than_255_characters()
{
$this->loginAsUser();
$master = Master::factory()->create(['name' => 'Testing 123']);
$master = Master::factory()->create(['title' => 'Testing 123']);
// description 256 characters
$this->patch(route('masters.update', $master), $this->getEditFields([

54
src/stubs/testcases/feature/simple.stub

@ -17,7 +17,7 @@ class ManageMasterTest extends TestCase
$this->loginAsUser();
$this->visitRoute('masters.index');
$this->see($singleMstr->name);
$this->see($singleMstr->title);
}
/** @test */
@ -30,14 +30,14 @@ class ManageMasterTest extends TestCase
$this->seeRouteIs('masters.index', ['action' => 'create']);
$this->submitForm(__('master.create'), [
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
]);
$this->seeRouteIs('masters.index');
$this->seeInDatabase('masters', [
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
]);
}
@ -45,31 +45,31 @@ class ManageMasterTest extends TestCase
private function getCreateFields(array $overrides = [])
{
return array_merge([
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
], $overrides);
}
/** @test */
public function validate_master_name_is_required()
public function validate_master_title_is_required()
{
$this->loginAsUser();
// name empty
$this->post(route('masters.store'), $this->getCreateFields(['name' => '']));
$this->assertSessionHasErrors('name');
// title empty
$this->post(route('masters.store'), $this->getCreateFields(['title' => '']));
$this->assertSessionHasErrors('title');
}
/** @test */
public function validate_master_name_is_not_more_than_60_characters()
public function validate_master_title_is_not_more_than_60_characters()
{
$this->loginAsUser();
// name 70 characters
// title 70 characters
$this->post(route('masters.store'), $this->getCreateFields([
'name' => str_repeat('Test Title', 7),
'title' => str_repeat('Test Title', 7),
]));
$this->assertSessionHasErrors('name');
$this->assertSessionHasErrors('title');
}
/** @test */
@ -88,21 +88,21 @@ class ManageMasterTest extends TestCase
public function user_can_edit_a_master_within_search_query()
{
$this->loginAsUser();
$singleMstr = Master::factory()->create(['name' => 'Testing 123']);
$singleMstr = Master::factory()->create(['title' => 'Testing 123']);
$this->visitRoute('masters.index', ['q' => '123']);
$this->click('edit-master-'.$singleMstr->id);
$this->seeRouteIs('masters.index', ['action' => 'edit', 'id' => $singleMstr->id, 'q' => '123']);
$this->submitForm(__('master.update'), [
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
]);
$this->seeRouteIs('masters.index', ['q' => '123']);
$this->seeInDatabase('masters', [
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
]);
}
@ -110,40 +110,40 @@ class ManageMasterTest extends TestCase
private function getEditFields(array $overrides = [])
{
return array_merge([
'name' => 'Master 1 name',
'title' => 'Master 1 title',
'description' => 'Master 1 description',
], $overrides);
}
/** @test */
public function validate_master_name_update_is_required()
public function validate_master_title_update_is_required()
{
$this->loginAsUser();
$master = Master::factory()->create(['name' => 'Testing 123']);
$master = Master::factory()->create(['title' => 'Testing 123']);
// name empty
$this->patch(route('masters.update', $master), $this->getEditFields(['name' => '']));
$this->assertSessionHasErrors('name');
// title empty
$this->patch(route('masters.update', $master), $this->getEditFields(['title' => '']));
$this->assertSessionHasErrors('title');
}
/** @test */
public function validate_master_name_update_is_not_more_than_60_characters()
public function validate_master_title_update_is_not_more_than_60_characters()
{
$this->loginAsUser();
$master = Master::factory()->create(['name' => 'Testing 123']);
$master = Master::factory()->create(['title' => 'Testing 123']);
// name 70 characters
// title 70 characters
$this->patch(route('masters.update', $master), $this->getEditFields([
'name' => str_repeat('Test Title', 7),
'title' => str_repeat('Test Title', 7),
]));
$this->assertSessionHasErrors('name');
$this->assertSessionHasErrors('title');
}
/** @test */
public function validate_master_description_update_is_not_more_than_255_characters()
{
$this->loginAsUser();
$master = Master::factory()->create(['name' => 'Testing 123']);
$master = Master::factory()->create(['title' => 'Testing 123']);
// description 256 characters
$this->patch(route('masters.update', $master), $this->getEditFields([

8
src/stubs/testcases/unit/model-formfield.stub

@ -12,17 +12,17 @@ class MasterTest extends TestCase
use RefreshDatabase;
/** @test */
public function a_master_has_name_link_attribute()
public function a_master_has_title_link_attribute()
{
$singleMstr = Master::factory()->create();
$this->assertEquals(
link_to_route('masters.show', $singleMstr->name, [$singleMstr], [
link_to_route('masters.show', $singleMstr->title, [$singleMstr], [
'title' => __(
'app.show_detail_title',
['name' => $singleMstr->name, 'type' => __('master.master')]
['title' => $singleMstr->title, 'type' => __('master.master')]
),
]), $singleMstr->name_link
]), $singleMstr->title_link
);
}

8
src/stubs/testcases/unit/model.stub

@ -12,19 +12,19 @@ class MasterTest extends TestCase
use RefreshDatabase;
/** @test */
public function a_master_has_name_link_attribute()
public function a_master_has_title_link_attribute()
{
$singleMstr = Master::factory()->create();
$title = __('app.show_detail_title', [
'name' => $singleMstr->name, 'type' => __('master.master'),
'title' => $singleMstr->title, 'type' => __('master.master'),
]);
$link = '<a href="'.route('masters.show', $singleMstr).'"';
$link .= ' title="'.$title.'">';
$link .= $singleMstr->name;
$link .= $singleMstr->title;
$link .= '</a>';
$this->assertEquals($link, $singleMstr->name_link);
$this->assertEquals($link, $singleMstr->title_link);
}
/** @test */

Loading…
Cancel
Save