Мне нужно создать проект CRM, проблема в том, что когда другой пользователь создал проект, проект будет отображаться в формах проекта всех пользователей. Как я могу получить проект аутентифицированных пользователей.
ЭТО МОЙ КОНТРОЛЛЕР
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Leads;
class LeadsController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$arr['leads'] = Leads::all();
return view('leads.index')->with($arr);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('leads.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request, Leads $leads)
{
$leads->Name = $request->Name;
$leads->Email = $request->Email;
$leads->Address = $request->Address;
$leads->contactnumber1 = $request->contactnumber1;
$leads->contactnumber2 = $request->contactnumber2;
$leads->contactnumber3 = $request->contactnumber3;
$leads->sourcelink = $request->sourcelink;
$leads->prevpublisher = $request->prevpublisher;
$leads->leadminer = $request->leadminer;
$leads->remarks = $request->remarks;
$leads->verifier = $request->verifier;
$leads->consultant = $request->consultant;
$leads->Save();
return redirect('leads');
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
ЭТО МОЙ ПРОСМОТР.
<table class="table table-bordered table-striped">
<tr>
<th>Name</th>
<th>Email</th>
<th>Address</th>
<th>ContactNo.</th>
<th>ContactNo.</th>
<th>ContactNo.</th>
<th>SourceLink</th>
<th>PrevPublisher</th>
<th>Leadminer</th>
<th>Remarks</th>
<th>Verifier</th>
<th>Consultant</th>
</tr>
@foreach($leads as $l)
<tr>
<td>{{ $l->Name }}</td>
<td>{{ $l->Email}}</td>
<td>{{ $l->Address }}</td>
<td>{{ $l->contactnumber1}}</td>
<td>{{ $l->contactnumber2 }}</td>
<td>{{ $l->contactnumber3 }}</td>
<td>{{ $l->sourcelink }}</td>
<td>{{ $l->prevpublisher }}</td>
<td>{{ $l->leadminer }}</td>
<td>{{ $l->verifier }}</td>
<td>{{ $l->consultant }}</td>
<td><a href="#" class="btn btn-info">Edit</a> <a href="" class="btn btn-danger">Delete</a></td>
</tr>
@endforeach
</table>