Esempio n. 1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $archives = Archive::select('year')->distinct()->get();
     foreach ($archives as $archive) {
         $archive['months'] = Archive::select('id', 'month')->where('year', $archive->year)->get()->toJson();
     }
     return $archives->toJson();
 }
Esempio n. 2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     // queries the clients db table, orders by client_name and lists client_name and id
     //$applications = DB::table('applications')->orderBy('id', 'asc')->lists('name','id');
     $applications = Application::lists('name', 'id');
     $archives = Archive::lists('name', 'id');
     return view('versions.create', array('applications' => $applications, 'archives' => $archives));
 }
Esempio n. 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy(Post $post)
 {
     $posts = Post::where('archive_id', $post->archive_id)->get();
     if (sizeof($posts) <= 1) {
         $post->delete();
         Archive::find($post->archive_id)->delete();
     } else {
         $post->delete();
     }
 }
Esempio n. 4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Archive::find($id)->delete();
     return redirect('archives');
 }