<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>laravel Target class Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/tag/laravel-target-class/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/tag/laravel-target-class/</link>
	<description>Code Solution</description>
	<lastBuildDate>Fri, 09 Apr 2021 06:37:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>

<image>
	<url>https://codeplaners.com/wp-content/uploads/2020/09/cropped-favicon-social-32x32.png</url>
	<title>laravel Target class Archives - Codeplaners</title>
	<link>https://codeplaners.com/tag/laravel-target-class/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Laravel 8 &#8211; Target class [PostController] does not exist</title>
		<link>https://codeplaners.com/laravel-8-target-class-postcontroller-does-not-exist/</link>
					<comments>https://codeplaners.com/laravel-8-target-class-postcontroller-does-not-exist/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 11 Mar 2021 20:00:15 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Laravel 8]]></category>
		<category><![CDATA[Controller]]></category>
		<category><![CDATA[laravel Target class]]></category>
		<category><![CDATA[Target class [PostController] does not exist]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=480</guid>

					<description><![CDATA[<p>This post was last updated on April 9th, 2021 at 06:37 amI would wish to share with you easy answer of &#8220;target class doesn&#8217;t exist laravel eight&#8221; and &#8220;laravel 8 Target class [Controller] doesn&#8217;t exist&#8221;. Just few days past launch laravel eight and that i was attempting produce&#124;to make&#124;to form} my initial application with laravel &#8230; <a href="https://codeplaners.com/laravel-8-target-class-postcontroller-does-not-exist/" class="more-link">Continue reading<span class="screen-reader-text"> "Laravel 8 &#8211; Target class [PostController] does not exist"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/laravel-8-target-class-postcontroller-does-not-exist/">Laravel 8 &#8211; Target class [PostController] does not exist</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="last-modified">This post was last updated on April 9th, 2021 at 06:37 am</p><p>I would wish to share with you easy answer of &#8220;target class doesn&#8217;t exist laravel eight&#8221; and &#8220;laravel 8 Target class [Controller] doesn&#8217;t exist&#8221;.</p>
<p>Just few days past launch laravel eight and that i was attempting produce|to make|to form} my initial application with laravel eight and after I create controller decision PostController and after I used with route then i found following issue:</p>
<p>&#8220;Target class[PostController] doesn&#8217;t exist&#8221;</p>
<p>you can see higher than image too.</p>
<p>Actually this can be not miscalculation however laravel eight removed default namespace kind RouteServiceProvider.php file. however i&#8217;ll say this smart feature if you wish to decision your controller category from completely different namespace.</p>
<p>but currently if you wish to trying to find answer then i&#8217;ll provide you with 2 answer. will|you&#8217;ll|you&#8217;ll be able to} use in route file otherwise you can outline default namespace on RouteServiceProvider.php file. let&#8217;s have a look at each answer one by one.</p>
<p><img decoding="async" src="https://codeplaners.com/wp-content/uploads/2021/03/post.jpg" alt="Laravel 8 - Target class [PostController] does not exist" ></p>
<h3>Answer 1: Use on Route File</h3>
<p><strong>routes/web.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

use Illuminate\Support\Facades\Route;
  
use App\Http\Controllers\PostController;
  
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the &quot;web&quot; middleware group. Now create something great!
|
*/
  
Route::get('/', function () {
    return view('welcome');
});
  
Route::get('posts', &#x5B;PostController::class, 'index']);
</pre>
<h3>Answer 2: Define in RouteServiceProvider</h3>
<p><strong>app/Providers/RouteServiceProvider.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

namespace App\Providers;

use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;

class RouteServiceProvider extends ServiceProvider
{
    /**
     * The path to the &quot;home&quot; route for your application.
     *
     * This is used by Laravel authentication to redirect users after login.
     *
     * @var string
     */
    public const HOME = '/home';
	protected $namespace = 'App\Http\Controllers';

    /**
     * The controller namespace for the application.
     *
     * When present, controller route declarations will automatically be prefixed with this namespace.
     *
     * @var string|null
     */
    // protected $namespace = 'App\\Http\\Controllers';

    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @return void
     */
    public function boot()
    {
        $this-&gt;configureRateLimiting();

        $this-&gt;routes(function () {
            Route::prefix('api')
                -&gt;middleware('api')
                -&gt;namespace($this-&gt;namespace)
                -&gt;group(base_path('routes/api.php'));

            Route::middleware('web')
                -&gt;namespace($this-&gt;namespace)
                -&gt;group(base_path('routes/web.php'));
        });
    }

    /**
     * Configure the rate limiters for the application.
     *
     * @return void
     */
    protected function configureRateLimiting()
    {
        RateLimiter::for('api', function (Request $request) {
            return Limit::perMinute(60)-&gt;by(optional($request-&gt;user())-&gt;id ?: $request-&gt;ip());
        });
    }
}
</pre>
<p><strong>routes/web.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

use Illuminate\Support\Facades\Route;
  
use App\Http\Controllers\PostController;
  
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the &quot;web&quot; middleware group. Now create something great!
|
*/
  
Route::get('/', function () {
    return view('welcome');
});
  
Route::get('posts', 'PostController@index');
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/laravel-8-target-class-postcontroller-does-not-exist/">Laravel 8 &#8211; Target class [PostController] does not exist</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/laravel-8-target-class-postcontroller-does-not-exist/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
