mardi 26 septembre 2017

how to route localhost with existing project id in Laravel 5.2

I am working with Laravel 5.2 and developing project management app. In My application I have project created form as new.blade.php in projects folder of view file. new.blade.php

<form class="form-vertical" role="form" method="post" action="">
 <div class="form-group">
                <label for="name" class="control-label">Name</label>
                <input type="text" name="name" class="form-control" id="name" value="">
                @if ($errors->has('name'))
                    <span class="help-block"></span>
                @endif
            </div>
<div class="form-group">
                <label for="notes" class="control-label">Notes</label>
                <textarea name="notes" class="form-control" id="notes" rows="10" cols="10">
                  
                </textarea>
                @if ($errors->has('notes'))
                    <span class="help-block"></span>
                @endif
            </div>
            <div class="form-group">
                <button type="submit" class="btn btn-default">Create</button>
            </div>
            <input type="hidden" name="_token" value="">
        </form>

this form data save in ProjectController

public function store(Request $request)
    {
        $this->validate($request, [
            'name'     => 'required|min:3',
            'notes'    => 'required|min:10',


        ]);

        $project = new Project;
        $project->project_name   = $request->input('name');
        $project->project_notes  = $request->input('notes');
        $project->user_id        = Auth::user()->id;

        $duplicate = Project::where('project_name',$project->project_name)->first();
        if($duplicate)
        {
            return redirect()->route('projects.index')->with('warning','Title already exists');
        }   

        $project->save();

now I need after save this project data redirect page to users.blade.php file witch situated same projects folder with ulr project id. as example

localhost:8000/project/10/users

how can I do this? need some help......



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2xtioKm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire