ayoubelmoudni

ayoubelmoudni

Member Since 11 Months Ago

Oujda

Experience Points 13,190
Experience Level 3

1,810 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 119
Lessons
Completed
Best Reply Awards 1
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

16 Mar
4 days ago

ayoubelmoudni left a reply on Laravel Update Or Remove

Hello, You need an id or something to indetify each row in the edit view and when user click the remove/delete button have a hidden input that update value with the id of the removed row, in your controller get the value of that hidden input and get the ids loop through them and delete them and then go with the update.

ayoubelmoudni left a reply on Getting 500 Error After Deploying My Laravel App

Hello, i think you should change the group permission as well not only the user

15 Mar
5 days ago

ayoubelmoudni left a reply on Run A Method Or Command When A Row Is Expired.

@stereoh yes this will work, but not for my needs, i have the state column that goes from 1 - 2 - 3 - 4, every number mean something to the application and i take all the publications and in the view i will check the state value to display every state in a different form but in the same table, or not display it at all in some cases.

ayoubelmoudni left a reply on Run A Method Or Command When A Row Is Expired.

@STEREOH - Thank you for replying, yes the select based on time will work but i prefer to remove those conditions from the views as much as i can.

ayoubelmoudni started a new conversation Run A Method Or Command When A Row Is Expired.

Hello guys,

I have a table which has user publications, when the user publish a publications he choose a date that this publication will remains visible in the platform, i want a way to flip the state of a publication that time is come to now be shown anymore (date of publication is equal or greater then date system), i know about the cronjob way but i wanted to ask here if there's a better way to do this because i think the cronjob way is not good for this i will have to run a command every minute which i prefer not to do, i only need ideas not code.

Thank you.

14 Mar
6 days ago

ayoubelmoudni left a reply on Archive Multiple Tables In A Laravel App

@TALINON - That's awesome i didn't know that you can create a clone of a table by just using the LIKE keyword, i already solve my situation by regenerating the migrations and rename theme by adding _archive, and it's working just fine, but the approach you suggest is more code friendly i will consider it next time for sure.

for the migration i will mention that if someone want to use your approach that after the tables are created you con use Xethron/migrations-generator package to generate only the new tables.

Thanks @

ayoubelmoudni started a new conversation Archive Multiple Tables In A Laravel App

Hello guys,

i have an app already published and have around 46 tables/modals, i want to create archives for all those tables since the tables are getting bigger, am already using softDelete and want to create a cronjob that will move the deleted lines to the corresponding tables, now i know how to do this once i have the tables, but right now what am not sure of how to do is to create the tables with the same structure as the old ones, for example: for the user table i will need a user_archive table, the problem i can't take the migration of user table to create a user_archive table because i added so many columns through the life of this app, so it will be very hard to do it for each table, is there a package that helps with creating archives or another way to accomplish what am looking for ?

Thanks in advance.

ayoubelmoudni started a new conversation Is It Safe To Delete .env.save File From Production ?

Hello guys, the title say it all, i noticed that i have a .env.save file on my server is it safe to delete ? and why is being generated in the first place ? Thanks in advance.

25 Jan
1 month ago

ayoubelmoudni left a reply on Display A Message In A Local That's Different From The Current Local Of The App.

@CRONIX - @cronix this is a actually a nice approach to do it, but a quick question: wouldn't it be a problem since some interaction in the browser the user my think he is active (scrolling or filtering in a table just the HTML DOM without any interaction with the Server) i think this may create a confusing to the user, am i thinking about it right or am just being thinking a lot about it ?

ayoubelmoudni left a reply on Display A Message In A Local That's Different From The Current Local Of The App.

@DOUGLASAKULA - Thank you @douglasakula i think this will work but i don't want to create a cookie just for this small thing just to display one message, anyway I'll give it some research and i don't find a better solution I'll go back to implement what you suggested.

ayoubelmoudni started a new conversation Display A Message In A Local That's Different From The Current Local Of The App.

Hello guys, i have a question if someone can help me it will be awesome. My situation is this, i have a website that supports 6 different languages, all work great, when user is not authenticated i have a drop-down in the navbar to choose which Lang user want to see the website with, after user register he choose a Lang and then when logged in the website is in the Lang he chooses, all great until now, when user is not active for more than 30min i logged him out and flash a message that his session is expired, that message is begin displayed in the default Lang of the website since the user is logged-out, how i can display only this message in the user Lang ? without changing the local of the entire application ?

17 Dec
3 months ago

ayoubelmoudni left a reply on How To Redirect The User Back To The View With Error When The Controller Return Exception?

Hello guys,

i don't know if this thread still alive but i think u can't redirect from a catch block, that's what i found after some search.

14 Dec
3 months ago

ayoubelmoudni started a new conversation Laravel Lang From Another Path Improved

hello guys,

i need some help with loading a different lang folder from the default one, so far i did for one path but i want to make it dynamic by checking a var in .env file, so i can't refere to config('custom.lang_folder') why ??, how i would access this var, here's what i followed to make it work for one folder: https://laracasts.com/discuss/channels/general-discussion/laravel-lang-from-another-path

25 Oct
4 months ago

ayoubelmoudni left a reply on Howto Convert Select Box Into Dates In JavaScript?

hello,

i can't give you the javascript code that will work but i can tell you how to go about it,

u'll need to format the two dates 'date_from' and 'date_to' manually and then convert them to minutes or milliseconds then substract date 'date_to' from date 'date_from', than u'll have the difference between the two dates, than you can convert that result to years months days, there are a lot of functions to do so just give it a search.

some links to get you started: https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_parse2 https://www.i-programmer.info/programming/javascript/6322-date-hacks-doing-javascript-date-calculations.html

ayoubelmoudni left a reply on Problem When Reloading Page

Can i ask why you are using POST, it doesn't look like your inserting data so use GET ?

24 Oct
4 months ago

ayoubelmoudni left a reply on Update User Status After 6 Month Or More

@Cronix Thanks, i will give it a try. @thomaskim Thank you too.

ayoubelmoudni left a reply on Update User Status After 6 Month Or More

@thomaskim i didn't think of this, it's actually pretty good, but i already have my login have a lot of logic i don't want to continue on it, am searching for something like scheduling but without actually schedule just from laravel

ayoubelmoudni left a reply on Update User Status After 6 Month Or More

@Cronix i know about scheduling and i prefer to stay away from it since i've never use it so i can't use it for production now.

ayoubelmoudni started a new conversation Update User Status After 6 Month Or More

Hello guys,

i have a questions and want to get your opinion about it if possible,

the thing is that i have a user table and i provide a subscription to the user, the user can choose between 6 months to 12 months, now i have this function working but what i don't know how to do is that reset the user status to basic after that time pass how to do that ? how to run a function that will update the user knowing that every user have a different end date.

23 Oct
4 months ago

ayoubelmoudni left a reply on Resource Not Found!! Laravel 5.7

Thanks @Vilfago and @munazzil i solve the problem, it wasn't related to the routes as i thought it was one of the middleware that run durring every request i forget about it and it was redericting me to no place and that rase the Resource not found!! exeption, anyway the answer that helped me to find the problem was @munazzil answer when i he told me to run 'php artisan serve' i found the middlewares that run on that specific route and then find the problem, Thanks again guys.

ayoubelmoudni left a reply on Resource Not Found!! Laravel 5.7

@munazzil sorry the route is registred i run the command and i wasn't saving my code, now the rout exist and the problem still exist

ayoubelmoudni left a reply on Resource Not Found!! Laravel 5.7

@Vilfago yes i did, and the same problem still exist.

ayoubelmoudni left a reply on Resource Not Found!! Laravel 5.7

@munazzil i have over 150 routs, i run the command and fount out that is 'admin/transactions' not registred, but i don't know why?

ayoubelmoudni left a reply on Resource Not Found!! Laravel 5.7

@Vilfago no, i only have the routes that i write here, the other routes start different then 'admin'.

ayoubelmoudni left a reply on Resource Not Found!! Laravel 5.7

@Vilfago still the same problem

ayoubelmoudni started a new conversation Resource Not Found!! Laravel 5.7

I have in my web.php the following routes:

Route::get('admin', ['as' => 'admin.login', 'uses' => '[email protected]']);
Route::post('admin', ['as' => 'admin.postLogin', 'uses' => '[email protected]']);
Route::group(['middleware' => 'isAdmin'], function () {
  Route::get('admin/transactions', ['as' => 'admin.transactions', 'uses' => '[email protected]']); // problem is when i redirect to this route
});

and my controller as follow:

public function postLogin(Request $request){
  //some logic
  return Redirect::to('admin/transactions');
}

and the transaction action:

public function transactions(){
    dd('ok');
}

but i still get Resource not found!! why? Can anybody help me?

Note!!: I have other routes working fine so i don't think it's an .htaccess problem

19 Oct
5 months ago

ayoubelmoudni left a reply on Laravel Validate A Field To Some Value If Another Field Is Different From The Same Value ?

Hi @Borisu,

can u provide a small example with custom validation to get me started, because i didn't understand it from the docs

ayoubelmoudni started a new conversation Laravel Validate A Field To Some Value If Another Field Is Different From The Same Value ?

Hello guys,

in my form i let the user select two countries, now the two countries must not be empty means the user have to select two in two diferent selects and one of the fields must be lets say "england" if field1 is england than the field2 must be required but it's not important if it's equal to "england", if field1 is not equal to "england" than field2 must be required and equal to "england" ?

something like this i think:

$rules =[
  'field1' => '', //if this equals 'england' the field2 is just required
  'field2' => '' // if field1 is different from 'england' than this field must equal 'england'
];

any idea how i can do this with laravel rules?

14 Oct
5 months ago

ayoubelmoudni left a reply on Sharing A Variable And Referencing It In All Files Inside Lang Folder Laravel

@Cronix , this is actually solve my problem (i had a problem with the syntax but now it's working), Thank you.

ayoubelmoudni left a reply on Sharing A Variable And Referencing It In All Files Inside Lang Folder Laravel

sweet, that's true about the env() returning null after running config:cach. but still even if i have access to a variable or in this case the costom config file and retrieve the value from it, i can't concatenate it with the value of af a key inside a file in Lang folder, all the files return an array [key => value], when i call config('somekey') i get a syntax error?? is it just me or i can't call a method inside an array?

13 Oct
5 months ago

ayoubelmoudni started a new conversation Sharing A Variable And Referencing It In All Files Inside Lang Folder Laravel

Hello guys, I want to reference a variable in all files inside the Lang folder, it is the same variable i want to store the variable in .env and retrieve it in some file in Lang folder so that when i change the value in .env the value will change in all files and there for in views for all languages. something like this if possible:

'key' => 'app name is env('APP_NAME')',

03 Oct
5 months ago

ayoubelmoudni left a reply on Laravel 5 - Only Home Page Route Working On Live Server

Hi guys, if the accepted answer doesn't work for you, all you have to do is change the path from your public folder to "/" in .htaccess: it should look like this "RewriteBase /" source : https://stackoverflow.com/questions/16885467/laravel-sends-the-server-on-10-redirects