brian85

brian85

Member Since 2 Years Ago

Sausages pincher in chief at in my pant

Experience Points 3,540
Experience Level 1

1,460 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 23
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

15 May
2 months ago

brian85 left a reply on Unique Field Applying To Soft-deleted Models As Well?

Ok, sorry I've posted too fast, I've found the solution :

'siret' => array(
                'required',
                'unique:etablissements,siret,'.$this->etablissement->id.',id,deleted_at,NULL',
                'regex:/^$|^[0-9 ]{14,18}$/',
            ),

brian85 left a reply on Unique Field Applying To Soft-deleted Models As Well?

Hello, and when you're usin a FormRequest class, have you an idea how to deal with that ? My rule is like that :

public function rules()
    {

       // In order to deal the creation process
        if(!isset($this->etablissement)){
            $this->etablissement->id = null;
        }

        return [
           
            'siret' => array(
                'required',
                'unique:etablissements,siret,'.$this->etablissement->id.',id',
                'regex:/^$|^[0-9 ]{14,18}$/',

            ),
];
    }

Thanks for your help

20 Mar
3 months ago

brian85 left a reply on Best Way To Avoid Repeating Code In Controler

Finally, the best way I've found is to create a Trait, it allows me to keep the code of my model dry and elegant

<?php
/**
 * Created by PhpStorm.
 * User: ysn
 * Date: 18/03/2019
 * Time: 10:03
 */

namespace App\Traits;

use App\Models;
use Illuminate\Http\Request;

Trait QueryFilter
{

    /**
     * Fonction de filtre sur les requêtes de recherche
     * @param Request $request
     * @param $filter
     * @return String
     */

    public function queryFilterBuilder(Request $request, $filter):String
    {

        $queryString = $request->input('queryString');
        $offset = $request->input('offset');
        $limit = $request->input('limit');
        
        $model = $filter['model'];

        $emptyQuery = $filter['emptyQueryStringfields'];

        $queryStringFields = $filter['queryStringFields'];



        $usersDatas = [];

        // Par défaut on limite la présentation des formation à N-1, N et N+1
        if($queryString ==''){

            $usersDatas['data'] = $model::where($emptyQuery[0]['field'],$emptyQuery[0]['compare'],$emptyQuery[0]['prefix'].$emptyQuery[0]['max']
                .$emptyQuery[0]['suffix']);
            //$usersDatas['count'] = $model::where($field,$compare, '%'.$max.$suffix);


            for ($i=0;$i<$emptyQuery[0]['range'];$i++){
                $usersDatas['data'] = $usersDatas['data']->orWhere($emptyQuery[0]['field'],$emptyQuery[0]['compare'], '%'.($emptyQuery[0]['max']-
                    ($i+1)).$emptyQuery[0]['suffix']);
            }
            $usersDatas['count'] = $usersDatas['data']->get()->count();

            $usersDatas['data'] = $usersDatas['data']->when($limit > 0 || $offset > 0, function ($usersData) use ($limit, $offset) {
                    $usersData->take($limit)->skip($offset);
                })->get();



        }else{

            $usersDatas['data'] = $model::where($queryStringFields[0]['field'], $queryStringFields[0]['compare'], $queryStringFields[0]['prefix']
                .$queryString.$queryStringFields[0]['suffix']);

            foreach ($queryStringFields as $key => $queryStringField){
                if($key>0){
                    $usersDatas['data'] = $usersDatas['data']->orWhere(
                        $queryStringFields[$key]['field'],
                        $queryStringFields[$key]['compare'],
                        $queryStringFields[$key]['prefix'].$queryString.$queryStringFields[$key]['suffix']);
                }
            }

            $usersDatas['count'] = $usersDatas['data']->get()->count();

            $usersDatas['data'] = $usersDatas['data']->when($limit > 0 || $offset > 0, function ($usersData) use ($limit, $offset) {
                    $usersData->take($limit)->skip($offset);
                })->get();

            //$usersDatas['count'] = $model::where($field, $compare, $queryString.'%')->orWhere('titre', 'like', '%'.$queryString . '%')->get
            //()->count();

        }

        $usersDatas = json_encode($usersDatas);
        return $usersDatas;

    }

}
15 Mar
4 months ago

brian85 left a reply on Best Way To Avoid Repeating Code In Controler

Yes the query builder of Spatie doesn't resolve the problem of code duplication, I'm planning to make a trait because finally the only things I need to pass in parameters are the model and the fields on wich I want to filter

brian85 left a reply on Best Way To Avoid Repeating Code In Controler

ok, thanks I'll see it

brian85 started a new conversation Best Way To Avoid Repeating Code In Controler

Hello, I would have an advice in order to avoid repeating code in my controlers. I ofently have the same method in my controlers named 'ajaxQuery' like this :

/**
     * @param Request $request
     * @return string
     */
    public function ajaxQuery(Request $request): string
    {
        $queryString = $request->input('queryString');
        $offset = $request->input('offset');
        $limit = $request->input('limit');

        // Par défaut on limite la présentation des formation à N-1, N et N+1
        if($queryString ==''){
            $usersData = Formation::where('ref_formation','like', '%'.date('y').'S')
                ->orWhere('ref_formation','like', '%'.(date('y')+1).'S')
                ->orWhere('ref_formation','like', '%'.(date('y')-1).'S')
                ->when($limit > 0 || $offset > 0, function ($usersData) use ($limit, $offset) {
                    $usersData->take($limit)->skip($offset);
                })->get();

            $usersDatas['count'] = Formation::where('ref_formation','like', '%'.date('y').'S')
                ->orWhere('ref_formation','like', '%'.(date('y')+1).'S')
                ->orWhere('ref_formation','like', '%'.(date('y')-1).'S')
                ->get()->count();

        }else{

            $usersData = Formation::where('ref_formation', 'like', $queryString . '%')
                ->orWhere('titre', 'like', '%'.$queryString . '%')
                ->when($limit > 0 || $offset > 0, function ($usersData) use ($limit, $offset) {
                    $usersData->take($limit)->skip($offset);
                })->get();

            $usersDatas['count'] = Formation::where('ref_formation', 'like', $queryString . '%')
                ->orWhere('titre', 'like', $queryString . '%')
                ->get()->count();


        }


        $usersDatas['data'] = $usersData;

        /*$usersDatas['count'] = $usersData = Formation::where('ref_formation', 'like', $queryString . '%')
            ->where('ref_formation','like', '%'.date('y').'S')
            ->orWhere('titre', 'like', $queryString . '%')
            //->orWhere('username', 'like', $queryString . '%')
            ->get()->count();*/

        $usersDatas = json_encode($usersDatas);

        return $usersDatas;

    }

Should I create a serviceProvider ? Another solution ? Thanks for your help

29 Nov
7 months ago

brian85 left a reply on How Handling A Request With Different Mapping Than Model

The drawback of this solution is that you cannot see the query in Telescope despite I find it elegant.

brian85 left a reply on How Handling A Request With Different Mapping Than Model

I already have two separates Models but I don't know this solution of events hooks to sync the second Model, interresting, I'll try it.

For the moment the update is returning true despite nothing happen, telescope shows me that there is no update query executed.

brian85 left a reply on How Handling A Request With Different Mapping Than Model

Ok it does'nt work i tried also

//$this->attributes['intitule_stage']=$value;
$this->setAttribute('intitule_stage',$value);

brian85 left a reply on How Handling A Request With Different Mapping Than Model

Ok thanks I see, I test this.

brian85 left a reply on How Handling A Request With Different Mapping Than Model

@D9705996 - Thanks but I don't think that it should be plural according to the documentation : https://laravel.com/docs/5.7/eloquent-mutators

My input field name is 'title' and I would that it goes to the 'intitule' of the Stage Model, how handling this, the mutator does nothing I ve seen that no update query happen ?

brian85 started a new conversation How Handling A Request With Different Mapping Than Model

hello, I'm facing a problem for which I doesn't have found a solution : when I update an item I must update it to a second database where the model is different (example: the request send an input text 'title' and it must be recorded to the field 'intitule' in the second database). In my fist database the request fit the model and there is no problem, but in the second, the update query does not happen. I tried to change the set mutator without success. Did you have experienced this problem and do you have solved it ?

Here is my Model :

<?php

namespace App\Old;

use Illuminate\Database\Eloquent\Model;

class Stage extends Model
{
    // Ce modèle est celui de l'ancienne base de donnée

    // changement de connexion
    protected $connection = 'mysql2';
    //la nom de la table ne correspond pas au nom par défaut attendu par le framework au regard de du nom du modèle
    protected $table = 'stages';
    //changement de clés primaire par défaut attendu par le framework
    protected $primaryKey = 'id_stages';

    // Ces champs ne sont pas modifiables
    //protected $guarded = ['id'];
    protected $fillable = ['intitule_stage'];

    //On ne remplit pas de champs created_at et updated_at par défaut ds Eloquent
    public $timestamps = false;

    public function setTitleAttribute($value){
        $this->attribute['intitule_stage']=$value;
    }

}

here is the controller

public function update(Request $request, Formation $formation)
    {
        //dd($request);
        $requestFormation = FormationRequest::createFrom($request);
        $requestStage = StageRequest::createFrom($request);

        //dd($requestFormation);
        $formation->update($requestFormation->all());
        $stage = Stage::findOrFail($formation->id);

        if ($this->updateStage($requestStage, $stage)) {
            session()->flash('success_message', 'Modification enregistrée');
            return redirect(route('formation.index'));
        }

    }

    private function updateStage(StageRequest $request,Stage $stage):bool {
        //dd($request->input('titre'));
        return $stage->update($request->all());
    }

Thanks for your help

07 Mar
1 year ago

brian85 left a reply on Call To Undefined Function Illuminate\Encryption\openssl_cipher_iv_length()

It seems really to be a problem of php_openssl module. the API version does not match if you look into php_error logs, so if you're using wamp you should dl the php7.2.3 update here : http://wampserver.aviatechno.net/ It works for me now

brian85 left a reply on Call To Undefined Function Illuminate\Encryption\openssl_cipher_iv_length()

Hi, I got the same problem after composer update on a wamp server php 7.2.3 too. On a debian no problem with the same composer.json...

02 Mar
1 year ago

brian85 started a new conversation Simple Store Validation Request Don't Return Error Just Redirect To Form View

Hello, I don't understand why Laravel don't send me validation error and redirects me to the view with 302 error.

I just have simple forms in the view which just send this :

@foreach($routeCollectionByName as $key=>$route)

                                        <li class="list-group-item">{{$key}} - route : {{$route['name']}} - uri : {{$route['uri']}}

                                            @if($route['isRegisteredInTableLink'])
                                                {{Form::open(array('route'=>array('Link.update',$route['linkId']),'method'=>'PUT',
                                                'name'=>'updateLink'.$key))}}
                                                <div class="md-form input-group">
                                                    <input type="hidden" name="route_name" value="{{$route['name']}}">
                                                    <input type="hidden" name="href" value="{{$route['uri']}}">
                                                    <input class="form-control"
                                                           type="text"
                                                           name="title"
                                                           id="linkTitle{{$key}}"
                                                           pattern="[a-zA-Zéè \-]{3,30}"
                                                           required
                                                           value="{{$route['linkTitle']}}">
                                                    <span class="input-group-btn">
                                                        <button type="button" class="btn btn-default ml-2">Ajouter</button>
                                                    </span>
                                                    {{Form::close()}}
                                                </div>
                                            @else
                                                {{Form::open(array('route'=>'Link.store','name'=>'storeLink'.$key))}}
                                                <div class="md-form input-group">
                                                    <input type="hidden" name="route_name" value="{{$route['name']}}">
                                                    <input type="hidden" name="href" value="{{$route['uri']}}">
                                                    <input pattern="[a-zA-Zéè \-]{3,35}" required class="form-control" type="text" name="title"
                                                           id="linkTitle{{$key}}"
                                                           value=""
                                                           placeholder="Ajoutez ici un titre à ce lien pour le rendre disponibles pour les menus">
                                                    <span class="input-group-btn">
                                                     <button type="button"
                                                             class="btn btn-default ml-2 btnUpdateLink">Ajouter</button>
                                                </span>

                                                    {{Form::close()}}
                                                </div>
                                            @endif
                                        </li>
                                    @endforeach

the forms sends data to my store method :

public function store(LinkRequest $request)
    {

        //dd($request->all());

        try{

            Link::create($request->all());
            return redirect(route('Permission.index'))->with('success-message','Lien crée');

        }catch (Exception $e){
            $errorCode = $e->errorInfo[1];
            dd($errorCode);
            if($errorCode == 1062){
                return redirect(route('Link.index'))
                    ->with('error_message','Un lien existe déjà avec ce titre')
                    ->with('create_name',$request->get('title'));
            }
        }

    }

and here is my LinkRequest class :

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class LinkRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title'=> array(
                'required',
                'max:35',
                'unique:links,title,'.$this->Link,
                'regex:[a-zA-Zéè]',
            ),
            'route_name'=>array(
                'required'
            ),
            'href'=>array(
                'required'
            ),

        ];
    }
}
24 Feb
1 year ago

brian85 left a reply on Is Always Composite Primary Keys Not Supported

You're right and it works simply with the default way

public function links(){
        return $this->belongsToMany('App\Link');
    }

brian85 started a new conversation Is Always Composite Primary Keys Not Supported

Hello,

I've created an n:n relation with a pivot table between menu table and links table called link_menu (nothing fabulous...) and all I want is that the menu->links model retrieve all the links related. My link_menu table only need the composite primary key created like that : link_id menu_id

I tried to get the links but always a simple dd($menu->links()) shows nothing in attributes.

Do you have a way to solve this in keeping a clean composite primary key ?(I find it cleaner ensuring unique combinations)

Should I change the default way to access links in the belongsToMany in menu Model ?

Thanks for your help.

24 Jan
1 year ago

brian85 left a reply on Forcing A Unique Rule To Ignore A Given ID With Request Object

OK, I've found the way, my generated route is admin/Permission/{Permission}/edit so I had to pass my id and my parameters like that

public function rules()
    {

        //dd($this->Permission);

        return [
            'name' => array(
                'required',
                'unique:permissions,name,'.$this->Permission,
                'max:100',
                'regex:/^[a-zA-Z\s_\-]+$/'
            )
            ,
            'description' => array('required','max:500','regex:/^[a-zA-Zéèàç\s\.\\']+$/'),

        ];
    }

brian85 left a reply on Forcing A Unique Rule To Ignore A Given ID With Request Object

OK, but how passing this id ? Here is my PermissionRequest class

class PermissionRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => array(
                'required',
                'unique:permissions',
                'max:100',
                'regex:/^[a-zA-Z\s_\-]+$/'
            )
            ,
            'description' => array('required','max:500','regex:/^[a-zA-Zéèàç\s\.\\']+$/'),

        ];
    }
}

brian85 started a new conversation Forcing A Unique Rule To Ignore A Given ID With Request Object

Hello, I have a unique constraint on my permissions names so my update method use a PermissionRequest in order to handle my validation rules, how can I tell to ignore the current id's name for the unique rule ?

public function update(PermissionRequest $request, $id)
    {
        try{
            $permission = Permission::findOrFail($id);
            $permission->update($request->all());
            return redirect(route('Permission.index'))->with('success_message',
                'Permission modifiée');

        }catch (ModelNotFoundException $ex){

            return redirect(route('Permission.index'))->with('error_message',
                'Erreur : '.$ex->getMessage().'<br />'.$ex->getTraceAsString());

        }

    }
23 Jan
1 year ago

brian85 left a reply on Dd On Ajax Called Methods Returns Always Empty Attributes

OK, thank you, for the moment I'm making console.log from client side in order to debug.

brian85 started a new conversation Dd On Ajax Called Methods Returns Always Empty Attributes

Hello,

I'm having pain with an ajax called method.

First the same request as above :

$usersData = User::where('name', 'like', $queryString . '%')
            ->orWhere('email', 'like', $queryString . '%')
            ->orWhere('username', 'like', $queryString . '%')
            ->when($limit > 0 || $offset > 0, function ($usersData) use ($limit, $offset) {
                $usersData->take($limit)->skip($offset);
            })
            ->with(array('roles'=>function($query){
                $query->select('name');
            }))
            ->get();

works perfectly in the index method, the dd is correct and 'roles' contain just the 'name' field BUT if i call exactly the same request 'roles' contain ALL attributes and dd does'nt work i'm forced to make a console.log of my datas I'm going mad !!!

Thanks for your help.

brian85 left a reply on How To Use Laravel Route In Vue

Hello maybe vue-router is not required to do this ? You could simply call your component in your blade tempate and passing the login url as props like this

<my-component :url="path"></my-component>
22 Jan
1 year ago

brian85 left a reply on Passing Object To Link Edit From Vue To Laravel Edit Method

1 - the index view is loaded with ajax parameters given by the controller 2 - the ajaxQuery method in controller send json to view wich is interpreted by VueJs to display the list of users.

But how could the json data pass the $user object to the link in my template (instead of just passing the id) as this ?

@{{ route('admin.users.edit'),$user }} 

It's maybe not so important to pass the object instead of the id ? I'm asking myself because I see that the artisan command generates methods using the object instead of id.

brian85 left a reply on I Don't Understand The Utility Of Vue-router In A Laravel App

Thanks for your explanations I understand now.

brian85 started a new conversation I Don't Understand The Usage Of Vue-router In A Laravel App

Hello,

Laravel have a router so I don't understand for which case vue-router is intended ?

Thanks

brian85 left a reply on Passing Object To Link Edit From Vue To Laravel Edit Method

Not exactly, I'm creating a backend to list users of my app. So my list view of users receive datas from an ajax method, so I don't know how injecting each $user object in the edit link button. My question is how can I inject this user object like I could do with blade considering that my datas comes in JSON format Am i clear enough ?

Many thanks for your help.

brian85 started a new conversation Passing Object To Link Edit From Vue To Laravel Edit Method

Hello, My list view is using a vuejs component wich on onload event is getting json datas to display via ajax in a table but in order to pass my object $user to the edit method I can't do

@{{ route('admin.users.edit'),$user }} 

Actually I'm passing the '/edit' as agument to complete the url with the id, it works but I'm forced to change the edit method in genrated controller.

What would be the best solution in order to pass a user object to my controller ?

Thanks for your help.

20 Dec
1 year ago

brian85 left a reply on Skip Take Error

Ok I've seen my error $limit was nor set so it failed, sorry...

brian85 started a new conversation Skip Take Error

Hello, In order to limit my query in my controller I'm using skip take but skip make it fail. What is my mistake ?

$permissionsData = Permission::where('name','like', '"'.$queryString.'%"')
            ->orWhere('description','like', '"'.$queryString.'%"')
            ->take($limit)
            ->skip($offset)
            ->get()
            ->toJson();

Here is the exception throwned

QLSTATE[42000]: Syntax error or access violation: 1064 Erreur de syntaxe près de 'offset 1' à la ligne 1 (SQL: select * from `permissions` where `name` like "ad%" or `description` like "ad%" offset 1)"

Many thanks for your help

19 Dec
1 year ago

brian85 started a new conversation Passing Data From Component To Vue Instance In Order To Alter Data

Hello, I'm trying to create a sortable table component. json datas are given to the blade like that :

<sort-table :data="{{ $permissionsData }}"
                                    :columns="['id','name','description']"
                                    :filter-key="searchQuery">
</sort-table>

my component is here in a vue file :

<template>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th v-for="key in columns"
                @click="sortBy(key)"
                :class="{ active: sortKey == key }" class="bg-default text-white">
                {{ key | capitalize }}
                <span class="ml-2" :class="sortOrders[key] > 0 ? 'fas fa-caret-up' : 'fas fa-caret-down'">
          </span>
            </th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="entry in filteredData">
            <td v-for="key in columns">
                {{entry[key]}}
            </td>
        </tr>
        </tbody>
    </table>
</template>

<script>
    export default {
        // register the grid component
        name: 'sortTable',
        props: {
            data: Array,
            columns: Array,
            filterKey: String
        },
        data: function () {
            var sortOrders = {}
            this.columns.forEach(function (key) {
                sortOrders[key] = 1
            })
            return {
                sortKey: '',
                sortOrders: sortOrders
            }
        },
        computed: {
            filteredData: function () {
                var sortKey = this.sortKey
                var filterKey = this.filterKey && this.filterKey.toLowerCase()
                var order = this.sortOrders[sortKey] || 1
                var data = this.data
                if (filterKey) {
                    data = data.filter(function (row) {
                        return Object.keys(row).some(function (key) {
                            return String(row[key]).toLowerCase().indexOf(filterKey) > -1
                        })
                    })
                }
                if (sortKey) {
                    data = data.slice().sort(function (a, b) {
                        a = a[sortKey]
                        b = b[sortKey]
                        return (a === b ? 0 : a > b ? 1 : -1) * order
                    })
                }
                return data
            }
        },
        filters: {
            capitalize: function (str) {
                return str.charAt(0).toUpperCase() + str.slice(1)
            }
        },
        methods: {
            sortBy: function (key) {
                this.sortKey = key
                this.sortOrders[key] = this.sortOrders[key] * -1
            }
        }

    }
</script>

and here is my vue instance in a classic js file :

 import sortTable from '../../components/sortableTableComponent.vue';
// Vue.component('my-sortable-table',sortTable);

Vue.component('sort-table',sortTable);

var newTable = new Vue({
    el: '#app',
    data: {
        searchQuery: '',
        gridColumns: [ 'id','Nom', 'Description'],

    },
    computed: {
        function(){
            console.log('test data : '+this.data);
        }
    },
    methods: {

    }
});

All I want is to alter the data in order to push some columns to each records.

How can I access from the vue instance to the data collected by my component in props ?

Thaks for your help.

18 Dec
1 year ago

brian85 left a reply on Blank Page On A Freshly Created Controller

OK I just found my problem it was in my route, I've missed to prefix my controller with Admin\

Route::group(['prefix'=>'admin','middleware' => ['role:Admin|direction']], function () {

    Route::get('/', ['as' => 'adminHome', 'uses' => 'Admin\[email protected]']);
    Route::resource('Permission','Admin\PermissionController');
});

brian85 started a new conversation Blank Page On A Freshly Created Controller

Hello,

I created a controller with the artisan command

php artisan make:controller Admin/PermissionController --resource

I've added in my route group the route to my controller

Route::group(['prefix'=>'admin','middleware' => ['role:Admin|direction']], function () {

    Route::get('/', ['as' => 'adminHome', 'uses' => 'Admin\[email protected]']);
    Route::resource('Permission','PermissionController');
});

and finally added a link in my view

<a href="{{ route('Permission.index') }}">Permissions</a>

All I got is a blank page with no errors... What do I have missed ? Thanks for your help.

17 Dec
1 year ago

brian85 left a reply on Vue Script Inside Blade Section

Ok thanks, I'll investigate your solution

brian85 left a reply on Vue Script Inside Blade Section

Update : If I paste the code inside my homeApp.js inside home.blade it works. If I call it like that :

<script src="{{asset('js/home/homeApp.js')}}" />

It fails with Error Vue is not defined ! wtf !

brian85 left a reply on Vue Script Inside Blade Section

nope I tried to write my <script call outside the vue el and the problem is the same how do you handle the call to your vuejs scripts ? At the bottom of your layout or inside the content blade ?

brian85 left a reply on Vue Script Inside Blade Section

I'll have a big javascript file which contain all my Vue scripts or many little files at the end of my layout so ?... It's a bit weird don't you think ?

brian85 started a new conversation Vue Script Inside Blade Section

Hello,

Here is my problem, I have a general layout for my app which provides navbar, sidebar and the content is in a blade.

The layout load Vue.js and other required files by loading app.js at the end of the layout.

My problem is that when I want to load my Vue script in the section content, VueJs seems to be not loaded. I tried to add window.addEventListener('load',function(e){ before but it fails too.

How can you handle it ? I don't want to load all my javascrits at the end of the layout

Thanks.

16 Dec
1 year ago

brian85 left a reply on Props Data Are Not Displayed In My Blade

OK I've found my error, I've missed to pass my value message to the component in blade like that :

<card1 :message="message"></card1>

brian85 started a new conversation Props Data Are Not Displayed In My Blade

Hello, I'm new to L5 and vue and I'm trying to render a simple template like that : here my blade :

<card1></card1>

and here my js :

window.addEventListener("load", function(event) {

    Vue.component('card1',{
        props:['test','message'],
        template:'<h1>@{{ message }}</h1>',
    });

    var homeVue = new Vue({
        el : '#app',
        data : {
            message : 'cococococo',
        },

    });
});

it only display @ inside the

and without @ nothing is displayed please can you solve it ? Thanks

13 Dec
1 year ago

brian85 left a reply on Laravel-Permission : What's The Utility Of The Guard_name ?

Many thanks for your help ! Sure it will be usefull for my project.

brian85 started a new conversation Laravel-Permission : What's The Utility Of The Guard_name ?

Hello, I'm new to laravel and I'm playing with Spatie's Laravel-Permission package I have 2 questions.

1 -I'm asking myself what's the aim of the guard_name in the different tables ? Is it intended to have a different set of permissions ?

2- In order to protect pages and sometime sections of pages my strategy is to use the middleware to protect some pages to be accessed and to put roles of the user in session, so I could check permission in my blade to protect a section.

Am I right ? Thanks for your help.

06 Dec
1 year ago

brian85 left a reply on Class 'Collective\Html\HtmlServiceProvider' Not Found

yes I've seen that my ide was not making command from the current directory so I think it was this the upgrade is now successful, this is the return :

> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: laravelcollective/html
Package manifest generated successfully.

Many many thanks for your patience !

brian85 left a reply on Class 'Collective\Html\HtmlServiceProvider' Not Found

nope it stays to 5.4.36 I don't understand

brian85 left a reply on Class 'Collective\Html\HtmlServiceProvider' Not Found

I don't know... I'm restarting to learn Laravel since my first install so if want to upgrade from 5.4 to 5.5 this json line should upgrade the version ?