mardi 28 février 2017

ModelNotFoundException in Builder.php line 129: No query results for model [Fully\Models\Package]

I am having trouble calling a controller and routing.

My route:

Route::group(array('prefix' => LaravelLocalization::getCurrentLocale()), function () {

Route::group(array('prefix' => '/admin',
                   'namespace' => 'Admin',
                   'middleware' => ['before', 'sentinel.auth', 'sentinel.permission'] ), function () { // auth = stop directly accessing admin


//      PACKAGE

    Route::resource('package', 'PackageController', array('before' => 'hasAccess:package'));
    Route::get('package/{id}/delete', array('as' => 'admin.package.delete',
        'uses' => 'PackageController@confirmDestroy', ))->where('id', '\d+');

My controller:

class PackageController extends Controller
{
protected $package;
protected $packageCategory;
protected $activity;
protected $destination;
protected $perPage;

public function __construct(PackageInterface $package, PackageCategoryInterface $packageCategory, ActivityInterface $activity, DestinationInterface $destination)
{
    //codes

}

public function index()
{
    //index codes
}

public function suggested()
{

    return view('backend.package.suggested');
}

My menu.blade.php

<a href=""> View all packages</a>
<a href=""> Add new package</a>   
<a href=""> Suggested package</a>

What I am trying to achieve: In the controller i created a new function suggested, which should return a view when the link is clicked in the menu.blade.php. However when I click on the link the url in the browser shows localhost/en/admin/package/suggested but at no veil throws an exception error as described above. I want to know if i can create a new function in the controller and call it or not? How do I make this run ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire