Use translation
This commit is contained in:
parent
0190ccea27
commit
44503fc423
2 changed files with 4 additions and 5 deletions
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Events\NoteAdded;
|
|
||||||
use App\Models\Actionlog;
|
use App\Models\Actionlog;
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
@ -14,7 +13,6 @@ class NotesController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
// @todo: improve?
|
|
||||||
'id' => 'required',
|
'id' => 'required',
|
||||||
'note' => 'required|string|max:500',
|
'note' => 'required|string|max:500',
|
||||||
'type' => [
|
'type' => [
|
||||||
|
@ -27,7 +25,7 @@ class NotesController extends Controller
|
||||||
|
|
||||||
$this->authorize('update', $item);
|
$this->authorize('update', $item);
|
||||||
|
|
||||||
$logaction = new Actionlog();
|
$logaction = new Actionlog;
|
||||||
$logaction->item_id = $item->id;
|
$logaction->item_id = $item->id;
|
||||||
$logaction->item_type = get_class($item);
|
$logaction->item_type = get_class($item);
|
||||||
$logaction->note = $validated['note'];
|
$logaction->note = $validated['note'];
|
||||||
|
@ -38,6 +36,6 @@ class NotesController extends Controller
|
||||||
->route('hardware.show', $validated['id'])
|
->route('hardware.show', $validated['id'])
|
||||||
->withFragment('history')
|
->withFragment('history')
|
||||||
// @todo: translate
|
// @todo: translate
|
||||||
->with('success', 'Note Added!');
|
->with('success', trans('general.note_added'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ class CreateNotesTest extends TestCase
|
||||||
'type' => 'asset',
|
'type' => 'asset',
|
||||||
'note' => 'my special note',
|
'note' => 'my special note',
|
||||||
])
|
])
|
||||||
->assertRedirect(route('hardware.show', $asset->id) . '#history');
|
->assertRedirect(route('hardware.show', $asset->id) . '#history')
|
||||||
|
->assertSessionHas('success', trans('general.note_added'));
|
||||||
|
|
||||||
$this->assertDatabaseHas('action_logs', [
|
$this->assertDatabaseHas('action_logs', [
|
||||||
'created_by' => $actor->id,
|
'created_by' => $actor->id,
|
||||||
|
|
Loading…
Add table
Reference in a new issue