请检查我以前在控制器中使用的代码:
class ObjectsPagesController extends Controller
{
public function destroy(Destroy $destroy, $id)
{
$objectsPage = ObjectsPages::with( 'ObjectsPagesRelation')->where('group_id', $id)->first();
if (isset($objectsPage)) {
$objectsPage->delete();
$objectsPage->ObjectsPagesRelation()->delete();
return redirect()->route('objects.pages.index')->with('success', 'done');
}else{
abort(404);
}
}
}
在我的请求页面上,我编写了以下代码:
class Destroy extends FormRequest
{
public function authorize()
{
return Auth::user()->can('del_objects_pages');
}
public function rules()
{
return [
//
];
}
}
我尝试下面的工匠命令
php artisan make:test Pages --unit`
但是laravel 5.5无法找到明确的指示下一步做什么?
答案 0 :(得分:0)
<?php
class StoreObjectPageTest extends TestCase
{
public function testStoreObjectIsCreated()
{
$this->actingAs($someUser)->post('/some/url');
$this->assertDatabaseHas('store_objects', [
// The attributes of a row you're expecting to see in DB
]);
}
}
?>