public function exportExcel($id) { $contact = Contact::whereId($id)->get(); Excel::create('Filename', function ($excel) use($contact) { $excel->sheet('a1', function ($sheet) use($contact) { $sheet->fromArray($contact); }); })->export('xls'); }
public function activate($id) { $contact = Contact::whereId($id)->first(); if ($contact) { if ($contact->active == 0) { $contact->active = 1; } else { $contact->active = 0; } $contact->save(); return Redirect::route('contact.index')->with('message', 'Correo actualizado'); } else { return Redirect::route('contact.index')->with('message', 'Error. Correo no encontrado'); } }