SafeMood

SafeMood

Member Since 5 Months Ago

Experience Points
2,000
Total
Experience

3,000 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
8
Lessons
Completed
Best Reply Awards
1
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.

Level 1
2,000 XP
Jul
02
3 months ago
Activity icon

Replied to How To Disable CSRF Protection On API Routes When Using Passport And JavaScript

Good im not tell removing the auth:api is the solution

but just want to make sure that is not a csrf probleme

so when u use the auth:api u should know

"Laravel includes an authentication guard that will automatically validate API tokens on incoming requests. You only need to specify the auth:api middleware on any route that requires a valid access token"

so u need to send the access token

see docs on how u can create one and how u can pass it in requests

api-authentication

Activity icon

Replied to A Course On How Design Patterns Are Implemented In The Laravel Framework

Hi @ideasfera

as much as i know this course does not exist but i think this book it may help you

"Design Patterns in PHP and Laravel"

by Kelt Dockins (Author)

Activity icon

Replied to How To Disable CSRF Protection On API Routes When Using Passport And JavaScript

Hi @naktoschi

u should write in except array in VerifyCsrfToken.php

protected $except = [ 'api/*'];

not only '/api'

Jun
24
3 months ago
Activity icon

Replied to Separate Roles/permissions For Users Belonging To Multiple Organizations

Hello @kreierson

i recommend you to use this package spatie/laravel-permission it will do all the hard work for u it has also a very good documentation

https://github.com/spatie/laravel-permission

Activity icon

Replied to Change App Default Locale Dynamically

Hello @nhayder

i think its the best way to do it in a prefixed routes (my opinion)

i guess u should take a look

to this article

https://laraveldaily.com/multi-language-routes-and-locales-with-auth/

Activity icon

Replied to Yajra Datatable Displays As JSON And Not Table

Hello @kish77

its by default

In addition to returning strings from your routes and controllers, you may also return arrays. The framework will automatically convert the array into a JSON response:

check docs

https://laravel.com/docs/5.8/responses#creating-responses

if i get u right u want to send result of the query to the view u can simply put it in a variable then return this variable to the view with compact()

$results = DataTables::of(Payment::query())->make(true);

return view('frontend.index', compact('results'));

in ur blade just make a simple foreach loop

@foreach($results as $result)

anything

@endforeach

Apr
24
5 months ago
Activity icon

Replied to How To Make A Dynamic Category Tree In The Route?

@ME10071990 - @me10071990

in ur controller

you should have a method to get that parameter

public function show($category) {

    $category = Category::where('category', $category)->first();

    return view('category', compact('category'));

}

ur link it will be something like that

<a href="route('category.show',[$'category'])"

Apr
23
5 months ago
Activity icon

Replied to Ajax Response "Malformed UTF-8 Characters, Possibly Incorrectly Encoded"

Hi @codebullet

change it with this

return response()->json(['properties' => $properties]);

Activity icon

Replied to How To Prevent From This Javascript From Load ?

@FareedR

make a send button its better u dont want to send request to server in every change

or if u do

use

onblur event for both fields if user leave both fields then u make a post

Activity icon

Replied to Creating A Contact Form Without Controllers And Migrations

@roottech

u need to do that in the clientside

there is

https://smtpjs.com/

u can use it but i don't know if they are trustworthy u can try it with a fake email

Activity icon

Replied to (1/1) BadMethodCallException Call To Undefined Method Illuminate\Database\Query\Builder::relationPaie()

@mouzak

Error say must be of the type array, string give

try this

save(new Paie(array($attributes)));

Activity icon

Replied to Voyager Vs Nova

@michalis ur welcome

yes u need to migrate your database cuz if u didnt all your settings will be lost it will return to default settings (voyager settings) i didn't try nova yet but in any app to save things u need database always there is default settings then u make ur own custom this why u will need seeders to save your settings if u want u cant save ur content too

See this video to learn more about seeders

https://www.youtube.com/watch?v=U5gxiPNcSZU

Activity icon

Replied to How To Make A Dynamic Category Tree In The Route?

@ME10071990 - ur welcome any time :D

if u have multiple designs for every category so u need to hve multiple views

in conroller

for every category return the view belongs to it

Activity icon

Replied to JQquery Loader Works Only On The First Ajax Call

@Jacobs

success: function (data) { if (data.success) { callback(data.html); }

// so here u need to recall that jquery.loder again },

Activity icon

Replied to How To Prevent From This Javascript From Load ?

hi @FareedR

u can put it inside an event

like

$( "#target" ).click(function() { /your code });

Activity icon

Replied to File_put_contents In Framework/views Failed To Open Stream: No Such File Or Directory

@mortezapiri

try to access that folder and do it manually and see how it goes

Activity icon

Replied to How To Make A Dynamic Category Tree In The Route?

hi @alex_storm

u need to pass category in your route as a parameter

like Route::get('/{category}, '[email protected]')->name('category.show');

in ur controller u can handle this request

check the database

get data

and return ur view if u found that category or do abort(404)

Activity icon

Replied to JQquery Loader Works Only On The First Ajax Call

@jacobs

when u refresh the page it work again right ?

Activity icon

Replied to How Much Of Code Syntax You Guys Remember?

its ok we all forget thank god now we have IDE there is always a new ways to do stuff coz we code while we are thinking syntax will always change wt u should remember is algorithms logic this something alaways will stay with u

Activity icon

Replied to Changing Route Parameter In Current Route And Display The 'new' Url

hi @richardv

// if i did understand wt u want

if u have this in ur route /{locale}/{company}/{id}

so ur link need to be like this

href="{{route('YOUR_ROUTE',[ Request::segment(1) ,Request::segment(2),Request::segment(3)])}}"

Activity icon

Replied to JQquery Loader Works Only On The First Ajax Call

hi @jacobs

u need to recall ur js after ajax sucess

Activity icon

Replied to Voyager Vs Nova

Hi @michalis

yes all ur setting will be stored in the database and i think all of them do that

or where they can save data ?!

but this probleme can be solved with seeders u can use iseed package its perfect for that

iSeed

nova is very good too

but u can use voyager i did use it in a project it work perfectly fine

documentations are available and good for both of them

Apr
22
5 months ago
Activity icon

Replied to How To Add A Foreign Key To A Table After Migration Done Laravel

@MKBAT - thnx good pointing

but runnig rollback will erase data coz it will drop last migrations

i hope it work for him

Activity icon

Replied to How To Add A Foreign Key To A Table After Migration Done Laravel

@ABDULBAZITH - ur welcome any time

but using sql cmd u will lose your settings by losing the data or changing the environment

Activity icon

Replied to How To Add A Foreign Key To A Table After Migration Done Laravel

@ABDULBAZITH - @abdulbazith

ur welcome

26 tables i guess u should first export ur dataabse as a backup

then u can use iSeed to save ur data in seeders its a laravel package that provides a method to generate a new seed file based on data from the existing database table.

after that make empty ur database dont drop it just select all tables and choose empty

go to ur migration folder and delete all ur migrations

use can now genrate all those migration by "Laravel Migrations Generator"

it Generate Laravel Migrations from an existing database

migrations-generator

php artisan help migrate:generat just use this code

Inverse seed generator (iSeed)

php artisan iseed my_table,another_table put all ur table names that way

now u can drop ur database tables and use

php artisan migrate --seed

it will make ur tables and fill them with data as they was

Advice: don't play with database in production

Apr
21
5 months ago
Activity icon

Replied to How To Add A Foreign Key To A Table After Migration Done Laravel

@abdulbazith

u can use

php artisan make:migration add_product_category_id_to_product --table=product

if ur other table name is categories

Foreign Key : product_category_id

$table->foreign('product_category_id')->references('id')->on('categories');

Or can just use php artisan migrate:rollback

add ur column to the same migration file then migrate again

but this will erase any data in ur table

u can alaways take a look to the Documentation

https://laravel.com/docs/5.8/migrations#foreign-key-constraints

Activity icon

Replied to Trying To Get Property Of Non-object

@CHRON -

hi @chron

if u still having to same prob

just change this part

  • {{ $user->customer->firstname }}
  • to

  • {{ ($user->customer) ? $user->customer->firstname : "" }}
  • Activity icon

    Replied to How To Save Multiple Models From One Form

    hi @memele

    u can use jQuery serialize() Method

    You can select one or more form elements (like input and/or text area), or the form element itself.

    take a look here https://www.w3schools.com/jquery/ajax_serialize.asp

    this may help u too

    https://www.codeproject.com/Questions/330925/access-serialize-jquery-in-php

    another example with a demo

    https://www.tutorialspoint.com/online_jquery_editor.php

    Apr
    20
    5 months ago
    Activity icon

    Replied to Javascript Event Listener Value Does Not Working

    @sergiu17

    yes ur right i did miss that :v

    he should test to check if the value is set or not

    Activity icon

    Replied to Javascript Event Listener Value Does Not Working

    @tahsan

    u can add a hidden input to save data in it

    document.getElementById("wrap").addEventListener('click',()=>{ var data=document.getElementById("wrap").checked; document.getElementById("hiddenInput").value = data ; }); here u should test to check if the value is set or not console.log(document.getElementById("hiddenInput").value);

    Activity icon

    Replied to Where Are You All From?

    Hello From Tunisia :D

    Activity icon

    Replied to Add Image As Background

    @aishahyaacob

    go to the front and inpect this image and see how the url look like

    sms folder should realy exist inside the public folder and the image should be inside sms folder too make sure of that coz i didnt see it !

    Activity icon

    Replied to Add Image As Background

    hi @aishahyaacob

    Put images in ur public folder

    make sure that u did run this cmd " php artisan storage:link "

    Css :

    background-image: url("{{asset('sms/image.jpg')}}");

    sms folder should realy exist inside the public folder

    hope this help u