DDSameera

DDSameera

Member Since 4 Weeks Ago

Kiribathgoda

Experience Points
3,020
Total
Experience

1,980 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
1
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.

Level 1
3,020 XP
Nov
28
15 hours ago
Activity icon

Awarded Best Reply on Laravel 8 Force HTTPS Middleware Failed

I optimized my code . Here is the final result

xxxxx.conf

<VirtualHost *:80>
   ServerName http://samadhi.xxxx.com
   Redirect / https://samadhi.xxxx.com/login
</VirtualHost>

<VirtualHost *:443>
   DocumentRoot "/var/www/html/samadhi.xxxxx.com/public_html/public"
   ServerName samadhi.xxxxx.com:443
  
   SSLEngine on
   SSLCertificateFile /etc/pki/tls/certs/samadhi_xxxxx.com_com.crt
   SSLCertificateKeyFile /etc/ssl/private/samadhi.xxxxx.com.com.key
  
   <Directory /var/www/html/samadhi.xxxxx.com/public_html/public>
   Options -Indexes +FollowSymLinks
   AllowOverride All
   #Disable index view
   options -Indexes
   #hide a Specifuc File
   <Files .env>
      order allow,deny
      Deny from all
   </Files>
   </Directory>
   
   ErrorLog /var/www/html/samadhixxxxx.com/error.log
   CustomLog /var/www/html/samadhi.xxxxx.com/requests.log combined
</VirtualHost>

Activity icon

Replied to Laravel 8 Force HTTPS Middleware Failed

I optimized my code . Here is the final result

xxxxx.conf

<VirtualHost *:80>
   ServerName http://samadhi.xxxx.com
   Redirect / https://samadhi.xxxx.com/login
</VirtualHost>

<VirtualHost *:443>
   DocumentRoot "/var/www/html/samadhi.xxxxx.com/public_html/public"
   ServerName samadhi.xxxxx.com:443
  
   SSLEngine on
   SSLCertificateFile /etc/pki/tls/certs/samadhi_xxxxx.com_com.crt
   SSLCertificateKeyFile /etc/ssl/private/samadhi.xxxxx.com.com.key
  
   <Directory /var/www/html/samadhi.xxxxx.com/public_html/public>
   Options -Indexes +FollowSymLinks
   AllowOverride All
   #Disable index view
   options -Indexes
   #hide a Specifuc File
   <Files .env>
      order allow,deny
      Deny from all
   </Files>
   </Directory>
   
   ErrorLog /var/www/html/samadhixxxxx.com/error.log
   CustomLog /var/www/html/samadhi.xxxxx.com/requests.log combined
</VirtualHost>

Activity icon

Replied to Laravel 8 Force HTTPS Middleware Failed

@vixo , No worries. I modified my code . It works ! thanks for your guidance.

<VirtualHost *:443>
   DocumentRoot "/var/www/html/samadhi.xxxxx.com/public_html/public"
   ServerName samadhi.xxxxx.com:443
  
   SSLEngine on
   SSLCertificateFile /etc/pki/tls/certs/samadhi_xxxxx.com_com.crt
   SSLCertificateKeyFile /etc/ssl/private/samadhi.xxxxx.com.com.key
  
   <Directory /var/www/html/samadhi.xxxxx.com/public_html/public>
   Options -Indexes +FollowSymLinks
   AllowOverride All
   #Disable index view
   options -Indexes
   #hide a Specifuc File
   <Files .env>
      order allow,deny
      Deny from all
   </Files>
   </Directory>
   
   ErrorLog /var/www/html/samadhixxxxx.com/error.log
   CustomLog /var/www/html/samadhi.xxxxx.com/requests.log combined
</VirtualHost>


Activity icon

Replied to Laravel 8 Force HTTPS Middleware Failed

@vixo could you please provide full code.

Activity icon

Replied to Laravel 8 Force HTTPS Middleware Failed

This url is working wihout having any issues. i can see ssl apply to this url

https://samadhi.xxxxx.com/public/index.php/login

But i want to this kind of url

https://samadhi.xxxxx.com/public/login

Activity icon

Replied to Laravel 8 Force HTTPS Middleware Failed

@vixo , i didn't change anything in .htaccess file . i m dealing with virtual host file only

Still its not working :(

<VirtualHost *:80>
    ServerName samadhi.xxxx.com
    ServerAlias samadhi.xxxx.com
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/xxxx.com/public_html/public

    <Directory /var/www/html/xxxx.com/public_html/public>
        Options -Indexes +FollowSymLinks
        AllowOverride All
		Require all granted  
	 </Directory>

    ErrorLog /var/www/html/xxxx.com/error.log
    CustomLog /var/www/html/xxxx.com/requests.log combined
</VirtualHost>

Activity icon

Replied to Laravel 8 Force HTTPS Middleware Failed


<VirtualHost *:80>
    ServerName samadhi.xxxxxxxxx.com
    ServerAlias samadhi.xxxxxxxxx.com
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/samadhi.xxxxxxxxx.com/public_html

    <Directory /var/www/html/samadhi.xxxxxxxxx.com/public_html>
        Options -Indexes +FollowSymLinks
        AllowOverride All
		
		#Disable index view
			options -Indexes

		#hide a Specifuc File
			<Files .env>
			order allow,deny
			Deny from all
			</Files>
    </Directory>


</VirtualHost>
Activity icon

Replied to Laravel 8 Force HTTPS Middleware Failed

it redirects to https:// version , but login url not works. :(

Please note : i created virtual hosts in centos7 server. does it affect that ?

Activity icon

Started a new Conversation Laravel 8 Force HTTPS Middleware Failed

I installed SSL in my production server . and i want to setup laravel application on it.

I followed up this article https://robindirksen.nl/blog/laravel-redirect-to-https-a-middleware-to-force-https

But its failed. here is my codes

HTTPSProtocolMiddleware.php

<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class HttpsProtocolMiddleware
{

    public function handle(Request $request, Closure $next)
    {

        if (!$request->secure() && app()->environment('production')) {
            return redirect()->secure($request->getRequestUri());
        }

        return $next($request);
    }
}

env

...
APP_ENV=production
...

Result url

https://boobamba.com/lms/public/lms/public/login

I can see duplicate url pharase "/lms/public/lms/public"

please help me to resolve this

Activity icon

Replied to How To Build Up Securable App In Production Environment

#1. Secure Your .env file. DO NOT let it open in public people.

<VirtualHost *:80>
    ServerName samadhi.boobamba
    ServerAlias samadhi.boobamba
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/samadhi.boobamba.com/public_html

    <Directory /var/www/html/samadhi.boobamba.com/public_html>
        Options -Indexes +FollowSymLinks
        AllowOverride All
		
		#Disable index view
			options -Indexes

		#hide a Specifuc File
			<Files .env>
			order allow,deny
			Deny from all
			</Files>
    </Directory>

    ErrorLog /var/www/html/samadhi.boobamba.com/error.log
    CustomLog /var/www/html/samadhi.boobamba.com/requests.log combined
</VirtualHost>

#2. Set up SSL Certificate - (Recommended : Branded Cerficiate)

Activity icon

Started a new Conversation How To Build Up Securable App In Production Environment

Hey Genuis , this topic is really good for us. Once we setup our Application in production environment , we should have to protect our solution from hackers. Lets talk about all securable things need to be done from developer and server side.

Activity icon

Awarded Best Reply on Laravel 8 URL Is Not Working Without Index.php

@jlrdw Highly appreciate your effort at this moment.

I forgot to tell some thing . I m using Centos 7 production server. So @putheakhem , highlighted the vhost scenario. so i setup vhost and configuer it with my domain.

Solution Setup vhost in VPS server

Documentation https://linuxize.com/post/how-to-set-up-apache-virtual-hosts-on-centos-7/

After that everything has been resolved.

Now i can access without index.php URL

Thanks again for your time and effort. !!

Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

100% Agree with you @snapey . I saw so many articles guide to change server.php name into index.php , bla bla...that is damn wrong thing.

Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

@jlrdw , I want to protect this file. because everyone knows my credentials :(

https://snipboard.io/67Y1C4.jpg

Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

@jlrdw Highly appreciate your effort at this moment.

I forgot to tell some thing . I m using Centos 7 production server. So @putheakhem , highlighted the vhost scenario. so i setup vhost and configuer it with my domain.

Solution Setup vhost in VPS server

Documentation https://linuxize.com/post/how-to-set-up-apache-virtual-hosts-on-centos-7/

After that everything has been resolved.

Now i can access without index.php URL

Thanks again for your time and effort. !!

Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

@putheakhem , No , please help me to build it . my server is centos7

Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

@jlrdw - Just how many levels deep is public?

01

do i need to apply this for other places

<?php

use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Check If Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is maintenance / demo mode via the "down" command we
| will require this file so that any prerendered template can be shown
| instead of starting the framework, which could cause an exception.
|
*/

if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
    require __DIR__.'/../storage/framework/maintenance.php';
}

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/

require '/var/www/html/samadhi/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/

$app = require_once __DIR__.'/../bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = tap($kernel->handle(
    $request = Request::capture()
))->send();

$kernel->terminate($request, $response);

Nov
27
1 day ago
Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

@jlrdw , Now i created this URL Structure. Also i kept public folder as it is . however i can see .env file through this link www.boobamba.com/samadhi/.env

Here is my project url

http://boombamba.com/samadhi/

Here is my UPDATED project folder structure. https://snipboard.io/hTxaiA.jpg

Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

@jlrdw , you are right. i can see ".env" file information. (www.boobamba.com/samadhi/lms/.env) Okay i will setup laravel app as it is . my question , how could i remove "index.php" file from this url . it doesn't work :(

Please note : mod_rewrite module also enabled in my centos7 server

Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

@jlrdw , I moved all public folder data to root ones

http://boobamba.com/samadhi/lms/login is not working

http://boobamba.com/samadhi/lms/index.php/login is working

Please note : boobamba.com is sample name :)

Now i need to remove index.php from this url. Thanks for your help.But Both ones are failed

...

    RewriteEngine On
    RewriteBase /lms/

    ...
...

    RewriteEngine On
    RewriteBase /samadhi/lms/

    ...
Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

No I didn't modify anything. @jlrdw

Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

@jlrdw , this is VPS server not shared one.

Here is my URL Structure

www.boobamba.com/samadhi/lms www.boobamba.com/manchi/lms www.boobamba.com/oxford/lms

lms is laravel web folder . samadhi , machin,oxfords are company names.

Activity icon

Replied to Laravel 8 URL Is Not Working Without Index.php

@jlrdw

Here is my folder structure.

/var/www/html/samadhi/lms

samadhi sub domain folder

lms contains the laravel application

https://snipboard.io/VMdbQx.jpg

Activity icon

Started a new Conversation Laravel 8 URL Is Not Working Without Index.php

Hello Genius,

Please help me to resolve this . I hosted Laravel application on production environment. Now i got following issue .

Not Working http://boobamba.com/samadhi/stts/public/login

Working fine http://boobamba.com/samadhi/stts/public/index.php/login

htaccess file

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Activity icon

Started a new Conversation #1071 - Specified Key Was Too Long; Max Key Length Is 767 Bytes

I run "php artisan migrtate run" command ., then i got new database . Now i download mysql database and upload it to server. i got this error

#1071 - Specified key was too long; max key length is 767 bytes

https://snipboard.io/6lYRH0.jpg

Nov
26
2 days ago
Activity icon

Started a new Conversation How To Integrate Throttle In Custom Login Using Laravel 8

This is my code. Is this best practice ? i can see this messages in my logincontroller

https://snipboard.io/JzxRPb.jpg

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Validator;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
    */

    use AuthenticatesUsers;
    use ThrottlesLogins;
    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = RouteServiceProvider::HOME;
    protected $maxAttempts = 1; // Default is 5
    protected $decayMinutes = 2; // Default is 1

    /**
     * Create a new controller instance.
     *
     * @return void
     */


    public function __construct()
    {

        $this->middleware(['guest'])->except('logout');
    }

    public function username()
    {
        return 'mobile';
    }

    public function logout(Request $request)
    {
        $request->session()->flush();
        $request->session()->regenerate();
        Auth::logout();
        return redirect('/login');
    }


    public function login(Request $request)
    {


        if (method_exists($this, 'hasTooManyLoginAttempts') &&
            $this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }


        $credentials = $request->only('mobile', 'password');
        $response = request('recaptcha');

        $data = [
            "mobile" => $credentials['mobile'],
            "password" => $credentials['password']
        ];

        $rules = [
            'mobile' => 'required',
            'password' => 'required'
        ];


        $validator = Validator::make($data, $rules);

        if (!$validator->fails()) {

            if (Auth::attempt($credentials) && $this->checkValidGoogleRecaptchaV3($response)) {


                //success

            } else {
                //fail
                $this->incrementLoginAttempts($request);
                return redirect()->back()
                    ->withInput($request->all())
                    ->withErrors(['error' => 'Please check your username / password.']);

            }

        } else {
            return redirect('login')->withErrors($validator->errors())->withInput();
        }


    }


    public function checkValidGoogleRecaptchaV3($response)
    {
        $url = "https://www.google.com/recaptcha/api/siteverify";

        $data = [
            'secret' => "6Ldpye4ZAAAAAKwmjpgup8vWWRwzL9Sgx8mE782u",
            'response' => $response
        ];

        $options = [
            'http' => [
                'header' => 'Content-Type: application/x-www-form-urlencoded\r\n',
                'method' => 'POST',
                'content' => http_build_query($data)
            ]
        ];


        $context = stream_context_create($options);
        $result = file_get_contents($url, false, $context);
        $resultJson = json_decode($result);

        return $resultJson->success;


    }


}

Activity icon

Started a new Conversation Login Middleware Not Work In Laravel 8

When user login in to the system , it should be check "Valid Google recaptcha", if NOT , it should redirect to login page. so i used middleware for this. now it doesn't work

Middleware > checkGoogleRecaptcha.php

<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class CheckGoogleRecaptcha
{

    public function handle(Request $request, Closure $next)
    {

        $response = "WRONG_RESPONSE";


        if (!$this->checkValidGoogleRecaptchaV3($response)) {
            return redirect('/login');
        } else {
            return $next($request);
        }


    }


    public function checkValidGoogleRecaptchaV3($response)
    {
        $url = "https://www.google.com/recaptcha/api/siteverify";

        $data = [
            'secret' => "6Ldpye4ZAAAAAKwmjpgup8vWWRwzL9Sgx8mE782u",
            'response' => $response
        ];

        $options = [
            'http' => [
                'header' => 'Content-Type: application/x-www-form-urlencoded\r\n',
                'method' => 'POST',
                'content' => http_build_query($data)
            ]
        ];


        $context = stream_context_create($options);
        $result = file_get_contents($url, false, $context);
        $resultJson = json_decode($result);

        return $resultJson->success;


    }

}

Auth > verificationController.php

  public function __construct()
    {
   
        $this->middleware('check_google_recaptcha');
    }

web.php

Auth::routes();

Activity icon

Started a new Conversation How To Setup Google Recaptcha V2 Invisible Option In Laravel 8

How to setup Google Recaptcha v2 invisible option in laravel 8 ?

Is that possible to develop it without using plugin , if NO, please provide me reliable methods.

Nov
25
3 days ago
Activity icon

Awarded Best Reply on 3 Table Eloquent Query Build Up

@tisuchi i created it by my self

  $courseId = "1";
        $course = Course::with('meeting')->get()->find($courseId);
        $meetingUser = $course->meeting->users->first();
        $uniqueJoinUrl = $meetingUser->pivot->unique_join_url;
Activity icon

Started a new Conversation How To Change This Error Message ?

I want to change "Please check the form below for errors" message. could you please help me to do that ?

https://snipboard.io/Jw7H1z.jpg

Nov
24
4 days ago
Activity icon

Replied to Fetch 02 Many To Many Tables & 01 HasOne Table

@marianomoreyra Thanks mariano !! you saved my life !! :)

Activity icon

Replied to Fetch 02 Many To Many Tables & 01 HasOne Table

@marianomoreyra , thanks. i fixed it.

Could you please help me to resolve this ?

I filled details in the form and submit it

here are the result. i cannto see 'meeting_id result . what is that ?

C:\wamp64\www\lms\app\Http\Controllers\CourseController.php:185:string '2' (length=1)
C:\wamp64\www\lms\app\Http\Controllers\CourseController.php:210:
object(App\Models\Course)[1634]
  protected 'fillable' => 
    array (size=5)
      0 => string 'name' (length=4)
      1 => string 'description' (length=11)
      2 => string 'main_category_id' (length=16)
      3 => string 'sub_category_id' (length=15)
      4 => string 'meeting_id' (length=10)
  protected 'connection' => string 'mysql' (length=5)
  protected 'table' => string 'courses' (length=7)
  protected 'primaryKey' => string 'id' (length=2)
  protected 'keyType' => string 'int' (length=3)
  public 'incrementing' => boolean true
  protected 'with' => 
    array (size=0)
      empty
  protected 'withCount' => 
    array (size=0)
      empty
  protected 'perPage' => int 15
  public 'exists' => boolean true
  public 'wasRecentlyCreated' => boolean true
  protected 'attributes' => 
    array (size=7)
      'name' => string 'gdsg' (length=4)
      'description' => string 'dsadsf' (length=6)
      'main_category_id' => string '1' (length=1)
      'sub_category_id' => string '1' (length=1)
      'updated_at' => string '2020-11-25 01:52:19' (length=19)
      'created_at' => string '2020-11-25 01:52:19' (length=19)
      'id' => int 25
  protected 'original' => 
    array (size=7)
      'name' => string 'gdsg' (length=4)
      'description' => string 'dsadsf' (length=6)
      'main_category_id' => string '1' (length=1)
      'sub_category_id' => string '1' (length=1)
      'updated_at' => string '2020-11-25 01:52:19' (length=19)
      'created_at' => string '2020-11-25 01:52:19' (length=19)
      'id' => int 25

Save code

  $course = Course::create(
                [
                    'name' => $name,
                    'description' => $description,
                    'main_category_id' => $mainCategoryId,
                    'sub_category_id' => $subCategoryId,
                    'meeting_id' > $meetingId
                ]
            );


            $data = [
                'messageType' => 'success',
                'message' => 'Course Created  (Id:' . $course->id . ')',
                $course

            ];
Activity icon

Started a new Conversation Fetch 02 Many To Many Tables & 01 HasOne Table

Here is the scenario.

There are some courses in schoool.

One main category has several subCategory . one sub category has several courses. One course has ONE online meeting .

when i try to get results using this code. it gives multiple meetings . please help me to resolve this.

$data = Course::with(['mainCategory', 'subCategory', 'meeting'])->get();

https://snipboard.io/VrtcHv.jpg https://snipboard.io/pd7nzo.jpg

Activity icon

Replied to How To Set Login Page As A ROOT ? -Laravel 8

It redirects to the dashboard. no issues. @automica

Activity icon

Replied to How To Set Login Page As A ROOT ? -Laravel 8

Hey ! guys, i added this code. problem resolved. thanks !

Route::get('/',function(){
    return view('auth.login');
})->middleware(['auth']);
Activity icon

Started a new Conversation How To Set Login Page As A ROOT ? -Laravel 8

How to set Login screen as a ROOT url ?

I modified this code. but its failed

1st try- Failed

Route::get('/',LoginController::class,'login');

2nd attempt - failed

Route::get('/', function () {
    return view('/login');
});

3rd attempt - failed

Route::get('/', function () {
    return view('auth.login');
});

It shows

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The GET method is not supported for this route. Supported methods: HEAD.
Nov
23
5 days ago
Activity icon

Replied to 3 Table Eloquent Query Build Up

@tisuchi i created it by my self

  $courseId = "1";
        $course = Course::with('meeting')->get()->find($courseId);
        $meetingUser = $course->meeting->users->first();
        $uniqueJoinUrl = $meetingUser->pivot->unique_join_url;
Activity icon

Replied to 3 Table Eloquent Query Build Up

That is the nature of this project Sorry.

Nov
22
6 days ago
Activity icon

Started a new Conversation 3 Table Eloquent Query Build Up

User Model

   public function courses()
    {
        return $this->belongsToMany(Course::class);
    }

    public function meetings()
    {
        return $this->belongsToMany(Meeting::class)->withPivot('unique_join_url');
    }

Meeting Model

public function users()
    {
        return $this->belongsToMany(User::class)->withPivot('unique_join_url');
    }

Course Model


    public function users()
    {
        return $this->belongsToMany(User::class);
    }

    public function meeting(){
        return $this->belongsTo(Meeting::class,'meeting_id','id');

    }

I want to get Logged user's course meeting URL (Zoom Meeting URL)

Could you please help me ? to build up query in controller.

Activity icon

Replied to How To Retrieve Many To Many Table Data ? In Laravel

@michaloravec , thanks brother.

Controller Class

      //LessonMeetings
        $lessons = Lesson::with(['course', 'meeting'])->where('course_id',$id)->get();

Blade View

  @foreach($lessons as $lesson)
  <a class="btn btn-sm btn-primary" href="{{$lesson->meeting->join_url}}">
                                                    <i class="fa fa-video">ddd</i>
                                                </a>
@endforeach

Problem : {{$lesson->meeting->join_url}} returns NULL value

please help me to resolve this ?

Activity icon

Replied to How To Retrieve Many To Many Table Data ? In Laravel

@michaloravec , Thank for your assistance. hey ! master, i want to save loggedUser details in session . because time to time i need to check User Id . so how could i do that ?

Activity icon

Replied to How To Retrieve Many To Many Table Data ? In Laravel

@michaloravec , Sorry to bother you. this document resolved my problem . thank you again !!!

Activity icon

Replied to How To Retrieve Many To Many Table Data ? In Laravel

@michaloravec , There is pivot table called Meeting_User it gives us all meetings which are related with specific users.

https://snipboard.io/kUBytC.jpg

There is another extra column in that pivot table . it is unique_join_url , now i wanna get that value . simply says . i want to get all user related unique join urls .

 $data = User::with('meetings')->where('id', '=', '1')->first();
$data = $data->meetings;
$data>pivot;



It gives only 01 result . i want to get all meetings related with User='1'

Activity icon

Replied to How To Retrieve Many To Many Table Data ? In Laravel

Do i need to pass parameter for $query, could you please explain it ? please provide me documentation link