any one guide me how to do this
output come in view like this with student data
my model Student.php
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\Model;
class Student extends Model
{
protected $table = 'student_lists';
// protected $dates = ['certificate_issue_date','date_of_join','date_of_completion','dob'];
protected $fillable = ['student_name', 'student_registration_id', 'date_of_join', 'student_phone_no', 'student_photo' ];
}
my route
Route::any ( '/search', function () {
$q = Input::get ( 'q' );
$user = Student::where ( 'student_registration_id', 'LIKE', '%' . $q . '%' )->orWhere ( 'email', 'LIKE', '%' . $q . '%' )->get ();
if (count ( $user ) > 0)
return view ( 'my-search' )->withDetails ( $user )->withQuery ( $q );
else
return view ( 'my-search' )->withMessage ( 'No Details found. Try to search again !' );
} );
my view
{{ csrf_field() }} @if(isset($details))
The Search results for your query are :
Sample User details
Name Email Photo @foreach($details as $user) {{$user->name}} {{$user->email}} student_photo }}" class="img-circle" width="90" /> @endforeach @elseif(isset($message)){{$message}}
@endif