Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(ContactFormRequest $request)
 {
     $contact = new Contact();
     $contact->name = $request->get('fullname');
     $contact->phone = $request->get('phone');
     $contact->email = $request->get('email');
     $contact->content = $request->get('content');
     $contact->save();
     return redirect()->back()->with('Mess', 'Đã gửi thông tin thành công');
 }
Ejemplo n.º 2
0
 /**
  * @testdox Assets have zero or more Contacts.
  * @test
  */
 public function contacts()
 {
     $asset = new Asset();
     $asset->identifier = 'TEST123';
     $asset->save();
     $contact = new Contact();
     $contact->name = 'Bill';
     $contact->save();
     $asset->contacts()->attach($contact->id);
     $this->assertEquals(1, $asset->contacts->count());
     $this->assertEquals(1, $contact->assets->count());
 }
Ejemplo n.º 3
0
 public function createForAsset(Request $request)
 {
     // Get the Asset.
     $assetId = $request->input('asset_id');
     $asset = Asset::find($assetId);
     if (!$asset) {
         $this->alert('error', "No Asset #{$assetId}", false);
         return $this->view;
     }
     // Save the Contact.
     $contact = new Contact();
     $contact->name = $request->input('name');
     $contact->phone_1 = $request->input('phone_1');
     $contact->phone_2 = $request->input('phone_2');
     $contact->save();
     // Then connect the two.
     $asset->contacts()->attach($contact->id);
     return redirect("assets/{$asset->id}#contacts");
 }