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.
		
		
		
		
		
			
		
			
				
					
					
						
							39 lines
						
					
					
						
							908 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							39 lines
						
					
					
						
							908 B
						
					
					
				| <?php | |
| 
 | |
| namespace App\Http\Controllers; | |
| 
 | |
| use Illuminate\Http\Request; | |
| use App\Leann; | |
| class LeannController extends Controller | |
| { | |
|     public function __construct() | |
|     { | |
|         $this->middleware('auth'); | |
|     } | |
| 
 | |
| 
 | |
|     public function index() | |
|     { | |
|         $project = Leann::where('user_id', auth()->user()->id)->get(); | |
|         return view('home')->with('projects', $project); | |
|     } | |
| 
 | |
|     public function store(Request $request){ | |
|         // validation | |
|         $this->validate($request,[ | |
|             'project_name' => 'required', | |
|             'description'  => 'required' | |
|         ]); | |
| 
 | |
| 
 | |
|         // create project | |
|         $project = new Leann; | |
|         $project->name = $request->input('project_name'); | |
|         $project->description = $request->input('description'); | |
|         $project->user_id = auth()->user()->id; | |
| 
 | |
|         $project->save(); | |
| 
 | |
|         return redirect('/home')->with('success', 'Project Added'); | |
|     } | |
| }
 |