Posts

Showing posts from May, 2026

Using Faker Slug in Laravel

  {use Illuminate\Support\Str; use App\Models\Post; class PostFactory extends Factory { protected $model = Post::class;   public function definition(): array { return [ 'title' => $title = $this->faker->sentence(), 'slug' => Str::slug($title), 'content' => $this->faker->paragraph(), 'published_at' => null, ]; }

Laravel Working with Dates and Time

      use  Carbon\Carbon ;            $oldDate   =   '2023-7-15' ;          $todayDate   =   date ( 'Y-m-d' ) ; //Todday's date 30-07-23          $futureDate   =   '2023-08-3' ;            $parseOldDate   =  Carbon :: parse ( $oldDate ) ;          $parseTodayDate   =  Carbon :: parse ( $todayDate ) ;          $parseFutureDate   =  Carbon :: parse ( $futureDate ) ;                      if   ( $parseOldDate -> isPast ( ) )               {               return   "this  $oldDate  is in the past " ;      // check if date is in the past              }  ...

Generating String Acronym in Laravel

  use Illuminate\Support\Str; Str:: acronym('Gideon Asare')  // GA

Running MyPhpAdmin on Linux

  sudo   / opt / lampp / lampp start //   if  this error appears on the prompt //  XAMPP: Starting Apache...fail.     //  run this  command sudo   / etc / init.d / apache2 stop   sudo   / opt / lampp / lampp start   //  run this xhost  si:localuser:root   sudo   / opt / lampp$  ls   -l  manager * //  check the  link   http: // localhost: 8080 / dashboard /   //  get access xampp.config cd  .. / .. / opt / lampp / etc / extra   //  retriction access to htdocs sudo   chmod   -R   777   / opt / lampp / htdocs   //  moving wordprss folder from linux folder to wordpress folder  in  htdocs mv  . / wordpess .. / .. / opt / lampp / htdocs / wordpress   //  access to wordpress directory cd   .. / .. / opt / lampp / htdocs / wordpress   // open directory code .