Omda

Omda

Member Since 7 Months Ago

Khartoum

Backend Developer at Kashta Lab

Experience Points 1,060
Experience Level 1

3,940 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 3
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 Sep
20 hours ago

Omda left a reply on 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.

Omda left a reply on Column Not Found: 1054 Unknown Column '_method' In 'field List'

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

Omda left a reply on 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 ?

14 Sep
1 day ago

Omda left a reply on 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',
    ];

Omda left a reply on 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();
        });
    }

Omda left a reply on My Factory Is Not Applied To My Test Cases

@ftiersch yes under database/factories

Omda 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
12 Sep
3 days ago

Omda left a reply on 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

Omda left a reply on 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

Omda left a reply on 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 .

Omda 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

Omda left a reply on 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

Omda left a reply on 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

Omda 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.

11 Sep
4 days ago

Omda left a reply on 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,
        ],

Omda 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,
        ],
]
03 Sep
1 week ago

Omda left a reply on How To Search Inside This Json

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

Omda left a reply on How To Search Inside This Json

Laravel Framework 5.6.39

Omda left a reply on How To Search Inside This Json

look up, update my question

Omda left a reply on 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 

Omda left a reply on 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

Omda left a reply on How To Search Inside This Json

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

Omda 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"]
27 Aug
2 weeks ago

Omda left a reply on 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

26 Aug
2 weeks ago

Omda left a reply on 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 => {});
    }
   }

}
25 Aug
3 weeks ago

Omda 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 ??

23 Aug
3 weeks ago

Omda left a reply on 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 }}

22 Aug
3 weeks ago

Omda 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}}
 
19 Jul
1 month ago

Omda 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

14 Feb
7 months ago

Omda left a reply on My Index Model Give Me Random Sort

@SHEZ1983 - thank you @shez1983 it's solved . i found in migration , type of order column is string and replace it by integer and it's work.

Omda left a reply on Where Are You All From?

heart of Africa Sudan

Omda started a new conversation My Index Model Give Me Random Sort

my model Index.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Document
 *
 * @property int $id
 * @property int $user_id
 * @property int $document_id
 * @property int $standard_id
 * @property int $top_index_id
 * @property int $level
 * @property string $type
 * @property string $name
 * @property string $about
 * @property string $order
 *
 * @mixin \Eloquent
 */
class Index extends Model
{

    


    protected $label = 'Index';
    protected $table = 'indexes';

    protected $fillable = [
        'id',
        'user_id',
        'document_id',
        'standard_id',
        'top_index_id',
        'level',
        'type', 
        'name', 
        'about', 
        'order', 
        'template_id'
    ];

    public function document()
    {
        return $this->belongsTo(Document::class, 'document_id');
    }

    public function content()
    {
        return $this->hasOne(Content::class);
    }

    public function related_indexes()
    {
        return $this->hasMany($this, 'top_index_id');
    }

    public function references()
    {
        return $this->belongsToMany("App\Reference", "document_reference");
    }

    public function comments(){
        return $this->hasMany("App\Comment");
    }
}


my IndexesApiController

<?php

namespace App\Http\Controllers\API;

use App\Document;
use App\Dropdown;
use App\Index;
use Auth;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Notifications\IndexesNotification;
use App\User;

class IndexesApiController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Document $document)
    {
        try {
            
            return response()->json([
                'indexes' => $document->indexes()->orderBy('order', 'ASC')->get()
            ], 200);

        } catch (ModelNotFoundException $e) {
            return response($e->getMessage(), 500);
        }
    }

public function reOrderIndexes(Request $request, Document $document)
    {
        $oldOrderIndexes = $document->indexes()->get();

        $newOrderIndexes = $request->newIndexes;

        foreach($oldOrderIndexes as $oldIndex){
            foreach($newOrderIndexes as $newIndex){
                if($newIndex['id'] == $oldIndex->id){
                    $oldIndex->update(['order' => $newIndex['order']]);
                }
            }
        }

        return response()->json([
            // 'indexes' => $document->tasks()->orderBy('order','ASC')->get()
            'indexes' => $document->indexes()->orderBy('order', 'asc')->take(10)->get()
            // 'indexes' => $document->indexes()->sortBy('order')->values()->all()
        ], 200);
    }

}

then when print result show as :

    order = 1
        order = 10
        order = 2
        order = 3
        order = 4
        order = 5
        order = 6
        order = 7
        order = 8
        order = 9

and when i take(5) result will be :

         order = 1
        order = 2
        order = 3
        order = 4
        order = 5

i need someone tell me what is error please..