public function run() { $faker = Faker\Factory::create(); for ($i = 0; $i < 20; $i++) { Sends::create(['songname' => 'test', 'name' => $faker->name, 'singer' => $faker->name, 'email' => $faker->email, 'mp3' => "http://localhost:8000/upload/send/mp3/8 Days, 8 months, 8 hours.mp3"]); } }
public function sendDelete($id) { $send = Sends::find($id); \File::delete(public_path() . "/upload/send/image/" . $send->imagefilename); \File::delete(public_path() . "/upload/send/mp3/" . $send->mp3filename); $send->delete(); \Flash::info('Completed'); return Redirect::to('/backend/admin/ugsongs/request'); }
public function Ugsend($id) { $send = Sends::findOrNew($id); $music = \Input::get('music'); $name = $send->name; $data = array('send' => $send, 'music' => $music, 'name' => $name); \Mail::send('email.send', $data, function ($message) { $message->to(\Input::get('email'), "Myanmar Music Art UG Songs")->subject("Myanmar Music Art တြင္သီခ်င္းေတာင္းဆုိထားျခင္း"); }); \Flash::overlay('Mail Send Finish!', "Complete."); return \Redirect::to('/backend/admin/ugsongs/request'); }
public function apisend() { $mp3path = public_path() . '/upload/send/mp3'; $mp3name = \Input::file('mp3')->getClientOriginalname(); \Input::file('mp3')->move($mp3path, $mp3name); $imagepath = public_path() . '/upload/send/image'; $imagename = \Input::file('image')->getClientOriginalExtension(); $imgrename = str_random(20); $imgFileName = $imgrename . "." . $imagename; \Input::file('image')->move($imagepath, $imgrename . "." . $imagename); $send = new Sends(); $send->name = \Input::get('name'); $send->songname = \Input::get('songname'); $send->singer = \Input::get('singer'); $send->email = \Input::get('email'); $send->mp3 = asset('upload/send/mp3/' . $mp3name); $send->image = asset('upload/send/image/' . $imgFileName); $send->mp3filename = $mp3name; $send->imagefilename = $imgFileName; $send->save(); return \Redirect::to('/api/songs/send'); }