I am trying to show the related applications to abstract, I have used the code below but I am getting this error
Array to string conversion
My controller
public function show($A_ID){
$abstract = Project::find($A_ID);
// I believe the issue is caused by the line below but I am not sure what is wrong about it
$applications = Application::find($A_ID);
return view('Abstracts.show')->with('abstract', $abstract)
->with($applications);
}
My model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Traits\HasCompositePrimaryKey;
class Application extends Model{
//Table name
protected $table = 'student_application';
//composite key
protected $primaryKey = array('A_ID', 'S_ID');
protected $fillable = ['S_Justification' ];
public $incrementing = false;}
I want to note that the composite key is declared using this answer number two with currently 59 votes
For more information here is my view
@if (count($applications)>0)
@foreach ($applications as $application)
<tr>
<td><h5></h5></td>
</tr>
@endforeach
@else
<p> This project has no applications </p>
@endif
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2Al8MS5
via IFTTT
Aucun commentaire:
Enregistrer un commentaire