You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							41 lines
						
					
					
						
							858 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							41 lines
						
					
					
						
							858 B
						
					
					
				
								<?php
							 | 
						|
								
							 | 
						|
								namespace App\Http\Controllers;
							 | 
						|
								
							 | 
						|
								use Illuminate\Http\Request;
							 | 
						|
								use App\Models\Adjunct;
							 | 
						|
								
							 | 
						|
								class AdjunctController extends Controller
							 | 
						|
								{
							 | 
						|
								    public function __construct()
							 | 
						|
								    {
							 | 
						|
								        $this->middleware('auth');
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								    public function index()
							 | 
						|
								    {
							 | 
						|
								        $adjuncts = Adjunct::orderBy('name')->get();
							 | 
						|
								        return view('adjuncts')->with('adjuncts', $adjuncts);
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								   public function store(Request $request){
							 | 
						|
								        // validation
							 | 
						|
								        $this->validate($request,[
							 | 
						|
								            'name' => 'required',
							 | 
						|
								        ]);
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        // create project
							 | 
						|
								        $adjunct = new Adjunct;
							 | 
						|
								        $lastID = Adjunct::orderBy('id','desc')->value('id');
							 | 
						|
								        $adjunct->id = number_format($lastID) + 1;
							 | 
						|
								        $adjunct->name = $request->input('name');
							 | 
						|
								        $adjunct->save();
							 | 
						|
								
							 | 
						|
								        return redirect('/adjuncts')->with('success', 'Adjunct Added');
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								}
							 | 
						|
								
							 |