Omda

Omda

Backend Developer at Kashta Lab

Member Since 8 Months Ago

Khartoum

Experience Points
2,150
Total
Experience

2,850 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
10
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.

Level 1
2,150 XP
Nov
04
1 week ago
Activity icon

Started a new Conversation How To Access Classes Within Folder Inside Root Folder App

I have created a folder inside the root folder of app call /Car like so :

- app
    - Car
        - HondaMachine.php
        - Car.php

and when I need to use class within this folder "Car" laravel says class HondaMachine.php not found this the controller :

<?php

namespace App\Http\Controllers;

use App\Car\Car;

class CarController extends Controller
{
    
    public function createCar()
    {
        $car = new Car();
        print_r($car->buildCar('Honda', 24, 4));
    }
}

this the car.php file

<?php
namespace App\Car;

use App\Car\HondaMachine;

class Car 
{

        public $name;

    public function buildCar($name, $size, $noWeels)
        {
        $carHonda = new HondaMachine(); 
        }
}

and hondaMachin.php look like :

<?php 
namespace Ap\Car;

class HondaMachine
{
        public $size;

        public function setMachine($size)
        {
            $this->size = $size;
        }

    public function getSize()
    {
        return $this->size;
    }
}

I use most of the suggestion :

- php artisan config: clear
- php artisan config: cache
- php artisan optimize
- composer dump-autoload

all of them not working with me, any help (:

error message :

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Class 'App\Car\HondaMachine' not found

Sep
23
1 month ago
Activity icon

Replied to Route() Helper Returns Invalid URL For Named Route With Two Optional Params

@zkelo okay so you can try this replase this $router->get('/test/{id}/{name}' by this

$router->get('/test/{id?}/{name?}'
Activity icon

Replied to Route() Helper Returns Invalid URL For Named Route With Two Optional Params

@zkelo if that not working for you trying this will solve your problem


$router->get('/', function () {
    return redirect()->route('test', [1, 'Zkelo']);
});

$router->get('/test/{id}/{name}', [
    'as' => 'test', function ($id = 0, $name = '') {
        if ($name) {
            return "Name: $name (ID: $id)";
        }
        if ($id) {
            return "ID: $id";
        }
        return 'Need an id or name!';
    }
]);

Activity icon

Replied to Route() Helper Returns Invalid URL For Named Route With Two Optional Params

@zkelo user this

Route::get('/', function(){
    return redirect()->route('test');
});
Activity icon

Replied to How Can I Know In Which Component I Was There

@maverickchan yah, i miss it when i am writing post, but it has written correct on my code.

Sep
22
1 month ago
Activity icon

Replied to Testing Logout Through Factory

@basemrayleigh you can user this

/** @test */
    public function can_a_user_logout()
    {
        $user = factory(\App\User::class)->create();
        $this->be($user); // login 

        $this->get('/logout')
            ->assertRedirect('/login'); // redirect to login, 
    }
Activity icon

Replied to How Can I Know In Which Component I Was There

@mstrauss when i hit click, there is nothing happen

Activity icon

Replied to How Can I Know In Which Component I Was There

@mstrauss thank you to reply, its doesn't work

Activity icon

Started a new Conversation How Can I Know In Which Component I Was There

I am working with vue js, and I have darggable component items, I generated draggable component using for loop to display component, so how can i detected in which component I am there, when click on component.

import item from './component/itemComponent.vue'; 
<dragable
   :element="ul"
   v-modal="list">
  <li v-for="(index, i) in list" :key="i">
   <item :indexItem="index"></item
 </li>
</dragable>

and item component look like so

<template>
    <a @click="getComponentAttributes()" class="btn btn-primary">{{ intemIndex.name }} </a>
</template>

<script>
  export default {
   props:['indexItem'],
   data(){
      return {
         isOpen: false
     }
   },
   methods : {
    getComponentAttributes(){
             this.isOpen = true; // its not working just for one component it working for all component and  I need to implment to one component specific current component
            console.log(this.indexItem);  // is not working as I need
       }
  } 
}
</script>
Sep
17
1 month ago
Activity icon

Replied to Call To A Member Function SetCookie() On Null On Laravel Middleware

@gabotronix use response()->view('auth.login'); it will solve your problem

Sep
16
1 month ago
Activity icon

Replied to How Can I Get Id Of Created Row When Testing

@sti3bas thank you for your consideration

Activity icon

Replied to How Can I Get Id Of Created Row When Testing

@sti3bas so, if you doesn't recommended to convert model to array, so what is the alternative ?

Activity icon

Replied to How Can I Get Id Of Created Row When Testing

@sti3bas yah i know create will insert record to database, but i need to insert record to database using test case.

Activity icon

Replied to How Can I Get Id Of Created Row When Testing

@munazzil I need id of document not user_id

Activity icon

Started a new Conversation How Can I Get Id Of Created Row When Testing

i am working with phpunit when i created new record using endpoint, i cant get id of my new record

/** @test */
    public function authenticated_user_should_create_document()
    {
        $this->withExceptionHandling();
        // create user
        $user = factory('App\User')->create();    
        // authenticated user
        $this->be($user);
        // hit the server to store document
        $document = factory('App\Document')->make(['user_id' => $user->id]);

        $response = $this->post('gate/document', $document->toArray());

    dd($document->path());
        $response->assertRedirect('gate/document/'.$document->path().'/editor');

and the document.php

 public function path()
 {
        return $this->id;
 }

the result is null

Sep
15
1 month ago
Activity icon

Replied to My Factory Is Not Applied To My Test Cases

my issue is solved, the problems i found there are two UserFactory.php one in root directory database and another in Module, cause i use Module package.

Activity icon

Replied to Column Not Found: 1054 Unknown Column '_method' In 'field List'

@irankhosravi did you have $fillable in your faq model ?

Activity icon

Replied to My Factory Is Not Applied To My Test Cases

@ftiersch @tray2 @tykus hi guys, I remember I am using use DatabaseTransactions will this affect something ?

Sep
14
1 month ago
Activity icon

Replied to My Factory Is Not Applied To My Test Cases

@tykus this my attributes in mode user

 protected $table = 'users';

    /**
     * The attributes that are mass assignable.
     *
     *
     * @var array
     */
    protected $fillable = ['name', 'email', 'password'];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
Activity icon

Replied to My Factory Is Not Applied To My Test Cases

@ftiersch this my migration

public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('email');
            $table->string('password');
            $table->boolean('verified')->default(false);
            $table->rememberToken();
            $table->timestamps();
        });
    }
Activity icon

Replied to My Factory Is Not Applied To My Test Cases

@ftiersch yes under database/factories

Activity icon

Started a new Conversation My Factory Is Not Applied To My Test Cases

i am working with phpunit when i create model using factory is not create the field i was put in UserFactory, even if i delete UserFactory it created fields, i dont know what is going on.. this userFactory file

use Faker\Generator as Faker;

$factory->define(\App\User::class, function (Faker $faker) {
    static $password;
    return [
      'name' => $faker->name,  
      'email' => $faker->unique()->safeEmail,  
      'password' => $password ? : $password =bcrypt('12345678'),  
      'remember_token' => str_random(80),  
      'verified' => 1,  
    ];
});

and when use this

 $ownerUser = factory(\App\User::class)->create();

and result equal

    "name" => "Rollin Ebert"
    "email" => "[email protected]"
    "password" => "y$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm"
    "remember_token" => "kZx1MiWx5G"
    "updated_at" => "2019-09-14 12:00:09"
    "created_at" => "2019-09-14 12:00:09"
    "id" => 11
Sep
12
2 months ago
Activity icon

Replied to I Need Some One Explain For Me Phpunit.xml Vs .env

@ftiersch okay, how can i know which environment i use when run .\vendor\bin\phpunit

Activity icon

Replied to I Need Some One Explain For Me Phpunit.xml Vs .env

@ftiersch yes i am writing my test, but i cant decide what is environment working because i am using databasemigrations

Activity icon

Replied to I Need Some One Explain For Me Phpunit.xml Vs .env

@ftiersch that is good, but when i am run my phpunit it doesn't do like you said, even if i remove line <env name="DB_CONNECTION" value="testing"/> or <env name="DB_DATABASE" value=":memory:"/> nothing happen, i mean it work and i can't detected what environment its working .

Activity icon

Started a new Conversation I Need Some One Explain For Me Phpunit.xml Vs .env

i working with phpunit test but i can't differentiated between two files

Activity icon

Replied to I Upgrade From 5.6 To 5.7 Then All My Api Not Working

@himanshurajvanshi already i did laravel/framework dependency to 5.7.* and i am not use laravel/passport

Activity icon

Replied to I Upgrade From 5.6 To 5.7 Then All My Api Not Working

@ftiersch after i change to what you said i ge this new error Class App\Http\Controllers\App\Http\Controllers\API\HintsApiController does not exist

Activity icon

Started a new Conversation I Upgrade From 5.6 To 5.7 Then All My Api Not Working

after updgrade all my controller under folder API not working but before that its working fine. so i don't know what is happing. this my api route

<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::get('/user', function(Request $request) {
    return Auth::user();
})->middleware('auth:api');


Route::group(

    [
        // 'middleware' => 'auth',
        'namespace' => '\API'
    ],

    function () {
        Route::resource('apiHints', 'HintsApiController');
    }
);

so when i hit postman this http://localhost:8000/api/apiHints

i got

Class API\HintsApiController does not exist

then do php artisan config:cache, php artisan config:clear, composer dumpautoload also not work.

Sep
11
2 months ago
Activity icon

Replied to My Testing Taking Too Much Time To Pass

i update my question @martinbean

'A_testing' => [
            'driver' => 'mysql',
            'host' => env('DB_TEST_HOST', 'localhost'),
            'port' => env('DB_TEST_PORT', '3306'),
            'database' => env('DB_TEST_DATABASE', 'database.sqlite'),
            'username' => env('DB_TEST_USERNAME', 'root'),
            'password' => env('DB_TEST_PASSWORD', ''),
            'unix_socket' => env('DB_TEST_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
        ],
Activity icon

Started a new Conversation My Testing Taking Too Much Time To Pass

its working fine but its take a wile to run once function... take about 1.23 minuts.

this phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="vendor/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false">
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>

        <testsuite name="Feature">
            <directory suffix="Test.php">./tests/Feature</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
        </whitelist>
    </filter>
    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="BCRYPT_ROUNDS" value="4"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="MAIL_DRIVER" value="array"/>
        <env name="QUEUE_CONNECTION" value="sync"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="DB_CONNECTION" value="A_testing"/>
        <env name="DB_DATABASE" value=":memory:"/>
    </php>
</phpunit>

this .env

APP_NAME=Ali
APP_ENV=testing
APP_KEY=base64:4pMDQn44sFpSQW64I4TswIv5mV4l9Ck0UM0Om4aRQm0=
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_URL=http://localhost
# DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306


DB_CONNECTION=sqlite
DB_DATABASE=database.sqlite
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

this database connection

 'connections' => [

        'atroha_testing' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', storage_path("database.sqlite")),
            'prefix' => '',
        ],

        'sqlite' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
        ],

        'A_testing' => [
            'driver' => 'mysql',
            'host' => env('DB_TEST_HOST', 'localhost'),
            'port' => env('DB_TEST_PORT', '3306'),
            'database' => env('DB_TEST_DATABASE', 'database.sqlite'),
            'username' => env('DB_TEST_USERNAME', 'root'),
            'password' => env('DB_TEST_PASSWORD', ''),
            'unix_socket' => env('DB_TEST_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
        ],
]
Sep
03
2 months ago
Activity icon

Replied to How To Search Inside This Json

i will try to upgrade to 5.8, and then i will see

Activity icon

Replied to How To Search Inside This Json

Laravel Framework 5.6.39

Activity icon

Replied to How To Search Inside This Json

look up, update my question

Activity icon

Replied to How To Search Inside This Json

this is code

$users = DB::table('standards')
                ->whereJsonContains('document_type', $doc_type)
                ->get();
                return $users;

after i executed i get

Syntax error or access violation: 1305 FUNCTION atroha.json_contains does not exist in 
Activity icon

Replied to How To Search Inside This Json

it is good , but i thing this just for laravel 6.0 and i am working with laravel 5.8

Activity icon

Replied to How To Search Inside This Json

@roborobok okay, i will edit later, so suppose it will, how can i search?

Activity icon

Started a new Conversation How To Search Inside This Json

i am trying to search for this record , but result what i get is null and this record is exist already , how can I make ?

public function store(Request $request)
{
   $doc_type = "masterResearchDomains";
    $standard = Standard::where('document_type', '=', $doc_type )->first();
    dd($standard); // getting null
}

and the file inside database look like so :

id  | document_type  
1   |["masterResearchDomains,masterResearchDomains2"]
2   |["m1,m2,masterResearchDomains3"]
Aug
27
2 months ago
Activity icon

Replied to How To Add Plugin To Tinymce

thanks @bobbybouwmann for your consideration to help me, thanks a lot..

it is not working yet but you have brought me closer to the point of view

Aug
26
2 months ago
Activity icon

Replied to How To Add Plugin To Tinymce

loading like this :

<template>
   <div class="editor-container">
      <form @submit.prevent="update_content" class="editor-editor">
        <text-editor
          :class="{'element_index_id': true}"
          v-model="content"
          api-key="5qido9zdxhj8pkkpn0b209on29euh2yfnosp41qcu1mw788j"
          :init="tinymce_config"
          @onSaveContent="updateContent"
        ></text-editor>
      </form>
    </div>
</template>

in javascript :

<script>
import textEditor from "@tinymce/tinymce-vue";
import tinymcConfig from "../../../services/config/tinymc";

export default {

    components: {
          textEditor
   },
   computed: {
        tinymce_config() {

            // Load css to indexes
            tinymcConfig.content_style = this.style;

        // Loading  all config
            return tinymcConfig; 
        },
   },
   method:{
    updateContent() {
      this.$store.dispatch("update_content").then(response => {});
    }
   }

}
Aug
25
2 months ago
Activity icon

Started a new Conversation How To Add Plugin To Tinymce

I am working with tinymce and i need to add plugin , i fallow documetation of tinymce to add new plugin..

as documentation on tinymce plugin look like :

tinymce.PluginManager.add('example', function(editor, url) {
  var openDialog = function () {
    return editor.windowManager.open({
      title: 'Example plugin',
      body: {
        type: 'panel',
        items: [
          {
            type: 'input',
            name: 'title',
            label: 'Title'
          }
        ]
      },
      buttons: [
        {
          type: 'cancel',
          text: 'Close'
        },
        {
          type: 'submit',
          text: 'Save',
          primary: true
        }
      ],
      onSubmit: function (api) {
        var data = api.getData();
        // Insert content when the window form is submitted
        editor.insertContent('Title: ' + data.title);
        api.close();
      }
    });
  };
  
  // Add a button that opens a window
  editor.ui.registry.addButton('example', {
    text: 'My button',
    onAction: function () {
      // Open window
      openDialog();
    }
  });

  // Adds a menu item, which can then be included in any menu via the menu/menubar configuration
  editor.ui.registry.addMenuItem('example', {
    text: 'Example plugin',
    onAction: function() {
      // Open window
      openDialog();
    }
  });

  return {
    getMetadata: function () {
      return  {
        name: "Example plugin",
        url: "http://exampleplugindocsurl.com"
      };
    }
  };
});

and put it into seperate file called plugins/example/plugin.js and added to tinymce using this script :

{
  selector: "#editor",
  directionality: "rtl",
  branding: false,
  height: 500,
  theme: "modern",
  // toolbar: 'mybutton',
  external_plugins: {
    'example': "plugins/example/plugin.js",
  },
  plugins:
    "example",
}

and after run it i get undefiend tinymce

what can I do to fixed ??

Aug
23
2 months ago
Activity icon

Replied to What Is Different Or Best Practices

@orion thanks , so as you said when relations is one-to-many (User, Post) it should not use {{ $post->owner()->first()->name }}

Aug
22
2 months ago
Activity icon

Started a new Conversation What Is Different Or Best Practices

sometimes i am fall in confuse between this functions :

User.php file

public function post()
{
    return $this->hasMany(Post::class); or return $this->hasMany(Post::class, 'user_id');
}

Post.php file

public function owner()
{

    return $this->belongsTo(User::class);  or return $this->belongsTo(User::class, 'user_id');
}

in blade file

{{ $post->owner->name }}  or {{ $post->owner()->first()->name}}
 
Jul
19
3 months ago
Activity icon

Started a new Conversation InvalidArgumentException

I have controller route me to specific view and this view is exists but fir this error. InvalidArgumentException

View [pages1.tables] not found.

web.php  file

Route::group(['prefix' => 'admin', 'namespace' => 'admin'], function(){
    Route::get('/dashboard', '[email protected]')->name('admin.dahsboard');
    
    /** All meterail design pages for dashboard  */
    Route::get('tables', '[email protected]');
    Route::get('icons', '[email protected]');
    Route::get('notification', '[email protected]');
    Route::get('typography', '[email protected]');
    Route::get('profile', '[email protected]');

});






<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class PagesController extends Controller
{
    public function tables()
    {
        // dd(view());
        return view('pages1.tables');
        // dd(view()->exists('tables'));
    }

    public function icons()
    {
        return view('layouts.pages.icons');
    }

    public function notification()
    {
        return view('layouts.pages.notification');
    }

    public function typography()
    {
        return view('layouts.pages.typography');
    }

    public function profile()
    {
        return view('layouts.pages.profile');
    }
}


and my layouts look like this structer

view
    -layouts
        -pages1
            -tables.blade.php

so whats problems