Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function store(Request $request)
- {
- Activity::create( $request->all() );
- $imgid = Activity::all()->last();
- if(Input::hasFile('files')){
- foreach(Input::file('files') as $file){
- $imageName = rand();
- $imageSur = $file->getClientOriginalExtension();
- $nameimg = $imageName.'.'.$imageSur;
- $file->move(base_path() . '/public/img/', $nameimg);
- $img = new Image;
- $img->image_name = $nameimg;
- $img->activities_id = $imgid->id;
- $img->save();
- echo base_path();
- }
- }
- return redirect('/activity');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement