/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($slug, ActivitiesRepo $repo)
 {
     $activity = $repo->getBySlug($slug);
     if (!$activity) {
         abort(404);
     }
     // return $activity;
     return view('activities.show', compact('activity'));
 }
 public function store(Request $request, ActivitiesRepo $activities_repo)
 {
     if ($request->file('file')) {
         $activity = $activities_repo->getById($request->input('activity_id'));
         $this->up = new Up();
         $path = $this->up->uploadAttachment($request->file('file'));
         $activity->attachments()->create(['name' => $request->input('name'), 'activity_id' => $request->input('activity_id'), 'path' => $path]);
         flash()->success('Allegato caricato con successo.');
         return redirect('/admin/attivita/' . $request->input('activity_id') . '/modifica');
     }
     flash()->error('Il file è obligatorio.');
     return redirect()->back();
 }
示例#3
0
 function __construct(ActivitiesRepo $activities_repo)
 {
     view()->share('types', $activities_repo->types(true));
 }
示例#4
0
 public function loadMoreActivities(ActivitiesRepo $activities_repo)
 {
     $activities = $activities_repo->getAllFront(15);
     return ['layout' => view('home.partials.activities-partial', compact('activities'))->render(), 'url' => str_replace('/?', '?', $activities->nextPageUrl()), 'more' => $activities->hasMorePages(), 'galleries' => view('home.partials.activities-partial', compact('activities'))->render()];
 }
 /**
  * Remove the specified activity from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroyImage(Request $request, ActivitiesRepo $repo)
 {
     $image_id = $request->input('image_id');
     $delete = $repo->removeImage($image_id);
     return json_encode('true');
 }