calin.ionut

calin.ionut

Member Since 2 Years Ago

Experience Points
6,660
Total
Experience

3,340 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
36
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 2
6,660 XP
Mar
27
1 week ago
Activity icon

Awarded Best Reply on Laravel App Using Index.php In Url

I have edited using QSD:

# Redirect if index.php is in the URL
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php / [R=301,NE,L,QSD]

And now it works :)

Mar
26
1 week ago
Activity icon

Replied to Laravel App Using Index.php In Url

I have edited using QSD:

# Redirect if index.php is in the URL
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php / [R=301,NE,L,QSD]

And now it works :)

Activity icon

Replied to Laravel App Using Index.php In Url

this approach is not not working as expected:

 RewriteRule ^index.php/(.+) / [R=301,L]

If the request is /index.php - it still load the /index.php without redirect to /

If I use /index.php/category it redirects to /category (it remove the index.php)

I have tried another one:

RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) / [R=301,NE,L]

this works fine .... but the problem here is If I have: /index.php?test it redirects to /?test

Anyone know how can I change this rules to redirect 301 to / if there is index.php in the url ???

Mar
25
2 weeks ago
Activity icon

Replied to Laravel App Using Index.php In Url

@tykus How to remove it from the url ?

One solution would be using htaccess

  # Redirect if index.php is in the URL
    RewriteRule ^index.php/(.+) / [R=301,L]

but I don`t like working with htaccess.

Is there a laravel solution ?

Activity icon

Started a new Conversation Laravel App Using Index.php In Url

I have a website in laravel which is installed on a vps server using apache.

The virtualhost file for it is:

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

    <Directory /var/www/example.com/public/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined   
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.example.com [OR]
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

The problem that i discovered today is if i use in the url /index.php it still loads the homepage (even if I don`t have that route defined)

the homepage route is:

Route::any('/', '[email protected]')->name('homepage')

Why is this happening? Is there a setting in laravel to prevent this ?

Mar
20
2 weeks ago
Activity icon

Replied to Laravel Disable Loading Any Subdomain

@bugsysha

Do you know how to disable access using htaccess ?

Ex: if someone tries to access a subdomain to redirect to the /

Activity icon

Replied to Laravel Disable Loading Any Subdomain

@bugsysha

Could be this the issue using this DNS entry ?

*.example.com	86400	A	0	server_ip_address
Activity icon

Started a new Conversation Laravel Disable Loading Any Subdomain

I have a website hosted on a VPS using laravel 6.

The problem is you can use anything you want in front of the domain and the page it loads.

I want to disable loading any subdomains.

from this:

https://www.what_ever_you_want.example.com

to this:

https://www.example.com

Is there a method that I can prevent this in laravel ? Or I have to use .htaccess for this ?

Feb
10
1 month ago
Activity icon

Replied to Modify The / Route

@sinnbeck so you are suggesting that the only way to do this is using a third party library.

Activity icon

Started a new Conversation Modify The / Route

I have this route defined in web:

Route::any('/', '[email protected]')->name('homepage');

When

dd(route('homepage'))

of course I get the url for the homepage

"http://example.com"

How can I change the / route to be like this (add the / to the end) ???

"http://example.com/"

I know I can do this:

route('homepage').'/'

but I am not looking for that.

Any ideas?

Jan
31
2 months ago
Activity icon

Replied to Force App Url To Www.

@artcore still not working

The page isn’t redirecting properly

in the browser.

What do you mean by

 make sure .htaccess overrides work for your site

???

Activity icon

Started a new Conversation Force App Url To Www.

I have a laravel project 5.8 and in the default .htaccess I want to add some rules to force the app to redirect from example.com to www.example.com

I also posted this question here https://stackoverflow.com/questions/59993220/laravel-htaccess-force-www but not of the answer works.

I also changed from .env

APP_URL=http://example.com

to

APP_URL=http://www.example.com

but still not working.

How can I force www to use www.example.com instead of example.com ???

The app is running on a VPS linux web server with apache.

Jan
13
2 months ago
Activity icon

Replied to How To Override Email Verify In Laravel 6 ?

I figured out:

I use session('verified') in the view :)

Activity icon

Replied to How To Override Email Verify In Laravel 6 ?

@bugsysha

Thank you!

In the VerificationController i set the $redirectTo where I want to redirect after verify email. Do you know how to send a session in the view ? To tell the user that the email was validated.

Activity icon

Started a new Conversation How To Override Email Verify In Laravel 6 ?

I have created a notification (EmailVerificationNotification.php) in app/Notifications:

<?php

namespace App\Notifications;

use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\URL;

class EmailVerificationNotification extends Notification
{
    use Queueable;

    public function __construct()
    {
    }

    public function via($notifiable)
    {
        return ['mail'];
    }

    public function toMail($notifiable)
    {
        $verifyUrl = URL::temporarySignedRoute('verification.verify', Carbon::now()->addMinutes(60), ['id' => $notifiable->getKey()]);

        return (new MailMessage)
            ->view('store.emailTemplate.emailVerify', ['verifyUrl' => $verifyUrl])
            ->subject('Email verification '.env('APP_NAME'));
    }

    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}

and in the User model:

  public function sendEmailVerificationNotification()
    {
        $this->notify(new EmailVerificationNotification());
    }

and I get :

Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameters for [Route: verification.verify] [URI: email/verify/{id}/{hash}].

How can I get the verifyUrl ???

Activity icon

Replied to How To Implement Email Verification ?

@snapey that's the case.

I don't want the user to allow if it's not verified.

Activity icon

Replied to How To Implement Email Verification ?

@bugsysha

I just leave them as they are.

but how about this:

If the user enters another email (for example not his - and of course it can't be verified), and then later another user want to register with that email address (his email address) ?

He can't .... because the account already exists with that email address. Right?

Activity icon

Started a new Conversation How To Implement Email Verification ?

I am not sure if I understood correctly the mechanism of email verification (Laravel 6). (https://laravel.com/docs/6.x/verification)

Currently I am using:

$this->middleware('auth');

in every controller that needs the user to be authenticated.

Should I use only:

$this->middleware('verified');

or both of them ?

$this->middleware('auth');
$this->middleware('verified');

I want to implement the email confirmation (because most of the users when creating an account they use fake emails...).

For example, How do you proceed if the user has not confirmed the email in 60 min ?

Implement a cron job to test if the user has not verified the email account in 60 min, and then delete the account?

Dec
29
3 months ago
Activity icon

Replied to How To Use V-model On Components ?

This is how I got rid of the error:

on the editor component:

 <tinymce-editor v-model="newValue" :init="options"></tinymce-editor>
props: ['value'],
computed: {
    newValue: {
        get: function() {
            return this.value;
        },
        set: function(newValueData) {
            this.$emit('input', newValueData)
        }
    }
},

and on the other component

<editor :value="Description" @input="(newDescription) => {Description = newDescription}"/>

and now it works!

Dec
28
3 months ago
Activity icon

Replied to How To Use V-model On Components ?

@bobbybouwmann so if I understand correctly ... in my case:

on Editor component:

<tinymce-editor v-model="value" :init="options"></tinymce-editor>

props: {
            value: {
                type: String,
                required: true
            }
        },
        watch: {
            value() {
                this.$emit('input', this.value);
            }
        },

and on ProductDetails

<editor :value="Description" @input="(newDescription) => {Description = newDescription}"/>

but I get

Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "value"

What I did wrong?

Activity icon

Started a new Conversation How To Use V-model On Components ?

I want to use vue-tinymce editor in a separate component ... like this

Editor component:

<template>
    <tinymce-editor v-model="value" :init="options"></tinymce-editor>
</template>

<script>
    import Vue from 'vue';
    import Editor from '@tinymce/tinymce-vue';
    import 'tinymce/tinymce.min';
    import 'tinymce/themes/silver/theme.min';
    import 'tinymce/plugins/image/plugin.min';
    import 'tinymce/plugins/link/plugin.min';
    import 'tinymce/plugins/lists/plugin.min';

    Vue.component('tinymce-editor', Editor);
    export default {
        name: "Editor",
        props: ['value'],
        components: {Editor},
        data() {
            return {
                options: {
                    plugins: 'link, image, lists',
                    height: 400,
                    branding: false,
                    toolbar: "undo redo | styleselect | link image lists | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"
                }
            }
        },
    }
</script>

and this component I am using in another component:

<template>
    <div>
        <editor :value="Description"/>
    </div>
</template>

<script>
    import Editor from "../../components/Editor";
    export default {
        name: "ProductDetails",
    data() {
            return {
                Description: ''
            }
        }   
    }
</script>

How can I use v-model for the editor in ProductDetails component ?

Activity icon

Started a new Conversation Add New Entry To A Collection

I need to add an entry to a collection.

I have the following:

$feeds = DB::table('feeds')->select('Name as feed', 'FeedID')->orderBy('Name', 'ASC')->get();

and I want to add to the existing collection as the first entry:

['feed' => 'No feed', 'FeedID' => -1]

How can I do it ?

Dec
12
3 months ago
Activity icon

Replied to Eloquent Many-to-many Get Data From A Table Using Condition From Another Table

@nakov using this query:

$products = Product::where('Stock', '<>', 1)
            ->whereHas(['categories' => function($query) {
                return $query->where('IsActive', 1);
            }])
            ->with('categories') // this will eager load the categories
            ->get();

I get

Call to a member function getRelationExistenceQuery() on array
Activity icon

Started a new Conversation Eloquent Many-to-many Get Data From A Table Using Condition From Another Table

I have created the relationship between product and category table (many-to-many)

I can get the product categories for a single product:

$product = Product::where('Stock', '<>', 0)->find(4264);
$categories = $product->categories;

But how about get more more products and set a condition for the category. Example: get only the products that belongs to an active category ???

I know if using a loop on products then an if (check the categories if its active) can solve the problem.....but I was wondering if its possible something like this (using a single query):

$products = Product::where('Stock', '<>', 1)->categories('IsActive', 1)->get();
Nov
26
4 months ago
Activity icon

Replied to Laravel 6 Error Class 'Illuminate\Support\Facades\Input' Not Found

Solved using

use Illuminate\Http\Request;

and

return Redirect::back()->withInput($request->all())->withErrors($validator);
Activity icon

Replied to Laravel 6 Error Class 'Illuminate\Support\Facades\Input' Not Found

I have the same problem after upgrading from laravel 5 to 6 when redirect back

return Redirect::back()->withInput(Input::all())->withErrors($validator);

it`s not working any more in laravel 6.

So i have tried with Request (like @mabdullahsari suggested)

return Redirect::back()->withInput(Request::all())->withErrors($validator);

but I got an error:

Non-static method Illuminate\Http\Request::all() should not be called statically

How should I use Request instead of Input::all() in laravel 6 ????

Nov
22
4 months ago
Activity icon

Replied to Best Vue Date Range Picker

@fylzero does is support selecting a date range ?

Activity icon

Started a new Conversation Best Vue Date Range Picker

I am looking for VUE (no JQuery) date picker that can do also do a range date picker similar to this: https://github.com/Innologica/vue2-daterange-picker (this one it`s a little buggy)

Any best date range picker out there ? Which date picker you guys using ???

Thx

Nov
12
4 months ago
Activity icon

Started a new Conversation Load Laravel.log In A Web Interface

Hi!

I am creating a new admin for my ecommerce (laravel 6)

I want to display the log (laravel.log) file in the admin - every time I have to SSH and see if there are any errors in the log.

I found 2 third party packages: https://github.com/rap2hpoutre/laravel-log-viewer and https://github.com/danielme85/laravel-log-to-db

Is anyone done this ? View log errors in admin or in a web interface ?

I was thinking to store the all the log info in DB using that package... do you think is a good ideea ?

Nov
01
5 months ago
Activity icon

Replied to How To Enable RuntimeCompiler In Laravel-mix ???

@nakov I figure it out :)

There is nothing to do with runtimecompiler .....

I forgot from the beginning when i start using this component "v-runtime-template" to use the component this line:

components: {VRuntimeTemplate},

and that's it

So the final usage is this

<template>
<div class="table-responsive">
            <table class="table">                
                <v-runtime-template :template="dataContent"></v-runtime-template>
            </table>
        </div>
</template>

<script>
import VRuntimeTemplate from 'v-runtime-template';
export default {
     name: "BasicTable",
      components: {VRuntimeTemplate}, // the line that I forgot
      data() {
          return {
              dataContent: '',
          }
      },
}
</script>

The dataContent is the html data from the api server. It also contains vue code, example:

<router-link :to="{ name: 'category-details', params: { CategoryID: 1}}">Category 1</router-link>

and now the vue code is recognized with VRuntimeTemplate component :)

Oct
31
5 months ago
Activity icon

Replied to How To Enable RuntimeCompiler In Laravel-mix ???

@nakov

And if you installed the package, don't you just need to include the component? I don't really understand the usage of the package, but you can import the component directly.
import VRuntimeTemplate from "v-runtime-template";
and use it in your component?

I imported directly in the component where I needed.

About the first part....

  1. I added the alias in webpack.mix.js
mix.webpackConfig({
        resolve: {
            alias: { 'vue$': 'vue/dist/vue.runtime.js' }
        }
    })
  1. created in the laravel project the path
vue/dist/vue.runtime.js

and in the file:

Vue.module.exports = {
    runtimeCompiler: true
};

and when compiling in the console browser i get this error:

You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.
Activity icon

Replied to How To Enable RuntimeCompiler In Laravel-mix ???

For me it`s not working .... no matter what the method I use to import Vue

the error is the same:

TypeError: Cannot set property 'exports' of undefined
Activity icon

Replied to How To Enable RuntimeCompiler In Laravel-mix ???

@nakov

My app.js is this:

import Vue from 'vue';
import VueRouter from 'vue-router';
import router from './routes';
import App from "./App";

Vue.use(VueRouter);
window.axios = require('axios');

Vue.module.exports = {
    runtimeCompiler: true
};

let app = new Vue({
    el: '#app',
    components: { App },
    router: router,
});
Activity icon

Replied to How To Enable RuntimeCompiler In Laravel-mix ???

If set I get this error:

TypeError: Cannot set property 'exports' of undefined
Activity icon

Started a new Conversation How To Enable RuntimeCompiler In Laravel-mix ???

I want to use this component:

https://github.com/alexjoverm/v-runtime-template

and it says that

// vue.config.js
module.exports = {
  runtimeCompiler: true
};

I ma using Laravel 6 with Vue.

How to enable runtimeCompiler in laravel-mix ???

Oct
30
5 months ago
Activity icon

Started a new Conversation Add Custom Field To Query

Hello,

I want to create a simple API and for categories I want to return a json with custom data:

ex:

$categories = $categories->select('CategoryID', 'MenuOrder', 'IsActive', 'Name', 'Slug' )->where($filterCondition)->orderBy($orderBy, $orderType)->paginate($paginate)->appends($queries);

I need 1 more field "Url" - which is not in the DB - I have to generate it using a function that accept CategoryID and Slug for each record.

How can I add custom field (Url) in categories ?

Using a loop for $categories (create an array with the fields...generate the url....etc) I don't think is a good idea (for performance) .... so I was thinking modifying the query - when each row is extracted from the DB ... to generate the Url for each entry directly.

or Is there any better soluttion (faster) ?

The return data is a Json which will be loop on the client (using vue) to display data ......

Oct
26
5 months ago
Activity icon

Started a new Conversation Create Dynamic Events For A Vue Component

Anyone can help me with this question ?

The details are here

https://stackoverflow.com/questions/58569596/create-dynamic-events-for-a-vue-component

Oct
23
5 months ago
Activity icon

Replied to Fit Pagination On Mobile Devices

I think I just solved :)

Created a custom pagiation mobile-pagination-template.blade.php:

@if ($paginator->hasPages())
    <ul class="pagination pagination">
        {{-- Previous Page Link --}}
        @if ($paginator->onFirstPage())
            <li class="page-item disabled"><span class="page-link">‹</span></li>
        @else
            <li class="page-item"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">‹</a></li>
        @endif

        @if($paginator->currentPage() > 2)
            <li class="page-item hidden-xs"><a class="page-link" href="{{ $paginator->url(1) }}">1</a></li>
        @endif
        @if($paginator->currentPage() > 3)
            <li class="page-item"><span class="page-link">...</span></li>
        @endif
        @foreach(range(1, $paginator->lastPage()) as $i)
            @if($i >= $paginator->currentPage() - 1 && $i <= $paginator->currentPage() + 1)
                @if ($i == $paginator->currentPage())
                    <li class="page-item active"><span class="page-link">{{ $i }}</span></li>
                @else
                    <li class="page-item"><a class="page-link" href="{{ $paginator->url($i) }}">{{ $i }}</a></li>
                @endif
            @endif
        @endforeach
        @if($paginator->currentPage() < $paginator->lastPage() - 2)
            <li class="page-item"><span class="page-link">...</span></li>
        @endif
        @if($paginator->currentPage() < $paginator->lastPage() - 1)
            <li class="page-item hidden-xs"><a class="page-link" href="{{ $paginator->url($paginator->lastPage()) }}">{{ $paginator->lastPage() }}</a></li>
        @endif

        {{-- Next Page Link --}}
        @if ($paginator->hasMorePages())
            <li class="page-item"><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">›</a></li>
        @else
            <li class="page-item disabled"><span class="page-link">›</span></li>
        @endif
    </ul>
@endif

and in product page:

{{ $products->links('components.mobile.mobile-pagination-template') }}
Activity icon

Started a new Conversation Fit Pagination On Mobile Devices

I can`t fit on mobile device the pagination. (laravel 6 and bootstrap 4)

I found this function for pagination ( onEachSide() )

 $products->onEachSide(1)->links()

The results are ok when the page loads (screenshot attached):

https://www.dropbox.com/s/k2aitr40ofastq3/pag_initial.png

But the problem is when click on 3 and so on.... (screenshot attached):

https://www.dropbox.com/s/2rjmsmxpuh8nclh/pag_after.png