What's the question?
Jan 21, 2016
5
Level 1
Call to show method changing where application looks for application resources
The call to index() works fine and produces html ex: http://sign.vm-host.net/scripts The call to show() will add "documents" to url ex: http://sign.vm-host.net/documents/scripts
public function index()
{
$documents = App\User::find(Auth::user()->id)->documents->where('parent_id','=',0)->toArray();
return view('documents.index', compact('documents'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
return 'Create';
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request['user_id'] = Auth::user()->id;
if ($request->bytes == null) {
$request->bytes = 0;
}
$document = new App\Document;
$document->user_id = $request->user_id;
$document->parent_id = $request->parent_id;
$document->type = $request->type;
$document->name = $request->name;
$document->bytes = $request->bytes;
$document->extension = $request->extension;
$document->storage_key = $request->storage_key;
$document->save();
}
public function show($id)
{
$documents = App\User::find(Auth::user()->id)->documents->where('parent_id','=',$id)->toArray();
return View::make('documents.index')->with('documents',$documents);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
return 'edit';
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
return 'update';
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
return 'destroy';
}
}
Level 1
The issue was actually in my layouts template ex: href="css*.css" like Snapey suggested. Easily corrected by href="{{ url('css*.css') }}"
jekinney...I am kinda new to oop. What is the problem using toArray()?
Please or to participate in this conversation.