Vironeer

Member Since 1 Month Ago

Experience Points
890
Total
Experience

4,110 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 1
890 XP
Jan
16
1 day ago
Activity icon

Replied to SQLSTATE[HY000]: General Error: 1364 Field 'id' Doesn't Have A Default Value (SQL: Insert Into `users` Laravel 8

I'm doing it like that

$register = User::create([
            'name' => $request['name'],
            'email' => $request['email'],
            'password' => Hash::make($request['password']),
        ]);
Activity icon

Started a new Conversation SQLSTATE[HY000]: General Error: 1364 Field 'id' Doesn't Have A Default Value (SQL: Insert Into `users` Laravel 8

Migration

public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password')->nullable();;
            $table->rememberToken();
            $table->timestamps();
        });
    }

SQL

CREATE TABLE `users` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Dec
27
3 weeks ago
Activity icon

Started a new Conversation Dropzone If There Is Error Else How ?

if there is an error show it and stop upload else upload files

This code is working but when I upload images then I upload another type not image it shows the success message with the error message

const dropzone = new Dropzone(
            'div#img-drag-zone', {
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                url: url,
                method: 'post',
                paramName: 'uploads',
                maxFilesize: 10,
                maxFiles: 5,
                previewTemplate: previewTemplate,
                previewsContainer: "#img-preview-uploads",
                clickable: "div#img-upload-clickable",
                acceptedFiles: "image/png,image/jpeg, image/gif",
                init: function() {
                    this.on("error", function(file, response) {
                        dropzone.removeAllFiles(true);
                        $('.img-uploader-box').removeClass('d-none');
                        $('.img-reset-button').addClass('d-none');
                        swal("Opps !", response, {
                            icon: "error",
                            buttons: {
                                confirm: {
                                    className: 'btn btn-danger'
                                }
                            },
                        });
                    });
                    this.on('success', function() {
                        this.on("queuecomplete", function() {
                            Imgsuccess.removeClass('d-none');
                        });
                    });
                },
Dec
26
3 weeks ago
Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

I know I'm just testing know

Dec
25
3 weeks ago
Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

i change it to this one it's working but I get the all images in one

if ($request->hasfile('file')) {
            foreach ($request->file('file') as $file) {
                $string = md5(rand(1, 9999));
                $ext = $file->getClientOriginalExtension();
                $file_name = $string . '.' . $ext;
                $file->move(public_path('path/image/'), $file_name);
                $data[] = $file_name;
            }
        }

Response

["c494d9524143b2ebe567475e985c19f7.jpg","eb76c035d5d0a2bd2a0d0834b93c9c26.jpg","d5776aeecb3c45ab15adce6f5cb355f3.jpg"]
Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

By mistake im on the phone

Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

I do that and i get the same problem

Activity icon

Awarded Best Reply on The GET Method Is Not Supported For This Route. Supported Methods: POST.

This problem was on the server i fix it thanks for your answer

Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: POST.

This problem was on the server i fix it thanks for your answer

Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

I change it but i get the same problem Do you have any example can help

Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

Can you give me the code please

Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

The same problem it's giving the same name to all images

Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

i use $request->allFiles() and its working but its giving the same name to all files

Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

Then you will get the array with 0 object

Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

The problem is uploading multiple files not passing foreach

Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

Check it

    if ($request->hasFile('file')) {

        foreach ($request->file as $file) {
            $imageName = md5(time()) . '.' . $request->file->getclientoriginalextension();
            $imageNameArr[] = $imageName;
            $file->move(public_path('path/image/'), $imageName);
        }
    }
    return response()->json(array(
        'type' => 'success',
        'msg' => 'Uploaded successfully.',
        'data' => array(
            'id' => $imageNameArr, // This is the line 26
        )));
Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

Yes but where is the problem request file works

Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

{
    "message": "Undefined variable: imageNameArr",
    "exception": "ErrorException",
    "file": "C:\xampp\htdocs\img\app\Http\Controllers\Pages\UploadController.php",
    "line": 26,
    "trace": [
        {
            "file": "C:\xampp\htdocs\img\app\Http\Controllers\Pages\UploadController.php",
            "line": 26,
            "function": "handleError",
            "class": "Illuminate\Foundation\Bootstrap\HandleExceptions",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Routing\Controller.php",
            "line": 54,
            "function": "Upload",
            "class": "App\Http\Controllers\Pages\UploadController",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php",
            "line": 45,
            "function": "callAction",
            "class": "Illuminate\Routing\Controller",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Routing\Route.php",
            "line": 254,
            "function": "dispatch",
            "class": "Illuminate\Routing\ControllerDispatcher",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Routing\Route.php",
            "line": 197,
            "function": "runController",
            "class": "Illuminate\Routing\Route",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 692,
            "function": "run",
            "class": "Illuminate\Routing\Route",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 128,
            "function": "Illuminate\Routing\{closure}",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php",
            "line": 41,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\Routing\Middleware\SubstituteBindings",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php",
            "line": 78,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\VerifyCsrfToken",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php",
            "line": 49,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\View\Middleware\ShareErrorsFromSession",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php",
            "line": 121,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php",
            "line": 63,
            "function": "handleStatefulRequest",
            "class": "Illuminate\Session\Middleware\StartSession",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\Session\Middleware\StartSession",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php",
            "line": 37,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php",
            "line": 67,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\Cookie\Middleware\EncryptCookies",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 103,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 694,
            "function": "then",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 669,
            "function": "runRouteWithinStack",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 635,
            "function": "runRoute",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
            "line": 624,
            "function": "dispatchToRoute",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 166,
            "function": "dispatch",
            "class": "Illuminate\Routing\Router",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 128,
            "function": "Illuminate\Foundation\Http\{closure}",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php",
            "line": 27,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance.php",
            "line": 87,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\fruitcake\laravel-cors\src\HandleCors.php",
            "line": 37,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Fruitcake\Cors\HandleCors",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\fideloper\proxy\src\TrustProxies.php",
            "line": 57,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Fideloper\Proxy\TrustProxies",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
            "line": 103,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 141,
            "function": "then",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
            "line": 110,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "C:\xampp\htdocs\img\public\index.php",
            "line": 52,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        }
    ]
}

Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

dropzone.min.js:1 POST https://img.laravel.com/upload 500 (Internal Server Error)
value @ dropzone.min.js:1
value @ dropzone.min.js:1
(anonymous) @ dropzone.min.js:1
(anonymous) @ dropzone.min.js:1
transformFile @ dropzone.min.js:1
t @ dropzone.min.js:1
value @ dropzone.min.js:1
value @ dropzone.min.js:1
value @ dropzone.min.js:1
value @ dropzone.min.js:1
value @ dropzone.min.js:1
(anonymous) @ dropzone.min.js:1
setTimeout (async)
value @ dropzone.min.js:1
(anonymous) @ dropzone.min.js:1
accept @ dropzone.min.js:1
value @ dropzone.min.js:1
value @ dropzone.min.js:1
(anonymous) @ dropzone.min.js:1
Activity icon

Replied to Upload Multiple Images Laravel & Dropzone

No the same problem

Activity icon

Started a new Conversation Upload Multiple Images Laravel & Dropzone

Hi guys I want to upload multiple images using dropzone and laravel

Controller

public function Upload(Request $request)
    {

        if ($request->hasFile('file')) {

            foreach ($request->file as $file) {
                $imageName = md5(time()) . '.' . $request->file->getclientoriginalextension();
                $imageNameArr[] = $imageName;
                $request->file->move(public_path('path/image/'), $imageName);
            }
        }
        return response()->json(array(
            'type' => 'success',
            'msg' => 'Uploaded successfully.',
            'data' => array(
                'id' => $imageNameArr,
            )));

    }

Dropzone

const dropzone = new Dropzone(
            'div#img-uploader-box', {
                url: url,
                params: {
                    _token: token
                },
                method: 'post',
                paramName: 'file',
                maxFilesize: 10,
                parallelUploads: 5,
                maxFiles: 5,
                timeout: 50000,
                previewTemplate: previewTemplate,
                previewsContainer: "#upload-previews",
                clickable: "div#img-upload-clickable",
                acceptedFiles: "image/png,image/jpeg, image/gif"
            },
        );

Error Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Dec
23
3 weeks ago
Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: POST.

Like this

 <form action="{{route('update.website.info')}}" method="POST">
       // Here is my code
 </form>
Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: POST.

This one its for post data not get but when i click save i get error

Route::post('admin/site/information/update', [App\Http\Controllers\Admin\WebsiteSettingsController::class, 'UpdateInfo'])->name('update.website.info');
Activity icon

Started a new Conversation The GET Method Is Not Supported For This Route. Supported Methods: POST.

Hi guys I have a problem The GET method is not supported for this route. Supported methods: POST.

This is my routes


Route::get('admin/site', [App\Http\Controllers\Admin\WebsiteSettingsController::class, 'index']);

Route::post('admin/site/information/update', [App\Http\Controllers\Admin\WebsiteSettingsController::class, 'UpdateInfo'])->name('update.website.info');

Route::post('admin/site/logofav/update', [App\Http\Controllers\Admin\WebsiteSettingsController::class, 'Updatelogofav'])->name('update.website.logofav');

Route::post('admin/site/google/update', [App\Http\Controllers\Admin\WebsiteSettingsController::class, 'UpdateGoogleCaptcha'])->name('update.website.google');

Dec
20
4 weeks ago
Activity icon

Started a new Conversation No Scheduled Commands Are Ready To Run Laravel 8

Hi guys i have proble in laravel scheduler

when i change daily(); to everyMinute(); it works

but when i change it again to daily(); i get this No scheduled commands are ready to run

This is my code


 protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();
        $schedule->command('delete:jobs')->daily();
    }

Nov
27
1 month ago
Activity icon

Awarded Best Reply on Laravel Socialite Google Login Error Trying To Access Array Offset On Value Of Type Null

Solved using : php artisan config:clear

Activity icon

Started a new Conversation Laravel Socialite Google Login Error Trying To Access Array Offset On Value Of Type Null

I get this error when I try login using google

Trying to access array offset on value of type null

public function redirectToProvider(string $provider)
    {
        return Socialite::driver($provider)->redirect();
    }
Nov
19
1 month ago
Activity icon

Replied to I Want Share Data To All Views

Thank you so much :)

Activity icon

Replied to I Want Share Data To All Views

It gives me that

ErrorException Trying to get property 'id' of non-object

Activity icon

Replied to I Want Share Data To All Views

I try that but I'm still having the same problem

Activity icon

Replied to I Want Share Data To All Views

But $userId = Auth::user()->id; Will not working on service provider

Activity icon

Replied to I Want Share Data To All Views

Can you give me an example code using my code above

Activity icon

Replied to I Want Share Data To All Views

how i can share it from the controller to all views

Please check my code

Activity icon

Started a new Conversation I Want Share Data To All Views

I have this in my controller

I want share data to all views


public function index() {

        $userId = Auth::user()->id;

        $notice = DB::table('tickets')
                            ->where([['user_id', '=', $userId], ['notice', '=', 2]])
                            ->get();

        return view('pages.notifications', ['notice' => $notice]);

    }
}

Activity icon

Replied to Pass Data From Controller To Another View

Trying to get property 'id' of non-object

Activity icon

Replied to Pass Data From Controller To Another View

I'm still having a problem with that

Nov
18
1 month ago
Activity icon

Replied to Pass Data From Controller To Another View

I try but auth user is not working on AppServiceProvider

i use Auth::user()->id;

Error : Trying to get property 'id' of non-object

Activity icon

Started a new Conversation Pass Data From Controller To Another View

Hi guys!

I have a controller for another page

And i want to pass data from it to header

Activity icon

Replied to Get All Tickets With Count Replies

I do its working thank you so much

Activity icon

Replied to Get All Tickets With Count Replies

its working but how i can get total replies for each ticket

Activity icon

Replied to Get All Tickets With Count Replies

itry it but i get error SQLSTATE[42S22]: Column not found: 1054 Unknown column

Activity icon

Replied to How I Can Get All Tickets With Count Replies On It For The Current User

User

public function tickets() {
        
        return $this->hasMany('App\Models\Ticket');

    }

Ticket


    public function replies() {

     return $this->belongsTo('App\Models\Reply');

    }

Reply


    function user(){

        return $this->belongsTo('App\Models\User','user_id','id');

    }

Activity icon

Replied to Get All Tickets With Count Replies

This is my models

Ticket Model

public function replies() {

     return $this->belongsTo('App\Models\Reply');

    }

User Model

public function tickets() {
        
        return $this->hasMany('App\Models\Ticket');

    }
Activity icon

Replied to How I Can Get All Tickets With Count Replies On It For The Current User

I do not really understand the models

Can you give me an example code to get all tickets with replies count using where user_id = current user

Activity icon

Started a new Conversation Get All Tickets With Count Replies

Hi guys

I'm getting all tickets for each user using this code


$all_tickets = DB::table('tickets')
                            ->orderBy('id', 'DESC')
                            ->where([['user_id', '=', $userId], ])
                            ->paginate(10, ['*'], 'all');

And the user and admin can reply on the ticket and I want to count all replies and show them with ticket

This is my tables


CREATE TABLE `tickets` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` int(11) NOT NULL,
  `subject` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `priority` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `attachfile` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `status` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


CREATE TABLE `replies` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` int(11) NOT NULL,
  `ticket_id` int(11) NOT NULL,
  `replay_body` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `replay_file` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Activity icon

Replied to How I Can Get All Tickets With Count Replies On It For The Current User

i want get each user tickets and count the replies for each ticket

I get the tickets but i don't know how i should get replies and count them

This is the code that i use to get all tickets

$all_tickets = DB::table('tickets')
                            ->orderBy('id', 'DESC')
                            ->where([['user_id', '=', $userId], ])
                            ->paginate(10, ['*'], 'all');
Activity icon

Replied to Back To The Last Page ?

Use this

return redirect()->back();