Example #1
0
 /**
  * Overwrite the parent boot method
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     Ink::creating(function ($ink) {
         $ink->ink_added_user_id_fk = \Auth::user()->id;
         $ink->ink_modified_user_id_fk = \Auth::user()->id;
     });
     Material::updating(function ($ink) {
         $ink->ink_modified_user_id_fk = \Auth::user()->id;
     });
 }
Example #2
0
 /**
  * @test
  */
 public function material_edit_complete_form_submit_correct()
 {
     $this->visit('/ink/246/edit')->see('MTech MIS Login Screen');
     $user = User::find(46);
     $this->actingAs($user)->visit('/ink/246/edit')->type("ROTOLAM WHITE", 'ink_description')->type("White", 'ink_colour')->type("", 'ink_pantone')->select("reverse", 'ink_surface_reverse')->select("18", 'ink_supplier_id_fk')->select("1PC1057", 'ink_supplier_item_code')->press("Save")->assertSessionHas('flash');
     $this->assertResponseOk();
     $ink = Ink::find(246);
     $this->assertEquals('ROTOLAM WHITE', $ink->ink_description);
     $this->assertEquals('White', $ink->ink_colour);
     $this->assertEquals('', $ink->ink_pantone);
     $this->assertEquals('reverse', $ink->ink_surface_reverse);
     $this->assertEquals('18', $ink->ink_supplier_id_fk);
     $this->assertEquals('1PC1057', $ink->ink_supplier_item_code);
 }
Example #3
0
 /**
  * Delete the specified ink
  *
  * @param Ink $ink
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function destroy(Ink $ink)
 {
     $this->authorize('delete_ink');
     $ink->delete();
     flash()->success('Ink Deleted', 'The ink has been removed');
     return redirect('ink');
 }