Ad
Namespace Issue In Model In Laravel - Package Development
I am developing a package in laravel
which uses model for CRUD operations.
I have put it up in packagist as well, but when I try to install it in laravel application and visit a route defined by the package, it says
Class 'Zusamarehan\Tourify\Model\Tourifies' not found
The following is the folder structure of my package
- rehan
- tourify
- src
- assets
- database
- Http
- Model
- Tourifies.php
- resources
- routes
- TourifyServiceProvider.php
- composer.json
- src
- tourify
The following is the contents of my Tourifies.php
<?php
namespace Zusamarehan\Tourify\Model;
use Illuminate\Database\Eloquent\Model;
class Tourifies extends Model
{
}
The following is my composer.json
file
{
"name": "zusamarehan/tourify",
"description": "A Package for adding Tour/Help to your Laravel Projects.",
"keywords": ["laravel", "tour", "tourify", "product-tour", "product-help"],
"type": "library",
"license": "MIT",
"authors": [
{
"name": "zusamarehan",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
},
"extra": {
"laravel": {
"providers": [
"Zusamarehan\\tourify\\TourifyServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Zusamarehan\\tourify\\": "src"
}
}
}
The Model class is not loading I suppose? I am not sure.
Can someone point out the mistake?
Ad
Answer
"Zusamarehan\\tourify\\": "src"
in your composer.json
is wrong. Needs uppercase T
. Looking at mine I also have a trailing /
after src
so you can try that as well.
You have the same lowercase t
in the provider.
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad