cola

Member Since 3 Months Ago

Experience Points
1,700
Total
Experience

3,300 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
1,700 XP
Jan
12
1 week ago
Activity icon

Replied to How Can I Add Flash Message In Delete Action?

Visual studio code shows error for Session::flash() . use Session; is still at top.

Activity icon

Started a new Conversation Is It Possible To See Raw Sql Query?

Bill::with(['user', 'project'])->get();

Is it possible to see raw sql query of this?

Activity icon

Replied to How Can I Add Flash Message In Delete Action?

Undefined type Session. How can I include/use it at top of controller?

Activity icon

Started a new Conversation How Can I Add Flash Message In Delete Action?

$request->session()->flash('message', 'Project deleted successfully.');

$request is not defined in delete action. How can I add flash message in delete action?

Jan
11
1 week ago
Activity icon

Started a new Conversation Is Auth Installed By Default With Laravel 8?

I have not installed jetstream or any starter kit. But this routing works:

Route::get('/dashboard', [UserController::class, 'dashboard'])->name('dashboard')->middleware('auth');

Why does ->middleware('auth') work? Is auth installed by default with Laravel 8?

Jan
04
2 weeks ago
Activity icon

Replied to Is It Possible Not To Use Jetstream Or Any Authentication Starter Kit? When Do We Need Jetstream?

Route::get('/adduser', [UserController::class, 'adduser'])->name('adduser')->middleware('auth');

Is it called own authentication? What is middleware('auth') here?

Activity icon

Started a new Conversation Is It Possible Not To Use Jetstream Or Any Authentication Starter Kit? When Do We Need Jetstream?

I have like this in web.php and it is working fine. I have not installed jetstream.

Route::get('/adduser', [UserController::class, 'adduser'])->name('adduser')->middleware('auth');

Is it possible not to use jetstream or any authentication starter kit? When do we need jetstream?

Jan
01
3 weeks ago
Activity icon

Replied to How Can I Save Request Data Into Database At Once?

User::create($request->only(['firstName', 'lastname', 'email', 'password']));

How will 'firstName' map with $obj->first_name column?

Activity icon

Started a new Conversation How Can I Save Request Data Into Database At Once?

What I did:

        $obj=new User();
        $obj->first_name=$request->input('firstName');
        $obj->last_name=$request->input('lastName');
        $obj->email=$request->input('email');
        $obj->password=bcrypt($request->input('password'));
        $obj->save();

Is it possible to do something in this way instead of getting single input by $request->input()?

        $obj=new User();
        $obj->save($request->all());
Dec
30
3 weeks ago
Activity icon

Started a new Conversation Is It Possible To Use Jetstream Without Livewire Or Inertia?

composer require laravel/jetstream

This will install jetstream. I do not want to install livewire or inertia. I want to use a template like architecht ui. Is it possible?

Dec
29
3 weeks ago
Activity icon

Replied to Why Do I Get "Page Expired" With Laravel Login Method In Postman?

It looks, the csrf token in body is valid and postman adds laravel_session automatically from Application>Cookies>laravel_session.

Activity icon

Started a new Conversation Why Do I Get "Page Expired" With Laravel Login Method In Postman?

It is a post request with url: http://app.project.test/login. I have installed laravel jetstream.

In postman, in body tab:

{
    "_token": "68brjeiC2lRO4Hbo8hWUrnUQlkiAmlCkqlBJie30",
    "email": "[email protected]",
    "password": "[email protected]"
}

After clicking 'Send' button I get "Page Expired" error. Why do I get "Page Expired" with laravel login method in postman?

Nov
25
1 month ago
Activity icon

Started a new Conversation How Can I Add Selected="selected" In Option Tag?

I tried this:

<select class="form-control">
    <option v-for="option in allroles" v-bind:key="option.id" v-bind:value="option.id">                
          {{ option.name }}
    </option>
</select>

How can I add selected="selected" in option tag?

Nov
24
2 months ago
Activity icon

Replied to How Can I Login Through Postman?

POST method and url is:

app.project.test/login
Activity icon

Started a new Conversation How Can I Login Through Postman?

I have installed laravel 8 with authentication. How can I login through postman? I have tried putting values in body of postman.

{
    "_token": "PYGlTfL9fOIu6dr7ToJRFacZArY0NCqIssYC8v8Y",
    "email": "[email protected]",
    "password": "secret"
}

But I got 419-Page Expired error. How can I solve this problem?

Activity icon

Replied to Access To XMLHttpRequest At From Origin Has Been Blocked By CORS Policy: No 'Access-Control-Allow-Origin' Header Is Present On The Requested Resource.

cors.php has these

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Cross-Origin Resource Sharing (CORS) Configuration
    |--------------------------------------------------------------------------
    |
    | Here you may configure your settings for cross-origin resource sharing
    | or "CORS". This determines what cross-origin operations may execute
    | in web browsers. You are free to adjust these settings as needed.
    |
    | To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
    |
    */

    'paths' => ['*', 'api/*', 'sanctum/csrf-cookie', 'login', 'logout'],

    'allowed_methods' => ['*'],

    'allowed_origins' => ['*'],

    'allowed_origins_patterns' => [],

    'allowed_headers' => ['*'],

    'exposed_headers' => [],

    'max_age' => 0,

    'supports_credentials' => true,

];
Activity icon

Started a new Conversation Access To XMLHttpRequest At From Origin Has Been Blocked By CORS Policy: No 'Access-Control-Allow-Origin' Header Is Present On The Requested Resource.

I have called the api/getusers with axios from vue js. Error

Access to XMLHttpRequest at 'http://app.project.test/api/getusers' from origin 'http://project.test:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
xhr.js?b50d:177 GET http://app.project.test/api/getusers net::ERR_FAILED

api.php

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    $data=[
        "user"=>$request->user(),
        "role"=>$request->user()->roles->first(),
    ];
    return response()->json($data);
    //return $request->user();
});


Route::middleware('auth')->group(function() {  
    Route::group(['middleware' => ['role:superadmin']], function () {        
        Route::get('/getusers',function() {
            $data=User::all();
            dd($data);
            return response()->json($data);
        });
        //Route::resource('superadmins', 'SuperAdminsController', ['only' => ['update']] );
    });
});

How can I solve this problem?

Nov
22
2 months ago
Activity icon

Started a new Conversation What Does Auth:sanctum Mean In Api.php?

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
}

What does auth:sanctum mean here?

Oct
22
3 months ago
Activity icon

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

edit.blade.php

<h1>Edit</h1>

<?php
	echo '<pre>';
	//var_dump($post);
	echo '</pre>';
	$postid=$post['id'];
	$post_title=$post['title'];
	$post_content=$post['content'];
	
	echo '<form method="PUT" action="/posts/' . $postid .  '/update" >';
?>
	@csrf
<?php
	echo '<input type="hidden" name="id" value="' . $postid . '" /><br/>';
	echo 'Title' . '<br/>';
	echo '<input type="text" name="title" value="' . $post_title . '" /><br/>';
	echo 'Content' . '<br/>';
	echo '<textarea rows="10" cols="40" name="content">' . $post_content . '</textarea><br/>';
	echo '<input type="submit" value="Update" />';
	echo '</form>';
?>

Route::put('/posts/{id}/update', [PostController::class, 'update']);
	public function update(Request $request, $id) {
		$post=Post::find($id);
		$title=$request->input('title');
		$content=$request->input('content');
		$post->title=$title;
		$post->content=$content;
		$post->save();
		return redirect('/posts');
	}

How can I use PUT method to update a post?

Oct
21
3 months ago
Activity icon

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

How can I logout using Route::post(...)? What is the good practice to logging out?

Activity icon

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

    public function dologout() {
        Auth::logout();
        return redirect('/showlogin');
    }

Route::post('/dologout', [UserController::class, 'dologout']);

Why do I get this error: The GET method is not supported for this route. Supported methods: POST. ?

Oct
15
3 months ago
Activity icon

Started a new Conversation How Can I Make A Login Form With Vue Js As A Seperate Frontend?

login api
public function login(Request $request)
    {
        $email = $request->input('email');
        $password = $request->input('password');
        $model = User::where('email', '=', $email)->first();
        //dd($request->all());
        if (!empty($model)) {
            $cryptedpassword = $model->password;
            if (Hash::check($password, $cryptedpassword)) {
                $user = [
                    "name" => $model->name,
                    "email" => $model->email
                ];
                $data = [
                    "status" => "Success",
                    "api_token" => Str::random(60),
                    "user" => $user
                ];
            } else {
                $data = [
                    "status" => "Password did not match.",
                    "user" => null
                ];
            }
        }
        if (empty($model)) {
            $data = [
                "status" => "Email did not match.",
                "user" => null
            ];
        }
        return response()->json($data);
    }

api.php
Route::post('/login', [UserController::class, 'login'])->name("login");

How can I make a login form with vue js as a seperate frontend? I have created vue project with 'vue create project-frontend'. The login form will call that login api and if success, it will show username.

Oct
14
3 months ago
Activity icon

Started a new Conversation How Can I Make Post Api To Login? "The POST Method Is Not Supported For This Route. Supported Methods: GET, HEAD"

Url:

http://127.0.0.1:8000/api/[email protected]&password=secret

api.php

Route::get('/login', [UserController::class, 'login']);

It works.

But making a post api, like in api.php

Route::post('/login', [UserController::class, 'login']);

It does not work. I have tested in postman adding json data like in body.

{
"email":"[email protected]",
"password":"secret"
}

I get error:

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: The POST method is not supported for this route. Supported methods: GET, HEAD. in file C:\xampp\htdocs\project\vendor\laravel\framework\src\Illuminate\Routing\AbstractRouteCollection.php on line 117

UserController.php

<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

use App\Http\Resources\UserResource;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use App\Models\User;

class UserController extends Controller
{
    public function login(Request $request) {  
        
        $email=$request->input('email');
        $password=$request->input('password');        
        $model = User::where('email', '=', $email)->first();
        //dd($email);    
        if (!empty($model)) {
            $cryptedpassword=$model->password;
            if (Hash::check($password, $cryptedpassword)) {
                $user=[
                    "name" => $model->name,
                    "email" => $model->email
                ];
                $data=[
                    "status" => "Success",
                    "api_token" => Str::random(60),
                    "user" => $user
                ];
            } else {
                $data=[
                    "status" => "Password did not match.",
                    "user" => null
                ];
            }
        } 
        if(empty($model)) {
            $data=[
                "status" => "Email did not match.",
                "user" => null
            ];
        }        
        return response()->json($data);
      }
    
}
Activity icon

Replied to How Can I Get Password From Users Table From Eloquent Object?

I want to get password field. Then I want to check it with the field of password from url. I am trying to make a api. Url will be: http://127.0.0.1:8000/api/[email protected]&password=secret

Activity icon

Started a new Conversation How Can I Get Password From Users Table From Eloquent Object?

<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

use App\Http\Resources\UserResource;
use Illuminate\Support\Facades\Hash;
use App\Models\User;

class UserController extends Controller
{
    public function login(Request $request){
        
        $email=$request->get('email');
        $password=$request->get('password');
        $user=[
            "email"=>$email,
            "password"=>$password
        ];        
        $model = User::where('email', '=', $email);
        dd($model);
        return response()->json($user);
      }
    
}

How can I get password from users table? After $model = User::where('email', '=', $email); how can I get password from eloquent object?

Oct
10
3 months ago
Activity icon

Replied to No Output Or Blank Index.html After Compiling With Webpack

Why do we need resolve>alias only for 'vue' or vue.js? Why don't we need resolve>alias for 'vue-router' and vue-router.js?

Activity icon

Started a new Conversation No Output Or Blank Index.html After Compiling With Webpack

src/index.js

import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const Home = { template: '<div>This is Home</div>' }
const Foo = { template: '<div>This is Foo</div>' }
const Bar = { template: '<div>This is Bar {{ $route.params.id }}</div>' }

const router = new VueRouter({
  mode: 'history',
  //base: __dirname,
  routes: [
    { path: '/', name: 'home', component: Home },
    { path: '/foo', name: 'foo', component: Foo },
    { path: '/bar/:id', name: 'bar', component: Bar }
  ]
})

new Vue({
  router,
  template: `
    <div id="app">
      <h1>Named Routes</h1>
      <p>Current route name: {{ $route.name }}</p>
      <ul>
        <li><router-link :to="{ name: 'home' }">home</router-link></li>
        <li><router-link :to="{ name: 'foo' }">foo</router-link></li>
        <li><router-link :to="{ name: 'bar', params: { id: 123 }}">bar</router-link></li>
      </ul>
      <router-view class="view"></router-view>
    </div>
  `
}).$mount('#app')

dist/index.html

<div id="app">
	
</div>

<script src="main.js" ></script>

webpack.config.js

const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  },
  mode: "development"
};

package.json

{
  "name": "named-route",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "http-server": "^0.12.3",
    "vue": "^2.6.12",
    "vue-router": "^3.4.6"
  },
  "devDependencies": {
    "webpack": "^4.44.2",
    "webpack-cli": "^3.3.12"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
	"build": "webpack"
  },
  "author": "",
  "license": "ISC",
  "keywords": [],
  "description": ""
}

npx webpack --config webpack.config.js // command to compile

Following this: https://webpack.js.org/guides/getting-started/

After double click the dist/index.html, blank page. Why? How can I solve this problem?

Oct
09
3 months ago
Activity icon

Replied to Uncaught SyntaxError: Import Declarations May Only Appear At Top Level Of A Module

I have installed http-server. Running the 'http-server' outputs same error. How can I solve the problem?

Activity icon

Replied to Why Is Not Vue Component's Output Rendering?

__dirname is not defined. How can I solve this? What does __dirname return?

Activity icon

Started a new Conversation Why Is Not Vue Component's Output Rendering?

router.js

import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const Home = { template: '<div>This is Home</div>'}
const Foo = { template: '<div>This is Foo</div>' }
const Bar = { template: '<div>This is Bar {{ $route.params.id }}</div>' }

const router = new VueRouter({
  mode: 'history',
  base: __dirname,
  routes: [
    { path: '/', name: 'home', component: Home },
    { path: '/foo', name: 'foo', component: Foo },
    { path: '/bar/:id', name: 'bar', component: Bar }
  ]
})

export default router

App.vue

<template>
  <div id="app">
    <h1>Named Routes</h1>
      <p>Current route name: {{ $route.name }}</p>
      <ul>
        <li><router-link :to="{ name: 'home' }">home</router-link></li>
        <li><router-link :to="{ name: 'foo' }">foo</router-link></li>
        <li><router-link :to="{ name: 'bar', params: { id: 123 }}">bar</router-link></li>
      </ul>
      
      <router-view ></router-view>
    <!-- <img alt="Vue logo" src="./assets/logo.png"> -->
    <!-- <HelloWorld msg="Welcome to Your Vue.js App"/> -->
  </div>
</template>

<script>
//import HelloWorld from './components/HelloWorld.vue'

export default {
  name: 'App',
  components: {
    //HelloWorld
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

main.js

import Vue from 'vue'
import App from './App.vue'

Vue.config.productionTip = false

import router from './router'

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')

vue create project-name , project is created with this command. Can anyone please correct the code to get expected output? At bottom it is not outputting:

This is Home
This is Foo
This is Bar 123
Activity icon

Replied to Uncaught SyntaxError: Import Declarations May Only Appear At Top Level Of A Module

Adding type="module", get error in console tab.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///E:/test/app.js. (Reason: CORS request not http).

Module source URI is not allowed in this document: “file:///E:/test/app.js”.
Activity icon

Started a new Conversation Uncaught SyntaxError: Import Declarations May Only Appear At Top Level Of A Module

app.js

import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const Home = { template: '<div>This is Home</div>' }
const Foo = { template: '<div>This is Foo</div>' }
const Bar = { template: '<div>This is Bar {{ $route.params.id }}</div>' }

const router = new VueRouter({
  mode: 'history',
  base: __dirname,
  routes: [
    { path: '/', name: 'home', component: Home },
    { path: '/foo', name: 'foo', component: Foo },
    { path: '/bar/:id', name: 'bar', component: Bar }
  ]
})

new Vue({
  router,
  template: `
    <div id="app">
      <h1>Named Routes</h1>
      <p>Current route name: {{ $route.name }}</p>
      <ul>
        <li><router-link :to="{ name: 'home' }">home</router-link></li>
        <li><router-link :to="{ name: 'foo' }">foo</router-link></li>
        <li><router-link :to="{ name: 'bar', params: { id: 123 }}">bar</router-link></li>
      </ul>
      <router-view class="view"></router-view>
    </div>
  `
}).$mount('#app')

index.html

<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>


<div id="app">
	
</div>

<script src="./app.js" ></script>

In console tab I get error:

Uncaught SyntaxError: import declarations may only appear at top level of a module

Following documentation: https://router.vuejs.org/guide/essentials/named-routes.html

https://github.com/vuejs/vue-router/blob/dev/examples/named-routes/app.js

How will I run this js code?

Oct
06
3 months ago
Activity icon

Replied to How Can I Get Data From Component's Data Function?

Is it possible to use posts from data function as data property? How can I make posts global or export so that posts can be used outside component?

Activity icon

Replied to How Can I Get Data From Component's Data Function?

Can you post example code of using data from data function?

Activity icon

Replied to How Can I Get Data From Component's Data Function?

I want to use here:

<div id="demo">
<blog-post
  v-for="post in posts"
  v-bind:key="post.id"
  v-bind:title="post.title"
></blog-post>
</div>
Activity icon

Replied to How Can I Get Data From Component's Data Function?

How can I get data from data function or is there any way to use data from data function?

Activity icon

Replied to How Can I Get Data From Component's Data Function?

How can I do 'posts' state?

Activity icon

Started a new Conversation How Can I Get Data From Component's Data Function?

<!DOCTYPE html>
<html>

	<head>
		<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	</head>

	<body>

<div id="demo">
<blog-post
  v-for="post in posts"
  v-bind:key="post.id"
  v-bind:title="post.title"
></blog-post>
</div>
		
		<script>

Vue.component('blog-post', {
  props: ['title'],
  template: '<h3>{{ title }}</h3>',
  data: function() {
	return {
		posts: [
      { id: 1, title: 'My journey with Vue' },
      { id: 2, title: 'Blogging with Vue' },
      { id: 3, title: 'Why Vue is so fun' }
		]
	}
  }
})

new Vue({
  el: '#demo',
  data: {
  /*
    posts: [
      { id: 1, title: 'My journey with Vue' },
      { id: 2, title: 'Blogging with Vue' },
      { id: 3, title: 'Why Vue is so fun' }
    ]
	*/
  }
})

		</script>
	</body>

</html>

It gets error on console:

[Vue warn]: Property or method "posts" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

(found in <Root>) vue.js:634:17

How can I solve this?

Oct
05
3 months ago
Activity icon

Started a new Conversation No Output When Using <template> Tag

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

<template id="demo" v-if="ok">
  <h1>Title</h1>
  <p>Paragraph 1</p>
  <p>Paragraph 2</p>
</template>

<script>

var vm = new Vue({
  el: '#demo',
  data: {
    ok: true,
  },
})

</script>

If I use <div ...> instead of <template ...> I see no output. Why?

Activity icon

Started a new Conversation Expected Html Not Rendering With Vue Js

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

<div id="app" 
  class="static"
  v-bind:class="{ active: isActive, 'text-danger': hasError }"
></div>

<script>
var app = new Vue({
  el: '#app',
	data: {
	  isActive: true,
	  hasError: false
	}
})
</script>

https://vuejs.org/v2/guide/class-and-style.html

Guide says it will render <div class="static active"></div>. But from CTRL+U or from html source code I see same:

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

<div id="app" 
  class="static"
  v-bind:class="{ active: isActive, 'text-danger': hasError }"
></div>

<script>
var app = new Vue({
  el: '#app',
	data: {
	  isActive: true,
	  hasError: false
	}
})
</script>
Oct
01
3 months ago
Activity icon

Started a new Conversation What Is Guard? What Does Auth::guard() Function Do?

What is guard? What does Auth::guard() function do?

Activity icon

Replied to Can Anyone Explain The Code In Details?

What is guard? What does Auth::guard() function do?

Activity icon

Started a new Conversation Can Anyone Explain The Code In Details?

public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check()) {
            return redirect(RouteServiceProvider::HOME);
        }

        return $next($request);
    }

What is guard function with $guard here? Can anyone explain the code in details?

Activity icon

Replied to $this->middleware('guest')->except('logout'); Meaning

When do we need guest middleware?

Activity icon

Started a new Conversation $this->middleware('guest')->except('logout'); Meaning

What is the meaning of $this->middleware('guest')->except('logout');?