I'm facing a problem in uploading images to server in laravel 5, the problem is some images uploaded normally, and other images breaks the server, and I got this message
The specified URL cannot be found.
I'm using this route in routes.php
Route::any('/{lang}/REGISTER','createAccountController#index');
My class is :
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Foundation\Application;
use App\Http\Requests;
use Request;
use Route;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Lang;
use App\ImageCircleCrop;
class createAccountController extends Controller
{
public function index($lang,Request $request){
// process form data here
}
}
I don't get any error messages in server logs, in fact, the application does not reach the controller code at all. Any help?
New Update: I noticed that the problem occurs just for png images, submitting form with file of type png make a crash on the application. The route does not work after that, and I got the message: "The specified URL cannot be found". Is it something related to the server configuration, or with laravel configration?
Related
I am new to laravel and use the laravel 9.37v version. I have the following error message.
I created a blade template. I could view that blade template using view but after I tried to view that template using the controller I got this error message.
Target class [PagerConntroller] does not exist
Please check the spelling, if it is correct try to import the controller class in the Route. Im assuming the controller name is PagerConntroller and the function that you need to call is index so your web.php or api.php should be like :
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PagerConntroller;
Route::get('view',[PagerConntroller::class, 'index']);
Or else you can use the controllers without importing by simply uncommenting the namespace variable inside app/Providers/RouteServiceProvider.php line:29 the variable will look like protected $namespace = 'App\\Http\\Controllers'; then your route file should be like
<?php
use Illuminate\Support\Facades\Route;
Route::get('view','PagerConntroller#index');
If you tried both the ways and still the error persists kindly check your class name and the namespace as well
I try to set up kakao login to my Shopify store, but when I run the test I encountered this message error, what should I do? Thank you
The Cache facade doesn't live in the App\Http\Controllers namespace. If you do not include a use statement at the top of your PHP files for your classes, it is assumed the class does live in the same namespace.
The Laravel Cache facade lives in the Illuminate\Support\Facades namespace so at the top of your KakaoController with your other use statements, add the following:
use Illuminate\Support\Facades\Cache;
You must need to add "use Illuminate\Support\Facades\Cache;" on top of controller, middleware, command, event or blade files.
for example
<?php namespace App\Http\Controllers;
use Illuminate\Support\Facades\Cache;
class KaKaoController extends Controller {
...
or "use \Cache;"
im trying to deploy my laravel-project via forge and digitalocean. And while it is working perfectly fine in my local development enviroment, im having a hard time getting the laravel-websockets package running.
So while my "CruiseCrontroller" is functioning perfectly locally, somehow in production is giving me following error.
[2020-12-22 15:42:00] production.ERROR: Class 'App\Events\newRoom' not found {"exception":"[object] (Error(code: 0): Class 'App\\Events\newRoom' not found at /home/forge/default/app/Http/Controllers/CruiseController.php:49)
this is the mentioned line in the CruiseController:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use App\Events\newRoom;
use App\Events\RoomStatusUpdate;
use App\Room;
use App\Sailor;
use Carbon\Carbon;
class CruiseController extends Controller
{
public function newRoom(Request $request){
...
event(new NewRoom($room->channel_id));
}
...
I googled and searched through stackoverflow for 2h now and hope someone here can point me in the right direction. Thank you
Case is important in case sensitive filesystems. You import the following class:
use App\Events\newRoom;
while you should import
use App\Events\NewRoom;
The autoloader tries to find the newRoom.php file and fails to do it because the file with that name doesn't exist.
I'm new to GetStream API and have been trying to get it to install with Laravel. I have followed all the documentation on how to install it. However, now that I'm trying to do a simple add to a modal, I get this error.
The error im getting . Here is how my model looks .
Would love some guidance. Thank you!
The ActivityTrait needs to be imported before using it in Want model;
otherwise it's resolved in the current namespace.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use GetStream\StreamLaravel\Eloquent\ActivityTrait;
class Want extends Model {
use ActivityTrait;
#...
}
I'm new to Laravel. I just installed Laravel 5 and have been going through some video tutorials in order to learn how it works.
I want to use the User class as it seems like it is very useful. In my web.php (routes) file, I have:
use app\Models\User;
Route::get('/users', function (){
$users = User::all(); //select * from users
return $users;
});
I get the following error upon loading that route in my browser:
I have a User.php file placed in my app/Models/ directory, and also changed in my auth.php file for it to reference this.
There are countless questions like this online and I try the fixes but I can't seem to get it to work. Any ideas?
Thanks!
Remove Models from use statement. It's not directory... Model is in namespace App so use:
use App\User;
Namespace and Directory is completely different things...
Or if you want to use in directory app/Models go to User.php model file and change namespace from App to App\Models